From: Matan Azrad <matan@mellanox.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
Thomas Monjalon <thomas@monjalon.net>,
Gaetan Rivet <gaetan.rivet@6wind.com>,
Jingjing Wu <jingjing.wu@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
Neil Horman <nhorman@tuxdriver.com>,
"Bruce Richardson" <bruce.richardson@intel.com>,
Konstantin Ananyev <konstantin.ananyev@intel.com>,
"stable@dpdk.org" <stable@dpdk.org>,
"Olga Shern" <olgas@mellanox.com>
Subject: Re: [dpdk-stable] [PATCH v3 1/7] ethdev: fix port data reset timing
Date: Wed, 25 Apr 2018 14:01:00 +0000 [thread overview]
Message-ID: <HE1PR0501MB2668F47E92B8B31423D4A5F2D28F0@HE1PR0501MB2668.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <eafd5581-5ff9-663c-119c-e02c61851dc3@intel.com>
Hi Ferruh
From: Ferruh Yigit, Wednesday, April 25, 2018 3:54 PM
> On 4/25/2018 1:16 PM, Matan Azrad wrote:
> > Hi all
> >
> > From: Ferruh Yigit, Thursday, April 19, 2018 2:08 PM
> >>> But rte_eth_dev_release_port() is still broken because of this
> >>> change, please check _rte_eth_dev_callback_process() which uses
> >>> dev->data- port_id.
> >
> > The issue is that a DESTROY callback gets port_id=0 all the time, regardless
> the destroyed port id.
> >
> > Let's discuss about the fix:
> >
> > There are 2 options for the DESTROY event meaning:
> >
> > 1. The device is going to be destroyed in the future (a bit after the callbacks
> calling).
> > The user may think that there is a valid data in the device structure in
> the callback time,
> > Thus, he may use it.
> > The fix here is to move the callback to the start of the function,
> > In this time the data field is still valid.
> >
> > 2. The device was already destroyed in the past (a bit before the callbacks
> calling).
> > The user should think that there is no any valid data in the device
> structure in the callback time,
> > Thus, he doesn't use it.
> > The issue here:
> > _rte_eth_dev_callback_process() assumes there is a valid data in the
> data field all the time,
> > But in this case the data field is not valid because the device was
> already destroyed.
> > Optional fixes:
> > 1. Always keep the data->port_id valid.
> > 2. keep the data->port_id valid only for the
> _rte_eth_dev_callback_process() call.
> > 3. Change _rte_eth_dev_callback_process() arg from "struct
> rte_eth_dev *dev" to "uint16_t port_id"
> > a. Need to change all the calls for this internal API.
> >
> > I vote to 2.1.
> >
> >
> > What do you think?
>
> What is the concern with 1? It is easy to implement.
>
Yes, also 2.1 and 2.2 are easy.
> And it may be better because if callback called after device destroyed, there
> is no guarantee/locking that same port won't be re-used, in the middle of the
> callback function rte_eth_dev_data can be updated, no?
>
Good point!
I think we must guarantee no port allocation for the same port id in the callback time.
I also prefer to not call the callbacks in the critical section.
So maybe call it before the locking is better.
next prev parent reply other threads:[~2018-04-25 14:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1511870281-15282-1-git-send-email-matan@mellanox.com>
[not found] ` <1515318351-4756-1-git-send-email-matan@mellanox.com>
2018-01-07 9:45 ` [dpdk-stable] [PATCH v2 1/6] " Matan Azrad
[not found] ` <1516293317-30748-1-git-send-email-matan@mellanox.com>
2018-01-18 16:35 ` [dpdk-stable] [PATCH v3 1/7] " Matan Azrad
2018-01-18 17:00 ` Thomas Monjalon
2018-01-19 12:38 ` Ananyev, Konstantin
2018-03-05 11:24 ` Ferruh Yigit
2018-03-05 14:52 ` Matan Azrad
2018-03-05 15:06 ` Ferruh Yigit
2018-03-05 15:12 ` Matan Azrad
2018-03-27 22:37 ` Ferruh Yigit
2018-03-28 12:07 ` Matan Azrad
2018-03-30 10:39 ` Ferruh Yigit
2018-04-19 11:07 ` Ferruh Yigit
2018-04-25 12:16 ` Matan Azrad
2018-04-25 12:30 ` [dpdk-stable] [dpdk-dev] " Ori Kam
2018-04-25 12:54 ` [dpdk-stable] " Ferruh Yigit
2018-04-25 14:01 ` Matan Azrad [this message]
2018-01-18 16:35 ` [dpdk-stable] [PATCH v3 2/7] ethdev: fix used portid allocation Matan Azrad
2018-01-18 17:00 ` Thomas Monjalon
2018-01-19 12:40 ` Ananyev, Konstantin
2018-01-20 16:48 ` Matan Azrad
2018-01-20 17:26 ` Ananyev, Konstantin
[not found] ` <1516483468-9048-1-git-send-email-matan@mellanox.com>
2018-01-20 21:24 ` [dpdk-stable] [PATCH v4 1/7] ethdev: fix port data reset timing Matan Azrad
2018-01-20 21:24 ` [dpdk-stable] [PATCH v4 2/7] ethdev: fix used portid allocation Matan Azrad
[not found] ` <1516639103-27166-1-git-send-email-matan@mellanox.com>
2018-01-22 16:38 ` [dpdk-stable] [PATCH v5 1/7] ethdev: fix port data reset timing Matan Azrad
2018-01-22 16:38 ` [dpdk-stable] [PATCH v5 2/7] ethdev: fix used portid allocation Matan Azrad
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=HE1PR0501MB2668F47E92B8B31423D4A5F2D28F0@HE1PR0501MB2668.eurprd05.prod.outlook.com \
--to=matan@mellanox.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=gaetan.rivet@6wind.com \
--cc=jingjing.wu@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=nhorman@tuxdriver.com \
--cc=olgas@mellanox.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/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).