From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D46B8A00E6 for ; Tue, 14 May 2019 16:01:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F21A65F1C; Tue, 14 May 2019 16:01:27 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 2ACFD5F1A; Tue, 14 May 2019 16:01:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2019 07:01:24 -0700 X-ExtLoop1: 1 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga008.jf.intel.com with ESMTP; 14 May 2019 07:01:24 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 14 May 2019 07:01:24 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 14 May 2019 07:01:23 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.70]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.10]) with mapi id 14.03.0415.000; Tue, 14 May 2019 22:01:21 +0800 From: "Zhang, Qi Z" To: "Zhao1, Wei" , wangyunjian , "dev@dpdk.org" CC: "i.maximets@samsung.com" , xudingke , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed Thread-Index: AQHVBZzdNHGsspoOn02Aix+Su34jq6ZjK52AgACMjwCABBSugIAC4rSQ Date: Tue, 14 May 2019 14:01:21 +0000 Message-ID: <039ED4275CED7440929022BC67E706115338137D@SHSMSX103.ccr.corp.intel.com> References: <1557319898-9588-1-git-send-email-wangyunjian@huawei.com> <34EFBCA9F01B0748BEB6B629CE643AE60CAE5747@DGGEMM533-MBX.china.huawei.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTdlZjdkOTItY2I3ZS00ZjNiLWJjOGQtZDU1NDE5MzRlYzY3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoia3R3Z0c2TnFUYXQrN2RcL2xSV1FMRkl5bHlhZkFHMWd4MmszODNKeVNsbGZPaWpuVjhOZ252d1ZWcnU3OWg5RysifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190514140121.MdNMj_1CBFTK8erVIWwOC4Hg8sLHHlfQFKnQR-Dm7ys@z> > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhao1, Wei > Sent: Monday, May 13, 2019 9:57 AM > To: wangyunjian ; dev@dpdk.org > Cc: i.maximets@samsung.com; xudingke ; > stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when p= ort is > being removed >=20 > Thank you for your more info! >=20 > Acked-by: Wei Zhao >=20 Applied to dpdk-next-net-intel. Thanks Qi >=20 > > -----Original Message----- > > From: wangyunjian [mailto:wangyunjian@huawei.com] > > Sent: Friday, May 10, 2019 7:38 PM > > To: Zhao1, Wei ; dev@dpdk.org > > Cc: i.maximets@samsung.com; xudingke ; > > stable@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler > > when port is being removed > > > > > > > > > -----Original Message----- > > > From: Zhao1, Wei [mailto:wei.zhao1@intel.com] > > > Sent: Friday, May 10, 2019 11:14 AM > > > To: wangyunjian ; dev@dpdk.org > > > Cc: i.maximets@samsung.com; xudingke ; > > > stable@dpdk.org > > > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler > > > when port is being removed > > > > > > Hi, wangyunjian > > > > > > May I ask some more info about it? > > > Sure, we may this handler in ixgbe_dev_link_update_share (), but we > > > have "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)" > > > in function ixgbe_dev_stop() and ixgbevf_dev_stop() to cancel this > handler. > > > If you want to remove dev, you will call ixgbe_dev_stop() first, RIGH= T? > > > Maybe there is an accidental situation that some interrupt like LSC > > > trigger > > > ixgbe_dev_link_update() to set setup_link_alarm_handler just after de= v > stop? > > > Then we need to cancel it in eth_ixgbe_dev_uninit(). > > > Is you issue the same as above or other? > > > > Yes, it is as above. It is easy to reproduce through fault injection. = As follow: > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 975fa47..a1e93c0 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -4055,7 +4055,7 @@ static int > > ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > > if (link_up =3D=3D 0) { > > if (ixgbe_get_media_type(hw) =3D=3D > ixgbe_media_type_fiber) { > > intr->flags |=3D > IXGBE_FLAG_NEED_LINK_CONFIG; > > - rte_eal_alarm_set(10, > > + rte_eal_alarm_set(500 * 1000, > > > ixgbe_dev_setup_link_alarm_handler, dev); > > } > > return rte_eth_linkstatus_set(dev, &link); > > > > > > > > > > > > -----Original Message----- > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian > > > > Sent: Wednesday, May 8, 2019 8:52 PM > > > > To: dev@dpdk.org > > > > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang > > > > ; stable@dpdk.org > > > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler > > > > when port is being removed > > > > > > > > From: Yunjian Wang > > > > > > > > The nic's interrupt source has some active handler, which maybe > > > > call > > > > ixgbe_dev_link_update() to set link handler. We should cancel the > > > > link handler before remove dev to prevent executing the link handle= r. > > > > It triggers segfault. > > > > > > > > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link > > > > update") > > > > 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 975fa47..2470c89 100644 > > > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > > > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off { > > > > /* cancel the delay handler before remove dev */ > > > > rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, > > > eth_dev); > > > > > > > > + /* cancel the link handler before remove dev */ > > > > + rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, > > > eth_dev); > > > > + > > > > /* uninitialize PF if max_vfs not zero */ > > > > ixgbe_pf_host_uninit(eth_dev); > > > > > > > > -- > > > > 1.8.3.1 > > > >