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 22774A0542; Thu, 13 Feb 2020 16:27:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F08D1C029; Thu, 13 Feb 2020 16:27:58 +0100 (CET) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by dpdk.org (Postfix) with ESMTP id 042221C00F for ; Thu, 13 Feb 2020 16:27:57 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 001DA13CF; Thu, 13 Feb 2020 10:27:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 13 Feb 2020 10:27:56 -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=gSSZsdhEOcaJvHaheAqHo9nOCmBYWM9w/RQAmfs+0iw=; b=iy5sYxLA+GRo jkGkT7zFRxOQD/kaxxz73eBXGMbkQQa70x3hORGlO0XNdAQZ/UwZMUoUpl6dnRtD flBGdF5T1UipUY0PsiDUeyot2l8f9Qpc8D211egrFUMp2KjweYV4UlaTFGUTlB/p hutA6THztSXrBHuJzawTuS0bqpZLtC8= 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=gSSZsdhEOcaJvHaheAqHo9nOCmBYWM9w/RQAmfs+0 iw=; b=E6un3EUiaeXt9O/RH0K/6pShzqg1tgiLYMRUljnuKCZk6Xv2Dk/4GYZBP o/J45SagDeYiksZoc3EOmHUr4ab/a6I1KJtaKXfIYQHAOHSlsCpazWhIQXEKZ1EU azeCOQBChLCLgezkDLrqVJ/LYkAoMtVk/Wyi6zKwtK2wXbY47/vTPEGXeHcvxQjE +fcRDLsLWH1C0lWuLox76pGwAPct7lOJ3zLxcmkYYPwXiz4lVHnziSmurIi+P9IW Y41ITO2D7m9rXrEWAZGYcR9ek7Zuh1qr78XR8kphoq9oaKG39t15hzGZx5DzCfnV 7HsIFIdKtgMWi6iN4k5k/o/nwK6Fg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieekgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 B5B363060B27; Thu, 13 Feb 2020 10:27:54 -0500 (EST) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, Andrew Rybchenko Date: Thu, 13 Feb 2020 16:27:53 +0100 Message-ID: <2855847.M6yMPqc0BA@xps> In-Reply-To: <5ba0db1f-f530-f25f-b9fa-521ed9921c7e@intel.com> References: <20200213143312.1021487-1-thomas@monjalon.net> <5ba0db1f-f530-f25f-b9fa-521ed9921c7e@intel.com> 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 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.