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 6206B43267; Thu, 2 Nov 2023 03:38:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02EEF402DE; Thu, 2 Nov 2023 03:38:55 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id EBF3D40284; Thu, 2 Nov 2023 03:38:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698892733; x=1730428733; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=2BtyL2MhFoBnplID20QB7TfcLTbumLhRufzUqAQaNps=; b=Ar/15NOV8H9ab2rJ6E/iRhOCDmbHOWS6lOiBybVejAOFnJaafBXSJDx2 ETl7/lua3kxLQpWHTvx/lX3OAM4QfXi34FyErVhdcyyyehxYjSl0HhMqN NSpnzpzJktNzRcAu9ZscN0v4b649Ugelvh90+T9sivgb+4pUUMS6z9yk5 ggdTx07Gr5e7VTpXNFndBu3SDIru2v5/vcsYFTaPCEQA1lxF0CPT/oipg XyL39TUtl4HLgNGdFETWDxnD5rVxkhNBDr4D1erodF9NOAMXBwKY92ig0 cwM07gjKysblVAvAhE4RbUlbbaQq/N+8P30zFNO7wyZu2I3Ik5rWDr3ja w==; X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="385800845" X-IronPort-AV: E=Sophos;i="6.03,270,1694761200"; d="scan'208";a="385800845" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 19:38:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="1092572938" X-IronPort-AV: E=Sophos;i="6.03,270,1694761200"; d="scan'208";a="1092572938" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 01 Nov 2023 19:38:51 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 19:38:51 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) 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 19:38:51 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (134.134.137.102) 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 19:38:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T0k22h50XmPG6A6yViIVIvi/zzjsVPXieJXHx/skudURxeBCTdVzFRXV7nUl9bkGtR9CaYb2lEBGLERg60UHqM6Zs6wjvgSViv8MIOkZpdgSQASh/gOyWxjM6Y6Tn1k63+CtqdC59Z85qDrU4GHMm1P2r5xPx8YTM7/3Lz90T++emDNhbOxPh8ATvX75BdweyeWhMx7La7iJIVWDOsZ7oRzYUVe4azIxGN8TboFuEnruKhlSA/7oNcOzlwITePilq3ftKoPY6zBv6J5yOw6TDkPtvoj1FyLhUXCx9CcGGWhPyxlC7NFji6X4GJALqqYRVGpNiuSfOq7CwpNCsGzFHg== 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=DyTkA+FHxCJz5FlM3FExJ/ryRa0JRPpcr9Bn3vLtwYw=; b=nDLM9PLiSO2aX8lf5gkS7zPd1Rlp9/vxH+ZdZg+cJ8brmlPXYt9vy3wdZD/B+1cVS2ndmH+hr+1lY3Mdp9/ZdUutchF60dRju0OLLxGbB7wWW291kKSWfHWSSJmoeGx42+qq/I/6QkRr6GAjdQDnpnqOhvz1d7iBxr34ZEQDXmqwVS2Kjn/dIkzwYiKLxbYP5mwDXBXKyicCmKNKhadbivrc8CPUk56rA4HDwmnrW0ETOxAXoylMmnUPZ1452ik0YVDFlv8Zl+ILHpFVUYkaeYGbAOmzL1PKk6RMWsPEsfuscQGAdloj+S5FFH4FXpGnsT8//WNsMMcN4DeQ9IV+AA== 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 SN7PR11MB7139.namprd11.prod.outlook.com (2603:10b6:806:2a2::14) by DM6PR11MB4659.namprd11.prod.outlook.com (2603:10b6:5:2a5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Thu, 2 Nov 2023 02:38:44 +0000 Received: from SN7PR11MB7139.namprd11.prod.outlook.com ([fe80::5216:6b58:10e7:9875]) by SN7PR11MB7139.namprd11.prod.outlook.com ([fe80::5216:6b58:10e7:9875%6]) with mapi id 15.20.6933.029; Thu, 2 Nov 2023 02:38:44 +0000 From: "Ye, MingjinX" 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 Thread-Topic: [PATCH v3] net/ice: fix crash on closing representor ports Thread-Index: AQHaDK2HzGJHXk3AMECE/BYc8DXQm7BlSJoAgAD375A= Date: Thu, 2 Nov 2023 02:38:43 +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: SN7PR11MB7139:EE_|DM6PR11MB4659:EE_ x-ms-office365-filtering-correlation-id: 522eef83-7100-4b10-2cf8-08dbdb4cd4f3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3lVCfmtMo4IR294Il8vcDtnutdeWDib0yKA0DlcZB4BTCmMpJ/ee/Ef8UchpXMdscoIJD8/5x/Mop0o3lKQCiGCZI01NCW8evldMj0Iq5WnG87Rg/57qZipesEXpEKGYfh3JtaQKwYR4z44SdkPwYIeYIUGnpExRcYZGg2Uh701SSy1arGSIs2vmIJbDJt79G+u32x2g58el6ypPjgCc0NoNIkU1AwaRoMdxqU4vSYuqjAXMOH8vuvgWFFAoXsm9klcw2fbD6nSZHxF7X4hWb6991v3C6Ksz3hCigVsOe7WVJuYnz7LFYRBwx3mE3KckAb+gEsP+/Wiv8SD+qz9BTVLDpnKz7KDG8ev7X4nr44rAKuVq9xmAQtrrEeldmcDISL0bdDgTjOQLXFNHBsjSovZ0Aw9ng+A3lZDL9z3hQ9I09ze5kzfHCiOS/TwopU8Q9yNhwGMrj2lzmbI94y50QDGmLfY966HMyiZPf7qRsf5pICQZ7RhUwgNIa/ikRdP7I7x8//uTpEFMCJtMsum1V+DA+kxGbiUDLhxkHgJMZVRFD1/PYHJxO5U1g4Jn/4bNgIBMz/cRFDN6fyufitleqMWz3lFADFRhDyahWPR65wfseQgtkXkTH72MSyJZx5gf x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN7PR11MB7139.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(136003)(39860400002)(366004)(346002)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(41300700001)(2906002)(5660300002)(55016003)(52536014)(450100002)(4326008)(8676002)(8936002)(7696005)(6506007)(9686003)(316002)(54906003)(66946007)(110136005)(76116006)(66446008)(64756008)(66476007)(66556008)(38070700009)(478600001)(71200400001)(33656002)(26005)(83380400001)(86362001)(38100700002)(53546011)(122000001)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pjc4tuMtWxUUyeRDIOCw+v/k7PkvBKrFKsPRJgyJU14fBkjHzobcIUeG+lkf?= =?us-ascii?Q?2U9o6Eo51js0Qbg2SGSPJ3UmElAw2+pLz0O4nf6gp5QYiW87tMu2tlIlTn0N?= =?us-ascii?Q?yLH0AAA+gbQSy8W3D/TH/J+FdqnZmCjuSdZnS+SWGDPXU/LMEnd8AMUf42Ow?= =?us-ascii?Q?mVja4GHVeL7hGEDxSal86XBYfFJOPy9LLj+qmyyziK9j7G7/uuHLiVMvrOVd?= =?us-ascii?Q?251BO2BK7D5jOm3kYvwEJgbVl43mxBRZcp8HANr9Fnrj1JCFaL6XsVoJrTCt?= =?us-ascii?Q?v1CYsR+V0zXOu1WY0H8QZzksmSaeIry3wk3n7vJ0Ohl/s5kBV8Ie1Rt9LucO?= =?us-ascii?Q?v5Fdt6+l8PTytMzWr8/BEashEMYNoe3wnLT8ewZ9i7lD6qWJi5wUL//RA8ac?= =?us-ascii?Q?mmhFY1X8ZOFDMlbQX//Yf/UFltF9/VsCMqXeRPZDIFA6AgOoNWscfxUrI1dI?= =?us-ascii?Q?/Fgls2Yfshbtj595DW6FKuddcXZiIX7xL0bkF+2HdppiX5W9nfWtC55kJSYA?= =?us-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YP52h1qD8GEVuKg?= =?us-ascii?Q?+XpStzm2R/Js/uWfVYSLKg/ez9CtvxKRPINFcUumQuTT6RR2XReZzGF3ZtmA?= =?us-ascii?Q?VGOJYzdJuoFKWynafoNBBxZDKyAXV/QYkPgF0IEjoZqvSECFY2enTMDqJf/z?= =?us-ascii?Q?kKkuUnMTeWnDbssva23spRdUgNQz/ErDsL489lfL?= 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: SN7PR11MB7139.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 522eef83-7100-4b10-2cf8-08dbdb4cd4f3 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2023 02:38:43.9321 (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: t8JrFE3dDebarIsJAsZihctDe1w2U9UBhvgy6gMkaKIkkYybZEEWhfouk5UUo3EhcenZmSS7Ickuok0QeJja7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4659 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: 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 >=20 >=20 >=20 > > -----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; >=20 > 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. The reason for the issue: Affected by 36c46e738120c381cf663c96692454c5aa75e203 commit. da9cdcd1f37220e87db23993d6352637d71df25b commit does not fix the issue. v2 patch: Notify every proxy port of DCF port status. v3 patch: Based on da9cdcd1f37220e87db23993d636352637d71df25b, made optimization to f= ix the issue.=20 > So we can't assume dcf_eth_dev->data is NULL, I think you can refine bas= ed > 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 each= 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. Based on the original scenario, notifying all agent ports of DCF state fail= ure is the simplest and most effective way. This is very similar to the v2 = patch scenario. Check each DCF port flag? If the DCF port has failed and the resource has been released. the DCF port= status, naturally, is not available. This is very similar to the v3 patch = scenario. 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= . 2. Designed to return an error when removing the proxy port directly. The p= roxy port device is managed by the control DCF (the proxy port is created b= y the DCF port and the removal work should be done by it). The above 2 options will bring a huge amount of work. It seems beyond the s= cope of this discussion.