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 28DCEA0C4D; Fri, 3 Sep 2021 05:09:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC9264013F; Fri, 3 Sep 2021 05:09:09 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id EDDB440041; Fri, 3 Sep 2021 05:09:07 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10095"; a="219012920" X-IronPort-AV: E=Sophos;i="5.85,264,1624345200"; d="scan'208";a="219012920" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2021 20:09:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,264,1624345200"; d="scan'208";a="511298107" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga001.jf.intel.com with ESMTP; 02 Sep 2021 20:09:06 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX604.amr.corp.intel.com (10.22.229.17) 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 20:09:06 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX610.amr.corp.intel.com (10.22.229.23) 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 20:09:05 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx612.amr.corp.intel.com (10.22.229.25) 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 20:09:05 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (134.134.137.103) 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 20:08:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YtXMWjPPqJVzA2v0Mj+24rU4yWSqBhZ58WaCk/Lht9zfeRRZR9/XyHR2qRBQYi72kw2D1JeRUoRfSfzjQnInoNZ27rvAjVtyb+FX20GLSlV8gSw9bi7YKcUzbXOrtshbtr3j01fIHDJG2zoLasL2TNqHtd/OV9N6HjgjhEVv3qzzKEvuYChxeSqa2/W/n6M5foYG1omM0waGWcGQmamJv0kQhkDuCjIZYjokHqZSlkg57WV0wVsDbTXXGpCDurKPW0Xm4TsIgXMRQzgYK9gD9lSrTaNVMdy0Ok7w2G7kR10vzMQ+xcfLg9W6Isz+u+ETajXWd+lrCIlQsFAeT6VV6w== 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=EIrBPy9250yoIkd7xpOeKoNkvPEAyGDe2IxK2wD854I=; b=jAXjUjl/ifM3nMY6SdsbI3ywX95Z2VCen05n4S8hNajz+XswRbK+bklfsOfTkhmITSzf6ryRphuV9MfeGwEFgWRPpdkpe07hwUiwV0HjOAt8noYz2k6scCzpru1BSOZ+zR2MWYhfW72pODTw1B0g7uOZl2CG5qzklpaEf4FklpaB+i2Lpo99N+iyLEy334EHZa8PKTEBs6rAq30J7aPBBlF1rD30lc7vZ9XigpqF1MDf4WSzXAFXWS6bn2gDz4XspnwFwfcgug/ShulHcDd/b1em0S4hBdLsn9IwWF9J5MoZBKLkgWLm7i1+iV4pC9hW4fqaKS9b3mkKxlJuHc3Cpg== 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=EIrBPy9250yoIkd7xpOeKoNkvPEAyGDe2IxK2wD854I=; b=y5JhXuXyl4xBSQzoUmFxAA/W43V2+Sr+Upjf2wr/PYA3uaa4B/rsMuA1Y48LYPS1mbWrCS5kTldv8XrGLJxvQCtWtlkrF8Tmv33e894IiiPhgJ6cycrcktDunQ6t9aYuz+3P0RQAQ7Ta27i88mCWvWJoeuIWR1UduQGHJf99hnQ= Received: from PH0PR11MB5125.namprd11.prod.outlook.com (2603:10b6:510:3e::15) by PH0PR11MB4984.namprd11.prod.outlook.com (2603:10b6:510:34::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Fri, 3 Sep 2021 03:08:50 +0000 Received: from PH0PR11MB5125.namprd11.prod.outlook.com ([fe80::7972:c119:8746:20d4]) by PH0PR11MB5125.namprd11.prod.outlook.com ([fe80::7972:c119:8746:20d4%6]) with mapi id 15.20.4478.022; Fri, 3 Sep 2021 03:08:50 +0000 From: "Yu, DapengX" To: "Wang, Haiyue" , "Yang, Qiming" , "Zhang, Qi Z" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] net/ice: fix representor port segmentation fault Thread-Index: AQHXn99HkiqjONCVzkqslo21iZq9qKuQ0o8AgADOQrA= Date: Fri, 3 Sep 2021 03:08:50 +0000 Message-ID: References: <20210902094408.1294361-1-dapengx.yu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: f1b9d36b-cd65-4cdd-6c3f-08d96e882747 x-ms-traffictypediagnostic: PH0PR11MB4984: 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:3383; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HQQgt7taXk/vMXcJEwjl9CVBpfO+5YvRaPG2GFcRsMdq+jOa30CsGd0Ck+9N0DKsTQqdtFYvXoY8i9RUW8VDkx9va8gylBuLk5vYuKYu/K9PlgIdBVdvUdVqQ+J5frRvAI3MxWMwWbIWkoiMZadeFHHx63wUA9IrfgCiB0QMcRJs4ElsMzUzrPMDdImYLPYuh5R+8AjOuZIRRGdldBju6sQfb/GoP3nmSV7IUUiUMA2/LwFY9iq5pJJMs2oq9ddMpvZDh7/wADLqVN7mTVEMyDGUcUpkSIPpSKg823W/OBMqeZ/SB7DtokhI2c/Nyx+d2sWPf+uC/0lIavqzO7D8rJNVrQ09qhXphNajoTfKtsFioEfJlGrzCj+H6N5cY1eog73LDIvUknQYdWz43SUp/06fyROIAZs5EM0krbHI9ELK+/amRZru3AfRtbG8EEGVBGfoZjdOwTmaXdfH6i6Wj7M5e4eD65Zi2M3k96ZC8x9oDHg91Y4/mDT9OLo4DcZdPhP6SIAIb1Uk+D4z0WGDW38iXxC+rYPRSwuoSTiggGZYhscX1/4MCbmRBZ/EhErnYvKFUmWfi8TdLylUWBaV9jGFgD97IdVhkoSR/VKjSFiFn6NAY/EOj055XKLxfbb3LY4neDhK2c0XUr+oW4zIcpP/4HM3qtDcJdaklrMnPnfBtrRXkLXACsrOU2Oq4NTYGkjO2/Tu1DPMXdhrc4yuGw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5125.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(39860400002)(376002)(136003)(396003)(2906002)(5660300002)(55016002)(8936002)(86362001)(38100700002)(8676002)(122000001)(38070700005)(316002)(54906003)(9686003)(450100002)(4326008)(110136005)(66556008)(64756008)(66476007)(66446008)(76116006)(52536014)(66946007)(7696005)(478600001)(6506007)(53546011)(186003)(6636002)(26005)(33656002)(83380400001)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?f/7dMAVDuUWeUqeELE61yK5r2SUtsm0WZW/zSndYrBYNHSLVBv0ox71UnAWJ?= =?us-ascii?Q?zH5u0rPUhzrB3yNtyPYnZhFNuScza9Pcp3SldLQo5p0a36auSZHh7klo6OS5?= =?us-ascii?Q?gOlV6aHrLkYrlA3r76/2BOtc6dtzcwnXyLvSzVcOQGFQ6Gi+Ydbo3cZWHZP/?= =?us-ascii?Q?Su9zIAx5WpMzEDfBH+dbLMkEl0VvB2vB2xNqQQ7r5QODYraikn3fQJ/BP15/?= =?us-ascii?Q?AOU+fSQu+rbz0ZiYaJ5ZUoEKqLLFTll7w1er9vXETGWZOoD+xWaHquWuHVP5?= =?us-ascii?Q?jKkXHo7QeYFts+S6B+CLW483+RrnyCWUBVjAYGjN7yJapdie/6mgkmQ35CxL?= =?us-ascii?Q?W0G0yEVAiUQ+3oNbdqXlezeSFMqt0A3dJyv5LNMgUTQpc2DR6Asgr02DOhvI?= =?us-ascii?Q?xHDuaKslNdyD9E36n6KnLHoQFQZticI2L/u3/s/NucpJFEri9VH0TbLEbfKH?= =?us-ascii?Q?bl9HOIeOAAu56Ny6FtpWbVO0rKHLdYvWUT+H4kVC7ZG7LRE3FJvxlyFj3QY3?= =?us-ascii?Q?HRS44Lybcwh/0t96d9vPcW9NB35q2H1BM845yMZq7zrxZsYk+lcFULRWE62Y?= =?us-ascii?Q?4JfDejYNL579yxaYw/mzDZsgjIxv1XKo05ETG+wSnwF7FMRcmdVTCMrVedcD?= =?us-ascii?Q?05DW/lNdJhs91wMlqPLRbLIyNoSuiDPRPLGGq03axb10kQ0asKM4ceMxDWfR?= =?us-ascii?Q?YOmcSNFJsXGsy1jMUV0p5wwbNe8a1/8plHEsaThKTvP7ZEs9jY4VOAXWR/UZ?= =?us-ascii?Q?ZKqxhYXHrpK5mlXo8TtW5K2miUAEahHktPdowmKrANhsjVQy45gIi7z6DZo9?= =?us-ascii?Q?3OFcfhXgpRJ/Zor81qTJ2BXLl4NJ/pY+OxxpBTAqcojEM/f4YtETGfQyA5og?= =?us-ascii?Q?3sLL1HgmgahmmuXhyMdud9mnNFWqmu0bX6fhODJ+6vEW+LhrTkA9khhD0/05?= =?us-ascii?Q?SKJmzIe3RidoJAD6WuVC123oOw1XIMKUFUkC/+4M0IEv2oyCSQj+V91fo+aC?= =?us-ascii?Q?PKYHkUE+wq8JUc21KYkQ2hfBl7VEi4wNEXBperwzm/MfddmXzFUOMRr1geGq?= =?us-ascii?Q?5kHGdD5o+ueDNNQSZxHbdWdf9AEpSHqmuGWZe3IA8G3ICVvrp/oXujdP/dZ9?= =?us-ascii?Q?etVvuGzUUKoJ/zjkt07svHqtz4EFZrkWKjigIOJ/ma96Ymdmm6y5EDnyhyiM?= =?us-ascii?Q?IbveGO0hcetHsUYo1AxN1uulzmwuTkqq0Cq/KXiAs4oNC+Qz8LGVBF7/ye6Z?= =?us-ascii?Q?Efkit9BhUucuzwxg2r8s21RtGDqjrxc0JuOsBpPK+2KpmL6+tvtH9sBUFph3?= =?us-ascii?Q?6Tg=3D?= 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: PH0PR11MB5125.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1b9d36b-cd65-4cdd-6c3f-08d96e882747 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2021 03:08:50.1652 (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: zEFxmCVLEVAnWsDWpmRdA16DaorQ8//TmKKRAl7p9ykDk8mUUJMPnkw++5GIFr8kVFAO5LWq7BGlIsJ8KHBHjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4984 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: Wang, Haiyue > Sent: Thursday, September 2, 2021 10:45 PM > To: Yu, DapengX ; Yang, Qiming > ; Zhang, Qi Z > Cc: dev@dpdk.org; stable@dpdk.org > Subject: RE: [PATCH] net/ice: fix representor port segmentation fault >=20 > > -----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 > > > > From: Dapeng Yu > > > > 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. > > > > This patch makes DCF representor port is always closed before DCF port > > is closed. > > > > Fixes: 5674465a32c8 ("net/ice: add DCF VLAN handling") > > Cc: stable@dpdk.org > > > > 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(-) > > > > diff --git a/drivers/net/ice/ice_dcf_ethdev.c > > b/drivers/net/ice/ice_dcf_ethdev.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; > > > > + 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_ethdev.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); > > > > #endif /* _ICE_DCF_ETHDEV_H_ */ > > diff --git a/drivers/net/ice/ice_dcf_vf_representor.c > > b/drivers/net/ice/ice_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; > > > > 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); >=20 > Do we truly need the "(void)" ? Here use (void) to make discarding of return value explicit. There will be no compiler(clang, icc, and gcc) warning even if remove (void= ) So it is fine without that. >=20 > > return ice_dcf_vf_repr_uninit(dev); > > } > > > > @@ -464,7 +466,6 @@ void > > ice_dcf_vf_repr_stop_all(struct ice_dcf_adapter *dcf_adapter) { > > uint16_t vf_id; > > - int ret; > > > > 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; > > > > - 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