From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50A05A0C4C; Thu, 2 Sep 2021 16:45:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D4A840140; Thu, 2 Sep 2021 16:45:49 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 20DE54003C; Thu, 2 Sep 2021 16:45:46 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10094"; a="219194373" X-IronPort-AV: E=Sophos;i="5.85,262,1624345200"; d="scan'208";a="219194373" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2021 07:45:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,262,1624345200"; d="scan'208";a="533311765" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 02 Sep 2021 07:45:23 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 2 Sep 2021 07:45:23 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 2 Sep 2021 07:45:22 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Thu, 2 Sep 2021 07:45:22 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Thu, 2 Sep 2021 07:45:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hwz5f1jZ6gusTrR8K4+vvwCbtMl+ZFqYN8N1JfSKEr8uZxq6/trDgzgUfS3nN9JWs2u/MZvYBRcJc7iqmh0L1q6dhAbSSPwo/sho5Ds1WCdXz6i8Dk1CywY30L/bwaNwCUWD+DNW0xNcwxB2pjCyd7WOXUypkTxXEjszDOf8E5t9XHmv3tM+bOcH53oY5wlrHN5TALzd11KKH/P+zAAfgCKiVdPzA5zgC0ZsDo5ZNDizObRS1W1eBL/NMx6mWMFCU/as1WLHxzuzBJrLW+/9dZRwoUMXQPTz9J+NTLB64cmodL4jexkJFlz/NcYUoVjgPk9WiWgMXg+cFMfkRjyHcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=YP2eskOLB2U2CWOc2bfRfqhosG5PN5hjjXzOWU4B9Zg=; b=ZvUexmGvKOwDcZy7hGoRoKqxX9mxZRGXl1VwRs0gbqLcr6B14Xe24Z0FTUX4OZfMFTm41GVDVTf8WWatAP6v8Q74X73enhnCWk8eKAUI8WA9AVbwv4HbW+qwuf+JYhXAz2hdp8VKhAhBLYYdWyA989PnA195vdFYDVjRh89V+36bkft/qKoTDHrYVF4ShLEzSoOqEVPqEJ++oPmbjB7IaPr15C2vRVLRNrsup2zJy8x4Y9+2jdeVE4K0Be9MOsigpCmIMphUh43X8tdH62+QS+I3qDdW3ciSlzKmjs5LE+jfAEmgyRpQkGLXmw/ODFu9ADKFLDRpJBtvhtDQa2ubmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YP2eskOLB2U2CWOc2bfRfqhosG5PN5hjjXzOWU4B9Zg=; b=QBdCnFK6gKjEC7Dsbz7GtVIbmAnFDHYmHNmow+fKkQPi7WunQfV5S0IEqxLaE8S9ayvUNMejrk72mizladPSZ2xwloMMGDysW4/YTwEeA3cWUOuRZieXMbJdZNPRPXjycKGCAuCv0SeZVaKsCZP/Ao+5Q7GMIWcDCA/nPE70uvI= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN7PR11MB2676.namprd11.prod.outlook.com (2603:10b6:406:ac::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Thu, 2 Sep 2021 14:45:20 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::dcf0:d9f6:8024:1879]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::dcf0:d9f6:8024:1879%6]) with mapi id 15.20.4478.022; Thu, 2 Sep 2021 14:45:20 +0000 From: "Wang, Haiyue" To: "Yu, DapengX" , "Yang, Qiming" , "Zhang, Qi Z" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] net/ice: fix representor port segmentation fault Thread-Index: AQHXn99H5IzVJQXrw0W3tG7TQUYLWKuQ0miQ Date: Thu, 2 Sep 2021 14:45:20 +0000 Message-ID: References: <20210902094408.1294361-1-dapengx.yu@intel.com> In-Reply-To: <20210902094408.1294361-1-dapengx.yu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 35985b5d-3644-465b-97c1-08d96e204999 x-ms-traffictypediagnostic: BN7PR11MB2676: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oKCveeDkbvfA4fa3aUYsLDTLXqtC7+n2/r0t5OH5GSPB7QYn1aZO9XEA0K5vi5Zsv+5KXlEH5Zbq2gtm5T68Xkxcmu273EuycGQ1YpHbW2pS/MsjmysD8ixRiPATSkYyfQtSydIGid3yFic5sCShU+sldQtCNTfVPFNTul9tabd4f2bOPQmBzgjoBfjM8XLYJyAQj7CMzy9RG+2wrzp4mLEMFNKgZPH/hUGh9v3ztft6C1BpNE6XTVBsGamMI5ZJekmhet+HijicJ0Dl9b+Grx7wP3X/ISa2MW1YE4IvluBxm9ZNbFs3IcgtHwRBRfp0AZQJewWRklVbYTEdg3uj0bXmMzBogkMVOyhEMVk6EOaNy8e8kWv++/CiKGcm9QiL7t3WDT33DFTGdMknazCTusziZi2/6ekiW3f/HTYtiE2ufuOXpkR/ooaCKwwBa9GLR4ALbx97au78klrK+AE/XiPeCTlPqmnjVd3e9VwwcrsqbkrWvqomjyf25DJAkJSeQP1GSx97SWGQ+7JgK/P0rqEw3SGXvENKTjg7qVh9DviojNbLbijgURpkR3RGXnw6xo44rkYZnMTR60iXa+/YyZH9M8aNtWoUSMx1CzZRY3Rfs7ojyYVdyyw52iFo2Yse7LIVRD1gMINA/G5FO5FNQSJWZbq4a8tCOyCxUpIS5NfC5/u32LnCEbGDd0nGRwZ9HWJXhfP1QWFJXpJCt1dVqA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(376002)(136003)(39860400002)(396003)(450100002)(54906003)(478600001)(6636002)(33656002)(38100700002)(316002)(2906002)(83380400001)(5660300002)(110136005)(8936002)(71200400001)(122000001)(4326008)(26005)(8676002)(186003)(53546011)(38070700005)(6506007)(76116006)(66476007)(66556008)(66446008)(64756008)(55016002)(9686003)(7696005)(52536014)(66946007)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?sscrLv4+F6ntFhluG72T3spmFuxTySwF3Gldq3hGz5VHoOE2dV/WDuhgPKSc?= =?us-ascii?Q?ekFCafPEhAHjtCl8qyuYlUzuIzMcQlTUP19SpTHFC0yFm4IXaA6Ez4Qbdkqs?= =?us-ascii?Q?qMME8ioZnx26/Cp9uaN3lhvRHHrt8K2GVPRTRS3I9zF6XrwhXF1fgk3HtLG6?= =?us-ascii?Q?JOdOKYSRy3ikJ8hJYA8U1f0wex3xvYdUAc3u70QquvjW7H4/AfG5m7eg3C8g?= =?us-ascii?Q?LUGpmVVi19hm2Ut+7fJu8h7V2kB3TZNMhB69U1fFnB7uiOe4NwU8eijZSWLr?= =?us-ascii?Q?QNag6u7/k/9bcdrdicXR2xqv/b8vmtcaBtMmmXhQcOTAdxLCtFosxpmmTiDh?= =?us-ascii?Q?pVJZY27LIaO12GZAq0EU48WLaD8juYDwPnI4jATj/uDLA9Q4IoT++Om4aqUA?= =?us-ascii?Q?Td4O9AFG9/AFUndYvD6T3un/JUrtdtDaa+oOJUp+CqKtjBNvtAm479rvTi2k?= =?us-ascii?Q?x/je7U27ko2DKWaJdczjMB/Adp6OjASF91JOFeH1ZBSWKeWuP+ykwOStOheM?= =?us-ascii?Q?0DrHmz3EM2Fn3SO6hr/uorIbv/OHtRmGev2zc+0zxPMGFncMa/2QjDBT76Ic?= =?us-ascii?Q?SvZTkTf4i8C+BZTBIvJP126N8wPoQYItx2hnp7hU17yBcEebKAgTcdQIsoT3?= =?us-ascii?Q?DpUepXtXQUuQavllM95WR5t1t9P3+L+BB6lKt2ka6gA118pM5hPk07Y3esMV?= =?us-ascii?Q?JxmnlW3n3m8/pqBMTMOYEZ5ouSFbmBJdyW30swFXF2YBCxO47PkMR6vxEFdr?= =?us-ascii?Q?RUHRQnnEQe6eKQYXYVxhESrfnQzRnAjvRsOzrRthH3dsU5uUBlZh+aBNWLl9?= =?us-ascii?Q?1/RSkMp+CAjJAM9Q7/iwvFl/PKM4lIwsGOuv1c+JevcbGDl0gnL4BWWwBxQl?= =?us-ascii?Q?Ytk389hDjVqShIiHJsFV1eB+r6UKF9t+ApkMJ5gX7hiUk9ZT1gQWgIApVcQw?= =?us-ascii?Q?s6kQFsCdioLo0cLHbqnjwQq5nJVQkjlOV5d9dkNb8z7A/SWWbvCogtn2GaCR?= =?us-ascii?Q?8J2MuBlOa3SPcnmh14dG1jbQWD5mOtSTjzNlls1YUqqjCxWhDn8ij98s8SdK?= =?us-ascii?Q?DaXsGiuGRgZVheuwS0cTD2APlZrHo6QTvdmPW2iFd13tXfFC3pkTGUGLwDle?= =?us-ascii?Q?8MteTIS0kUQOaFZ0KuU+meZ312UdvxaDBikMsAtIxMH/8mcoGcKv6ffg3H57?= =?us-ascii?Q?ejFmE/RS9VbMs/+uTjNYl/9ZEDiqBs5lfJftkSKoUyF82LUv/0pmtSlgz9fz?= =?us-ascii?Q?kc0Jkj5wuqJbZdlEhWfFvZ1z7Mqlmr4F1P0oZs3lnvYa+4aWbinC0lWB13zi?= =?us-ascii?Q?LXnSqqYP32g+734401wogbOF?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35985b5d-3644-465b-97c1-08d96e204999 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Sep 2021 14:45:20.1397 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uw5Ug7q6FgC+RHe8taQIASUzToi7WgJJRZZ00CnNfZJPf/SwP/XiEj1x8lMDc1/VpNqjuIjGh9TvoIaXtCkqEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2676 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] net/ice: fix representor port segmentation fault X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: Yu, DapengX > Sent: Thursday, September 2, 2021 17:44 > To: Yang, Qiming ; Zhang, Qi Z > Cc: dev@dpdk.org; Wang, Haiyue ; Yu, DapengX ; > stable@dpdk.org > Subject: [PATCH] net/ice: fix representor port segmentation fault >=20 > From: Dapeng Yu >=20 > If DCF representor port is closed after DCF port is closed, there will > be segmentation fault because representor accesses the released resource > of DCF port. >=20 > This patch makes DCF representor port is always closed before DCF port is > closed. >=20 > Fixes: 5674465a32c8 ("net/ice: add DCF VLAN handling") > Cc: stable@dpdk.org >=20 > Signed-off-by: Dapeng Yu > --- > drivers/net/ice/ice_dcf_ethdev.c | 1 + > drivers/net/ice/ice_dcf_ethdev.h | 1 + > drivers/net/ice/ice_dcf_vf_representor.c | 26 ++++++++++++++++++++---- > 3 files changed, 24 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_e= thdev.c > index cab7c4da87..b837f69fd4 100644 > --- a/drivers/net/ice/ice_dcf_ethdev.c > +++ b/drivers/net/ice/ice_dcf_ethdev.c > @@ -874,6 +874,7 @@ ice_dcf_dev_close(struct rte_eth_dev *dev) > if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) > return 0; >=20 > + ice_dcf_vf_repr_close_all(adapter); > ice_dcf_free_repr_info(adapter); > ice_dcf_uninit_parent_adapter(dev); > ice_dcf_uninit_hw(dev, &adapter->real_hw); > diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_e= thdev.h > index 8510e37119..9e8d3ef0c5 100644 > --- a/drivers/net/ice/ice_dcf_ethdev.h > +++ b/drivers/net/ice/ice_dcf_ethdev.h > @@ -64,5 +64,6 @@ int ice_dcf_vf_repr_init(struct rte_eth_dev *vf_rep_eth= _dev, void *init_param); > int ice_dcf_vf_repr_uninit(struct rte_eth_dev *vf_rep_eth_dev); > int ice_dcf_vf_repr_init_vlan(struct rte_eth_dev *vf_rep_eth_dev); > void ice_dcf_vf_repr_stop_all(struct ice_dcf_adapter *dcf_adapter); > +void ice_dcf_vf_repr_close_all(struct ice_dcf_adapter *dcf_adapter); >=20 > #endif /* _ICE_DCF_ETHDEV_H_ */ > diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/i= ce_dcf_vf_representor.c > index 970461f3e9..121dea7483 100644 > --- a/drivers/net/ice/ice_dcf_vf_representor.c > +++ b/drivers/net/ice/ice_dcf_vf_representor.c > @@ -46,6 +46,7 @@ static int > ice_dcf_vf_repr_dev_stop(struct rte_eth_dev *dev) > { > dev->data->dev_link.link_status =3D ETH_LINK_DOWN; > + dev->data->dev_started =3D 0; >=20 > return 0; > } > @@ -53,6 +54,7 @@ ice_dcf_vf_repr_dev_stop(struct rte_eth_dev *dev) > static int > ice_dcf_vf_repr_dev_close(struct rte_eth_dev *dev) > { > + (void)ice_dcf_vf_repr_dev_stop(dev); Do we truly need the "(void)" ? > return ice_dcf_vf_repr_uninit(dev); > } >=20 > @@ -464,7 +466,6 @@ void > ice_dcf_vf_repr_stop_all(struct ice_dcf_adapter *dcf_adapter) > { > uint16_t vf_id; > - int ret; >=20 > if (!dcf_adapter->repr_infos) > return; > @@ -475,8 +476,25 @@ ice_dcf_vf_repr_stop_all(struct ice_dcf_adapter *dcf= _adapter) > if (!vf_rep_eth_dev || vf_rep_eth_dev->data->dev_started =3D=3D 0) > continue; >=20 > - ret =3D ice_dcf_vf_repr_dev_stop(vf_rep_eth_dev); > - if (!ret) > - vf_rep_eth_dev->data->dev_started =3D 0; > + (void)ice_dcf_vf_repr_dev_stop(vf_rep_eth_dev); > + } > +} > + > +void > +ice_dcf_vf_repr_close_all(struct ice_dcf_adapter *dcf_adapter) > +{ > + uint16_t vf_id; > + > + if (!dcf_adapter->repr_infos) > + return; > + > + for (vf_id =3D 0; vf_id < dcf_adapter->real_hw.num_vfs; vf_id++) { > + struct rte_eth_dev *vf_rep_eth_dev =3D > + dcf_adapter->repr_infos[vf_id].vf_rep_eth_dev; > + if (!vf_rep_eth_dev) > + continue; > + > + (void)ice_dcf_vf_repr_dev_close(vf_rep_eth_dev); > + (void)rte_eth_dev_release_port(vf_rep_eth_dev); > } > } > -- > 2.27.0