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>
Subject: Re: [dpdk-stable] [PATCH v3 1/7] ethdev: fix port data reset timing
Date: Mon, 5 Mar 2018 15:12:56 +0000 [thread overview]
Message-ID: <AM4PR0501MB26574B4D8CF840957B7FBB40D2DA0@AM4PR0501MB2657.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <b63a4ad5-83a7-d8d2-5162-d470ee3388e9@intel.com>
Hi Ferruh
From: Ferruh Yigit, Sent: Monday, March 5, 2018 5:07 PM
> On 3/5/2018 2:52 PM, Matan Azrad wrote:
> > HI
> >
> > From: Ferruh Yigit, Sent: Monday, March 5, 2018 1:24 PM
> >> On 1/18/2018 4:35 PM, Matan Azrad wrote:
> >>> rte_eth_dev_data structure is allocated per ethdev port and can be
> >>> used to get a data of the port internally.
> >>>
> >>> rte_eth_dev_attach_secondary tries to find the port identifier using
> >>> rte_eth_dev_data name field comparison and may get an identifier of
> >>> invalid port in case of this port was released by the primary
> >>> process because the port release API doesn't reset the port data.
> >>>
> >>> So, it will be better to reset the port data in release time instead
> >>> of allocation time.
> >>>
> >>> Move the port data reset to the port release API.
> >>>
> >>> Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple
> >>> process model")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Matan Azrad <matan@mellanox.com>
> >>> ---
> >>> lib/librte_ether/rte_ethdev.c | 2 +-
> >>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/lib/librte_ether/rte_ethdev.c
> >>> b/lib/librte_ether/rte_ethdev.c index 7044159..156231c 100644
> >>> --- a/lib/librte_ether/rte_ethdev.c
> >>> +++ b/lib/librte_ether/rte_ethdev.c
> >>> @@ -204,7 +204,6 @@ struct rte_eth_dev *
> >>> return NULL;
> >>> }
> >>>
> >>> - memset(&rte_eth_dev_data[port_id], 0, sizeof(struct
> >> rte_eth_dev_data));
> >>> eth_dev = eth_dev_get(port_id);
> >>> snprintf(eth_dev->data->name, sizeof(eth_dev->data->name),
> >> "%s", name);
> >>> eth_dev->data->port_id = port_id;
> >>> @@ -252,6 +251,7 @@ struct rte_eth_dev *
> >>> if (eth_dev == NULL)
> >>> return -EINVAL;
> >>>
> >>> + memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));
> >>
> >> Hi Matan,
> >>
> >> What most of the vdev release path does is:
> >>
> >> eth_dev = rte_eth_dev_allocated(...)
> >> rte_free(eth_dev->data->dev_private);
> >> rte_free(eth_dev->data);
> >> rte_eth_dev_release_port(eth_dev);
> >>
> >> Since eth_dev->data freed, memset() it in rte_eth_dev_release_port()
> >> will be problem.
> >>
> >> We don't run remove path that is why we didn't hit the issue but this
> >> seems problem for all virtual PMDs.
> >
> > Yes, it is a problem and should be fixed:
> > For vdevs which use private rte_eth_dev_data the remove order can be:
> > private_data = eth_dev->data;
> > rte_free(eth_dev->data->dev_private);
> > rte_eth_dev_release_port(eth_dev); /* The last operation working
> on ethdev structure. */
> > rte_free(private_data);
>
> Do we need to save "private_data"?
Just to emphasis that eth_dev structure should not more be available after rte_eth_dev_release_port().
Maybe in the future rte_eth_dev_release_port() will zero eth_dev structure too :)
> >
> >
> >> Also rte_eth_dev_pci_release() looks problematic now.
> >
> > Yes, again, the last operation working on ethdev structure should be
> rte_eth_dev_release_port().
> >
> > So need to fix all vdevs and the rte_eth_dev_pci_release() function.
> >
> > Any comments?
> >
next prev parent reply other threads:[~2018-03-05 15:12 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 [this message]
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
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=AM4PR0501MB26574B4D8CF840957B7FBB40D2DA0@AM4PR0501MB2657.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=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).