From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2474DA0544; Thu, 13 Feb 2020 20:43:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5F7351BE94; Thu, 13 Feb 2020 20:43:26 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id 2904C1BE90 for ; Thu, 13 Feb 2020 20:43:24 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 0B58293E; Thu, 13 Feb 2020 14:43:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 13 Feb 2020 14:43:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=TVvO3/q6PMoGqzS++ETDrYqum0rPhkWV2/h9oboyADw=; b=n4lT8Puy+yhq LGoFvy9afT0Bf/hvhTOWzeVfH1t5XZF/k1fo6r8mvLibLw6VtVzwnf15S4mK53gq +6wyNt2bD7zjCDoHAPRMumN/OMn30yiAzLcMNU+JfiJFZSeLx7kbjuW75xmK4NZl Tc1OnmvpWLONO4UkziIZfmrIkdvIakU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=TVvO3/q6PMoGqzS++ETDrYqum0rPhkWV2/h9oboyA Dw=; b=cQKQaJGNuLxVJqw8PzLuuaL4aV4WR/Xo/2KqPLuY7SViykdLMIYnW9cFq nNO6lRp35nbFIZMVuf+t6ZFepF2wUUGPUeK6scsDHPyf/lf4tUarDV4b0QbNlb44 Tzw1bLP2fXgYEtge5JXERh+xo7YQxF8hExHsDtLVmO5Wo+bTZ3x4RKfWgpdGIyQM uZOm8i/KytJR9LSHQ0iG60cT8ibic9BUKli1gOvarEnZZzZYTUVw6bo1iu9F9Azf MvA1wg9WySDNrWuAh+F6kZgxlb3yUqBQORPfsZBAJb/3/U1VgPPRou/231Bxevvc zPfedED7JqO5ei0i/IVqoW5nEIGQg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieekgddufedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D9A5930600DC; Thu, 13 Feb 2020 14:43:19 -0500 (EST) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, Andrew Rybchenko Date: Thu, 13 Feb 2020 20:43:17 +0100 Message-ID: <1913442.o4kTbAZ4gJ@xps> In-Reply-To: References: <20200213143312.1021487-1-thomas@monjalon.net> <2855847.M6yMPqc0BA@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 20.05] ethdev: clear struct on releasing port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 13/02/2020 17:05, Ferruh Yigit: > On 2/13/2020 3:27 PM, Thomas Monjalon wrote: > > 13/02/2020 16:16, Ferruh Yigit: > >> On 2/13/2020 2:33 PM, Thomas Monjalon wrote: > >>> The function rte_eth_dev_release_port() is called by drivers > >>> when closing or removing a device. > >>> Its main usage should be via rte_eth_dev_close() by up-to-date > >>> drivers which are compliant with RTE_ETH_DEV_CLOSE_REMOVE flag. > >>> > >>> When a port is released, the data (rte_eth_dev_data) are cleared, > >>> but the pointers in rte_eth_dev were not cleared. > >>> It may cause issues with code paths trying to use dangling pointers > >>> (e.g. the .device pointer which may reference a removed rte_device). > >>> Everything is now cleared to 0 when releasing. > >>> The state is explicitly set to RTE_ETH_DEV_UNUSED which is 0 anyway. > >>> > >>> Using this patch may reveal bugs in some code paths: > >>> - device pointer must be saved before closing a port if needed > >> > >> Is this saving should be done in application code or will be done by ethdev? > > > > by the application > > From ethdev point of view, when a port is closed, there is nothing more to do next. > > > > That sound reasonable from ethdev perspective, but it will push dealing with > rte_device level details to the application. > > Like this change will be forcing each application to store the rte_device > pointer before close(), in case device can be detached later. Yes I think PMDs could release rte_device when closing the last port of the device. I am not sure what is the benefit of explicit detach. That's something we should discuss, agree and write in the API doc.