From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 2FFFCA00E6
	for <public@inbox.dpdk.org>; Mon, 13 May 2019 03:56:44 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id B22E74C99;
	Mon, 13 May 2019 03:56:41 +0200 (CEST)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 0C5FF2B8D;
 Mon, 13 May 2019 03:56:39 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 12 May 2019 18:56:38 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,464,1549958400"; d="scan'208";a="171024356"
Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96])
 by fmsmga002.fm.intel.com with ESMTP; 12 May 2019 18:56:36 -0700
Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.111]) by
 PGSMSX105.gar.corp.intel.com ([169.254.4.8]) with mapi id 14.03.0415.000;
 Mon, 13 May 2019 09:56:35 +0800
From: "Zhao1, Wei" <wei.zhao1@intel.com>
To: wangyunjian <wangyunjian@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "i.maximets@samsung.com" <i.maximets@samsung.com>, xudingke
 <xudingke@huawei.com>, "stable@dpdk.org" <stable@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when
 port is	being removed
Thread-Index: AQHVBZzg8pC4KM8MqEizW7Arf7A3JaZjqAPQgAAQKQCABJqgIA==
Date: Mon, 13 May 2019 01:56:35 +0000
Message-ID:
 <A2573D2ACFCADC41BB3BE09C6DE313CA07EE5C8F@PGSMSX103.gar.corp.intel.com>
References: <1557319898-9588-1-git-send-email-wangyunjian@huawei.com>
 <A2573D2ACFCADC41BB3BE09C6DE313CA07EE5561@PGSMSX103.gar.corp.intel.com>
 <34EFBCA9F01B0748BEB6B629CE643AE60CAE5747@DGGEMM533-MBX.china.huawei.com>
In-Reply-To: <34EFBCA9F01B0748BEB6B629CE643AE60CAE5747@DGGEMM533-MBX.china.huawei.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-version: 11.0.600.7
dlp-reaction: no-action
x-originating-ip: [172.30.20.206]
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190513015635.i76z-xJhnV94VpO6UD7VQ5P3ii4GZOiNXjFIcnbuMtg@z>

Thank you for your more info!

Acked-by: Wei Zhao <wei.zhao1@intel.com>



> -----Original Message-----
> From: wangyunjian [mailto:wangyunjian@huawei.com]
> Sent: Friday, May 10, 2019 7:38 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when p=
ort is
> being removed
>=20
>=20
>=20
> > -----Original Message-----
> > From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> > Sent: Friday, May 10, 2019 11:14 AM
> > To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > 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 han=
dler.
> > If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> > Maybe there is an accidental situation that some interrupt like LSC
> > trigger
> > ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev =
stop?
> > Then we need to cancel it in eth_ixgbe_dev_uninit().
> > Is you issue the same as above or other?
>=20
> Yes,  it is as above. It is easy to reproduce through fault injection. As=
 follow:
>=20
> 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_fibe=
r) {
>                         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);
>=20
> >
> >
> > > -----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
> > > <wangyunjian@huawei.com>; stable@dpdk.org
> > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when
> > > port is being removed
> > >
> > > From: Yunjian Wang <wangyunjian@huawei.com>
> > >
> > > 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 handler.
> > > It triggers segfault.
> > >
> > > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > > update")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > > ---
> > >  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
> > >