DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Andrew Rybchenko <arybchenko@solarflare.com>
Subject: Re: [dpdk-dev] [PATCH 20.05] ethdev: clear struct on releasing port
Date: Thu, 13 Feb 2020 20:43:17 +0100	[thread overview]
Message-ID: <1913442.o4kTbAZ4gJ@xps> (raw)
In-Reply-To: <f269433e-92e0-78ed-5380-a9394f73a812@intel.com>

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.



      reply	other threads:[~2020-02-13 19:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 14:33 Thomas Monjalon
2020-02-13 15:16 ` Ferruh Yigit
2020-02-13 15:27   ` Thomas Monjalon
2020-02-13 16:05     ` Ferruh Yigit
2020-02-13 19:43       ` Thomas Monjalon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1913442.o4kTbAZ4gJ@xps \
    --to=thomas@monjalon.net \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).