From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from huawei.com (szxga08-in.huawei.com [45.249.212.255]) by dpdk.org (Postfix) with ESMTP id C26BD2C39; Tue, 26 Feb 2019 08:21:41 +0100 (CET) Received: from DGGEMM405-HUB.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id BFE868BB83585749E925; Tue, 26 Feb 2019 15:21:39 +0800 (CST) Received: from DGGEMM533-MBX.china.huawei.com ([169.254.5.181]) by DGGEMM405-HUB.china.huawei.com ([10.3.20.213]) with mapi id 14.03.0415.000; Tue, 26 Feb 2019 15:21:29 +0800 From: wangyunjian To: "Zhang, Qi Z" , "dev@dpdk.org" CC: xudingke , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/ixgbe: fix crash when on remove Thread-Index: AQHUw0bCr23B3oistUyWbmwZg6K3O6XxHVIAgACde7A= Date: Tue, 26 Feb 2019 07:21:30 +0000 Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60CA392C3@DGGEMM533-MBX.china.huawei.com> References: <1550026132-9244-1-git-send-email-wangyunjian@huawei.com> <039ED4275CED7440929022BC67E706115333A9D7@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <039ED4275CED7440929022BC67E706115333A9D7@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.24.66] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix crash when on remove X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 07:21:42 -0000 > -----Original Message----- > From: Zhang, Qi Z [mailto:qi.z.zhang@intel.com] > Sent: Tuesday, February 26, 2019 1:35 PM > To: wangyunjian ; dev@dpdk.org > Cc: xudingke ; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix crash when on remove >=20 > Hi: >=20 > > -----Original Message----- > > From: wangyunjian [mailto:wangyunjian@huawei.com] > > Sent: Wednesday, February 13, 2019 10:49 AM > > To: dev@dpdk.org > > Cc: Zhang, Qi Z ; xudingke@huawei.com; Yunjian > > Wang ; stable@dpdk.org > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix crash when on remove > > > > From: Yunjian Wang > > > > The nic's interrupt source has some active handler, when the port > > remove. We should cancel the delay handler before remove dev to > > prevent executing the delay handler. >=20 > Agree, thanks to capture this. >=20 > > > > Call Trace: > > #0 ixgbe_disable_intr (hw=3D0x0, hw=3D0x0) > > at /usr/src/debug/dpdk-18.11/drivers/net/ixgbe/ixgbe_ethdev.c:852 > > #1 ixgbe_dev_interrupt_delayed_handler (param=3D0xadb9c0 > > ) > > at /usr/src/debug/dpdk-18.11/drivers/net/ixgbe/ixgbe_ethdev.c:438= 6 > > #2 0x00007f05782147af in eal_alarm_callback (arg=3D) > > at /usr/src/debug/dpdk-18.11/lib/librte_eal/linuxapp/eal/ > > eal_alarm.c:90 > > #3 0x00007f057821320a in eal_intr_process_interrupts (nfds=3D1, > > events=3D0x7f056cbf3e88) at /usr/src/debug/dpdk-18.11/lib/ > > librte_eal/linuxapp/eal/eal_interrupts.c:838 > > #4 eal_intr_handle_interrupts (totalfds=3D, pfd=3D18) > > at /usr/src/debug/dpdk-18.11/lib/librte_eal/linuxapp/eal/ > > eal_interrupts.c:885 > > #5 eal_intr_thread_main (arg=3D) > > at /usr/src/debug/dpdk-18.11/lib/librte_eal/linuxapp/eal/ > > eal_interrupts.c:965 > > #6 0x00007f05708a0e45 in start_thread () from /usr/lib64/libpthread.= so.0 > > #7 0x00007f056eb4ab5d in clone () from /usr/lib64/libc.so.6 > > > > Fixes: 2866c5f1b87e ("ixgbe: support port hotplug") > > Cc: stable@dpdk.org > > > > Signed-off-by: Yunjian Wang > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 7493110..e9533e5 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -1336,6 +1336,9 @@ struct rte_ixgbe_xstats_name_off { > > rte_delay_ms(100); > > } while (retries++ < (10 + IXGBE_LINK_UP_TIME)); > > > > + /* cancel the delay handler before remove dev */ > > + rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, > eth_dev); > > + >=20 > I think it will be more safe to move this call ahead, the delayed handler= may > invoked application callback which may also invoke the ethdev API, but at > this moment, we already reset ethdev, we still have chance to get problem= , > right? > Is it better that we add this call at the beginning of dev_close? >=20 > Regards > Qi The delay handler callback was canceled after unregistered interrupt handle= r and the interrupt handler callback was unregistered after disabled uio. So = I added the call after rte_intr_callback_unregister. I am not sure if we can add the disable uio, unregister interrupt handler a= t the beginning of dev_close. Thanks Yunjian >=20 >=20 > > /* uninitialize PF if max_vfs not zero */ > > ixgbe_pf_host_uninit(eth_dev); > > > > -- > > 1.8.3.1 > >