> -----Original Message----- > From: Thomas Monjalon <[email protected]> > Sent: Tuesday, September 29, 2020 18:36 > To: Maxime Coquelin <[email protected]> > Cc: [email protected]; Yigit, Ferruh <[email protected]>; > [email protected]; Shepard Siegel > <[email protected]>; Ed Czeck <[email protected]>; John > Miller > <[email protected]>; Igor Russkikh <[email protected]>; > Pavel Belous > <[email protected]>; Somalapuram Amaranath <[email protected]>; Ajit > Khaparde > <[email protected]>; Somnath Kotur <[email protected]>; > Chas Williams > <[email protected]>; Wei Hu (Xavier) <[email protected]>; Hemant Agrawal > <[email protected]>; > Sachin Saxena <[email protected]>; Guo, Jia <[email protected]>; > Wang, Haiyue > <[email protected]>; Marcin Wojtas <[email protected]>; Michal Krawczyk > <[email protected]>; Guy > Tzalik <[email protected]>; Evgeny Schemeilin <[email protected]>; Igor > Chauskin <[email protected]>; > Zhang, Qi Z <[email protected]>; Wang, Xiao W <[email protected]>; > Ziyang Xuan > <[email protected]>; Xiaoyun Wang <[email protected]>; > Guoyang Zhou > <[email protected]>; Min Hu (Connor) <[email protected]>; Yisen Zhuang > <[email protected]>; > Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; > Yang, Qiming > <[email protected]>; Alfredo Cardigliano <[email protected]>; Shijith > Thotton > <[email protected]>; Srisivasubramanian Srinivasan > <[email protected]>; Stephen Hemminger > <[email protected]>; K. Y. Srinivasan <[email protected]>; Haiyang > Zhang <[email protected]>; > Long Li <[email protected]>; Harman Kalra <[email protected]>; Rasesh > Mody <[email protected]>; > Shahed Shaikh <[email protected]>; Wiles, Keith <[email protected]>; > Xia, Chenbo > <[email protected]>; Wang, Zhihong <[email protected]>; Yong Wang > <[email protected]>; > [email protected] > Subject: Re: [PATCH v3 28/29] ethdev: reset all when releasing a port > > 29/09/2020 12:26, Maxime Coquelin: > > On 9/29/20 1:14 AM, Thomas Monjalon wrote: > > > The function rte_eth_dev_release_port() was resetting partially > > > the struct rte_eth_dev. The drivers were completing it > > > with more pointers set to NULL in the close or remove operations. > > > > > > A full memset is done so most of those assignments become useless. > [...] > > With this patch, I get following segfault at init time with Virtio PMD: > > > > Program received signal SIGSEGV, Segmentation fault. > > 0x0000000000854c9b in rte_eth_dev_callback_register (port_id=32, > > event=RTE_ETH_EVENT_UNKNOWN, cb_fn=0x4b24de > > <eth_event_callback>, > > cb_arg=0x0) at ../lib/librte_ethdev/rte_ethdev.c:4042 > > 4042 > > TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), > > Yes this is because after closing a port, everything is resetted, > including .link_intr_cbs which is set only once in a constructor: > http://git.dpdk.org/dpdk/commit/?id=9ec0b3869d8 > > I can change this patch to selectively set pointers to NULL. > > Or if we prefer a big memset 0, we need to rework how RTE_ETH_ALL > is managed to register a callback for any event. > Instead of setting the callback for all ports, we could have > a special catch-call callback list which is called for all events. > This way we could revert initializing .link_intr_cbs in eth_dev_get(). > >
Move 'struct rte_eth_dev_cb_list link_intr_cbs' to the end of 'struct rte_eth_dev', and starting from link_intr_cbs, these members will be kept after closed ? :-) memset(eth_dev, 0, offsetof(struct rte_eth_dev, link_intr_cbs));

