On 3/30/2018 11:39 AM, Ferruh Yigit wrote: > On 3/28/2018 1:07 PM, Matan Azrad wrote: >> Hi Ferruh >> >>> From: Ferruh Yigit, Wednesday, March 28, 2018 1:38 AM >>> On 3/5/2018 3:12 PM, Matan Azrad wrote: >>>> 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: sta...@dpdk.org >>>>>>>> >>>>>>>> Signed-off-by: Matan Azrad <ma...@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 :) >>> >>> Hi Matan, >>> >>> Reminder of this issue, it would be nice to fix in this release. >>> >> >> Regarding the private rte_eth_dev_data, it should be fixed in the next >> thread: >> https://dpdk.org/dev/patchwork/patch/35632/ >> >> Regarding the rte_eth_dev_pci_release() function: I'm going to send a fix. > > Thanks Matan for the patch, > > 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.
Hi Matan, Any update on this? As mentioned above rte_eth_dev_release_port() is still broken. Thanks, ferruh > >> >>>> >>>>>> >>>>>> >>>>>>> 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? >>>>>> >>>> >> >