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 98B4A43268; Thu, 2 Nov 2023 04:59:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E22B9402E5; Thu, 2 Nov 2023 04:59:40 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 53A16402C6; Thu, 2 Nov 2023 04:59:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698897578; x=1730433578; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=o/1LSy2zSuTth38P1kIMORzuJ8L/VllmRxL7LbjbaY0=; b=C7XFLa/9xH3rOs+AyoaIktEL2RC458BUSsa75RXduc3AmrZAqt6YA7Fh OBUKD0MceWNkGi8NbjozRuOc5MNVgcdKSEUNQOEV62WvwcQojm1gggfHM VYqF/NkcdlbzWNzeKCW6nW3yWpMYlTVx/u8JTgQwlbOCr79gX19Of6GnX Aq9U3uflIxMxCbkJ1/n7U86l3CqnlTFxY3AM4YOFG8Y7dXMesIAEckPPD yr7haxKdgrvZHEE44vovmZNgw14TH43XDfvke84ySRqIVPG62eGqj8bM5 QLYfJJKkj3LXIEa0jobQEs0hBFdIdhaO1N3kMQmAivWCS6mx4eQI610oR g==; X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="455112581" X-IronPort-AV: E=Sophos;i="6.03,270,1694761200"; d="scan'208";a="455112581" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 20:59:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="831558388" X-IronPort-AV: E=Sophos;i="6.03,270,1694761200"; d="scan'208";a="831558388" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 01 Nov 2023 20:59:34 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.34; Wed, 1 Nov 2023 20:59:34 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Wed, 1 Nov 2023 20:59:34 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Wed, 1 Nov 2023 20:59:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n6f/QzM0Ehpnsk7+3/8Z96flsSQCKMIafDMl2ZoHI1ojDywkAzFEtWpbdpjGxNMXxV2SuYRV/7cuxtrnzoiKvF8yAB7tcsFzLEpwcITbdIvH56S4gBZJPrfkQudaBGmnv6yqfmFqWdJ5+AVpKDoUC6tD8A7J9YtgOa6yJSMMQvS7KjQpwffqzPNWRgmlm5fSX4Zl/uq+a25ZdC5k17dA4ZifD0hgLfG93d66f31MO48oe+NFFzSgU4lniDDRRV5pcTbvOPbiC0QvlYlUS7E96DQjTlfdaMl/myliHkWAGFeBN6E6paGFsJi9rUYE29Cxoc6krp7z78LxmTktetx5DQ== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gztD7csqyCbjzSEkaMXSiXeaxjbM6VDF/JHEaSVXZek=; b=kw1kdbM0eAzLZskMvT3kC9reI4ua5k2rBFQoZqTTy5CjKKgvsMPeDKLwfWc5VuBaTgJeSILHytwdopCmyrevoNDdkWJA0/tacackZVG1p2YKoAC29yo4dZ7zDY94yh4AOyJtFzQr177voiVK0v5SAphbeT+67EYDgvwBdP1pgf7MKQ1b9yR/dqNJYjLhopi4GBpHm45ijaUwtC9M+BONOmfnUPgzlynHXQO/876fr2msCyPSVxrspGV5kTqn5hwBGviESpskrDwYLONCmOGIuXv6lNe7Wog4BgvXRZBTxulVV7c2ajHKb1V9NHkiUomh0KLc8MoxyouzXzEaNboTIQ== 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 Received: from DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by SJ1PR11MB6132.namprd11.prod.outlook.com (2603:10b6:a03:45d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Thu, 2 Nov 2023 03:59:22 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::fccd:acb8:20c7:e756]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::fccd:acb8:20c7:e756%4]) with mapi id 15.20.6954.019; Thu, 2 Nov 2023 03:59:22 +0000 From: "Zhang, Qi Z" To: "Ye, MingjinX" , "dev@dpdk.org" CC: "Yang, Qiming" , "Zhou, YidingX" , "stable@dpdk.org" Subject: RE: [PATCH v3] net/ice: fix crash on closing representor ports Thread-Topic: [PATCH v3] net/ice: fix crash on closing representor ports Thread-Index: AQHaDK2H1trH7Yv6FU6MuR8ogk3T57BlRIuQgAENfYCAABR3kA== Date: Thu, 2 Nov 2023 03:59:21 +0000 Message-ID: References: <20231030084459.3470038-1-mingjinx.ye@intel.com> <20231101101347.3570418-1-mingjinx.ye@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB5994:EE_|SJ1PR11MB6132:EE_ x-ms-office365-filtering-correlation-id: aa68e2bb-c338-49b5-102d-08dbdb5818bb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6AgXVQI6uCczcELqncm3QHmJoG9rVud9Ft3NdVETrmlLkjZOhBbhacNCX/YB1Fh5jX92r+t1CdK4YOWMLrsftKsWbXGBbyuNMMIUWZMPJo5mTF9t1G1saufCs1BIGJXmlJzZXyI7cHuUXply8vEzdSuBPyzl1/6HB6nPa/x+FVEIbANF2NSLOeaKy1ovNUStVfscATjA1xhJln/FoWEbPh3/nX3Je3JC2k1gK+MVJA+ouPMa6433d73S2/KtgS4hVmoeBoVeKzDLd6Cg/LXI8drZYwV1MW29jTrkV0phl9aJL7ZseS/BbYUSMTwHqjTq89lD69RBi1FqQ8sY6J788InTrhjjQhAxBuIIQeKarV6F7zQBvvkbzaf/8Yv2jedBZxcRQAFxKuD/gjJ2gV4Zi3p2URrsIolWMxKYZ9U29j0LUczwGVs3gQNG/NDaZ7F3Jtmepn09aFIJ3AMgiX1lZYNdTJ6+r2/hmXOBugtKW0UdO3y79jUjgFkVcJ0CEMa1+TXCkFKoeHtNj4WuVjGxMW7LYE/vOW22UMI/by8qM1ySvilm88ktaryX0PJcrQpIaSkTkTxeIj0pncri6/U3WPVCTfI8HX0ATd/yXdRZ+sgRukUDDiyFLbamKeV4S34q x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(396003)(346002)(376002)(366004)(39860400002)(230922051799003)(1800799009)(64100799003)(186009)(451199024)(83380400001)(33656002)(26005)(53546011)(6506007)(7696005)(9686003)(71200400001)(66476007)(478600001)(38070700009)(450100002)(66446008)(66556008)(76116006)(54906003)(66946007)(110136005)(316002)(64756008)(86362001)(4326008)(52536014)(38100700002)(122000001)(5660300002)(82960400001)(55016003)(41300700001)(8676002)(2906002)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MMEfEokvYVFzvqeiCnv42DuTQ7sVcN534GbE99963eHVwKF0yPoH1VJo0pMx?= =?us-ascii?Q?0E8KvuGYpKGn4I8xJg4U0tT0d+ct8Bp+ft6z/dljCbBDzCwOpcEZPlE6RPLX?= =?us-ascii?Q?tPU40H+BCvqwkVlLPIXWVxBEzwkYfnxMl9qaJuZ/XwmQxq2a3X2+W422v6oT?= =?us-ascii?Q?Y46BnmWCRF6cwni2Aiax5JAmsY6lwsaNvRtS9oJtG0UJY7Nrk2gPmNhNaygk?= =?us-ascii?Q?Tz14jVn8h/JzPUBlNHHp6rKqweE1Bn3+NJAKdkfTpTHPVTeCw7ay0PdmbFqO?= =?us-ascii?Q?kFaHa8EOAUtXjGYIbSrZEw169Jn1kM1HVzxw1BG3Yz55WHoSiKjyTqU/afu2?= =?us-ascii?Q?0lxK0GOkCD4H18w9GhcToGINqrlAEHlCWUoWAhK7d/OFjuMab/H2I7aUEwsq?= =?us-ascii?Q?+ux/xRJ9K5H9yosxjnxhq4lMe3kRh6ulOE4+zLB/8jJOLSneAUDXzhjg/SnF?= =?us-ascii?Q?BH6GE3BaXf8PuZl0EBYBNwds8Sz/6ZMvNVavX/2rvqSUiC/BOVix7QjKd6sA?= =?us-ascii?Q?wPtZm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PpJsd2+WN?= =?us-ascii?Q?pJpZf0MnPX7zkqaQU8TlLGaCySiQU55qv2D+fhFdPVR7b3MfKyVwhQO62Y14?= =?us-ascii?Q?k2e4XdBZ+WwP5ELNoxKQxXSuceehxQzTIhI96k79GXb9H+4xXW+zUw6WY7AS?= =?us-ascii?Q?ZgL8lxu+67ffXC+S4ajUa83ZQZJ9RSsbXMBbtcxx?= 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: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa68e2bb-c338-49b5-102d-08dbdb5818bb X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2023 03:59:22.1051 (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: Z8cVvHq/VWLfmKk43wWGALsYytyLjAGBJMYjuyErMf7MTQRu/ARlV+WVjL0SP/6dmpy3oHB1ZRBw4tDmdg2Gmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR11MB6132 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Ye, MingjinX > Sent: Thursday, November 2, 2023 10:39 AM > To: Zhang, Qi Z ; dev@dpdk.org > Cc: Yang, Qiming ; Zhou, YidingX > ; stable@dpdk.org > Subject: RE: [PATCH v3] net/ice: fix crash on closing representor ports >=20 >=20 >=20 > > -----Original Message----- > > From: Zhang, Qi Z > > Sent: Wednesday, November 1, 2023 6:49 PM > > To: Ye, MingjinX ; dev@dpdk.org > > Cc: Yang, Qiming ; Zhou, YidingX > > ; stable@dpdk.org > > Subject: RE: [PATCH v3] net/ice: fix crash on closing representor > > ports > > > > > > > > > -----Original Message----- > > > From: Ye, MingjinX > > > Sent: Wednesday, November 1, 2023 6:14 PM > > > To: dev@dpdk.org > > > Cc: Yang, Qiming ; Zhou, YidingX > > > ; Ye, MingjinX ; > > > stable@dpdk.org; Zhang, Qi Z > > > Subject: [PATCH v3] net/ice: fix crash on closing representor ports > > > > > > The data resource in struct rte_eth_dev is cleared and points to > > > NULL when the DCF port is closed. > > > > > > If the DCF representor port is closed after the DCF port is closed, > > > a segmentation fault occurs because the representor port accesses > > > the data resource released by the DCF port. > > > > > > This patch checks if the resource is present before accessing. > > > > > > Fixes: 5674465a32c8 ("net/ice: add DCF VLAN handling") > > > Fixes: da9cdcd1f372 ("net/ice: fix crash on representor port > > > closing") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Mingjin Ye > > > --- > > > v3: New solution. > > > --- > > > drivers/net/ice/ice_dcf_vf_representor.c | 8 +++++--- > > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/net/ice/ice_dcf_vf_representor.c > > > b/drivers/net/ice/ice_dcf_vf_representor.c > > > index b9fcfc80ad..8c45e28f02 100644 > > > --- a/drivers/net/ice/ice_dcf_vf_representor.c > > > +++ b/drivers/net/ice/ice_dcf_vf_representor.c > > > @@ -111,14 +111,16 @@ ice_dcf_vf_repr_link_update(__rte_unused > > struct > > > rte_eth_dev *ethdev, static __rte_always_inline struct ice_dcf_hw * > > > ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr) { > > > - struct ice_dcf_adapter *dcf_adapter =3D > > > - repr->dcf_eth_dev->data->dev_private; > > > + struct rte_eth_dev_data *dcf_data =3D repr->dcf_eth_dev->data; > > > > Seems this expose another issue, if dcf port already be closed, the > > dcf_eth_dev instance could already be reused by another driver. > Your analysis is spot on. >=20 > The reason for the issue: > Affected by 36c46e738120c381cf663c96692454c5aa75e203 commit. > da9cdcd1f37220e87db23993d6352637d71df25b commit does not fix the > issue. >=20 > v2 patch: > Notify every proxy port of DCF port status. >=20 > v3 patch: > Based on da9cdcd1f37220e87db23993d636352637d71df25b, made > optimization to fix the issue. >=20 > > So we can't assume dcf_eth_dev->data is NULL, I think you can refine > > based on v2's method, but don't update dcf_valid flag in representor > > port's dev_stop. > Implementation difficulties: > 1. When the DCF is created, all associated proxy ports are created and ea= ch > proxy port (struct rte_eth_dev) pointer is recorded in an array. > 2. When shutting down the DCF, all all proxy ports are notified at > ice_dcf_vf_repr_stop_all. Finally the array is deleted. >=20 > Based on the original scenario, notifying all agent ports of DCF state fa= ilure is > the simplest and most effective way. This is very similar to the v2 patch > scenario. Yes, that's why I suggest to refine based on v2 after notice the issue on v= 3, seems we need to maintain a per repr flag for DCF status, but need to up= date it carefully. >=20 > Check each DCF port flag? > If the DCF port has failed and the resource has been released. the DCF po= rt > status, naturally, is not available. This is very similar to the v3 patch= scenario. Check dev->data is NULL does not work, a better way is to check eth_dev->st= ate and device name to make sure it is still used by DCF. But I think v2's method is more reliable. >=20 > Other ideas > 1. Re-implement DCF port and proxy port communication, can't directly use > (struct rte_eth_dev) pointer to access the device resources on the other = end. >=20 > 2. Designed to return an error when removing the proxy port directly. The > proxy port device is managed by the control DCF (the proxy port is create= d by > the DCF port and the removal work should be done by it). >=20 > The above 2 options will bring a huge amount of work. It seems beyond the > scope of this discussion. >=20