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 E6B8A41E9F; Wed, 15 Mar 2023 14:06:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42077427F2; Wed, 15 Mar 2023 14:06:47 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 36D8340141; Wed, 15 Mar 2023 14:06:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678885605; x=1710421605; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=TdFeFne3XnOc3jdXiNS1DOLFKTWkQK9HDZdl7f5+NJQ=; b=RtHwvLtBbCOmQSYG1Jh7b2/JWZpO7T8rqq1gYdL93oElfN1JxTlAPh4t M7Wqt7IXLL/DUnz6lxxtDnxt8L3trQ3XdOyJrDQrlooZMU9O68/SFsdwj 5+8ZB+gT99xApg+pYfOiElUZl+ojyjaIhb5V/N8vZBywR1N/OMwBhs2Y6 GufKL1kWxsBkK02VLhAr4uSim2WGw0FvqybWjdNgdU58hfsfgZpBT3Ivy udGGgDqpEWoxR7IzCWVrAhycPGR7oMlNAwGqUwHyxhIkX8m/orAK5tG46 6EOdmVfL2n/IAQhUha6ehmiE+0e2zOiGoZeNFJ1mnlM6u05SFRlOKfDaB g==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340056775" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340056775" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 06:06:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="709678268" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="709678268" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga008.jf.intel.com with ESMTP; 15 Mar 2023 06:06:44 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.21; Wed, 15 Mar 2023 06:06:43 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.2507.21 via Frontend Transport; Wed, 15 Mar 2023 06:06:43 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.105) 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.21; Wed, 15 Mar 2023 06:06:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Po9UHMihWvC1r7mHqbo3lxIIo++hpFvbx3UW8kjLkji/8caKAxjDyDHlAvMP+HRA8pg6mM8KJoJJ+1j2yr/LolSBjttPLsEPQFupOgOqOe6SOk7VpFRDkzglYotk6yi7jIaaYSTmCIT/fyPwcZ2WV2sVaEEcyS8+R8An3wMDy3IJhPZrRlCHAFttzIFLQGs3t2QK/IE0Ibok02B2QdISN0iPwBGHdUAHstByxVpEqd2oVQosHSfhsP4i7Oh40RslsWy1X3jO9jAhrNUi0FYOK3E94W+sZHRICWQrzCFeR6TwJGZ7pwk7nRURS4rCbvR7HtaXNq13j7WobcCp4WzKGg== 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=HvI4MQw6TbksuynPJAjxeLIW/3kHoSUiUVinxj1cmCk=; b=LrIJ4OEJlHlhiA3DaWRowTUCfFcTC7O7bioFNOyas38HySIsZuuQifTbbcS8X0YS7OYjIkhrLBiPrIOLKYZGpHXX3KRURMHAD3sU7qOA7NM8hQB86DtVD1qtbkrP2URLvAn6wSmkE+J0YE0in4gHheeIq4U68DfQTX2HDbtSlIsEAjGI7aUnvBsgOWceaTiemwZFO9LlJ/TDIPri6pL4eHAH5KtoBhf0oDcBo9ND7rMvO/tPjvQmTK6V0djisAnJvnA47kzRffswfevfnv4G3HgkAgF6sEaumiws3A5cfcFvaPyARTSH7axMHg1a1TduefEKVih2koQi93hp7cPZvw== 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 PH7PR11MB6955.namprd11.prod.outlook.com (2603:10b6:510:206::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Wed, 15 Mar 2023 13:06:41 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::2c5d:49cd:a9b4:f764]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::2c5d:49cd:a9b4:f764%8]) with mapi id 15.20.6178.029; Wed, 15 Mar 2023 13:06:40 +0000 From: "Zhang, Qi Z" To: "Ye, MingjinX" , "dev@dpdk.org" CC: "Yang, Qiming" , "stable@dpdk.org" , "Zhou, YidingX" , "Zhang, Ke1X" Subject: RE: [PATCH v3] net/ice: fix ice dcf control thread crash Thread-Topic: [PATCH v3] net/ice: fix ice dcf control thread crash Thread-Index: AQHZVxewsRCoCvkBzkanN2443LO0N677zxrw Date: Wed, 15 Mar 2023 13:06:40 +0000 Message-ID: References: <20230213071648.326123-1-ke1x.zhang@intel.com> <20230315082018.4260-1-mingjinx.ye@intel.com> In-Reply-To: <20230315082018.4260-1-mingjinx.ye@intel.com> 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_|PH7PR11MB6955:EE_ x-ms-office365-filtering-correlation-id: 63702479-8546-4ca2-f7f0-08db25561e0f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LGP68aXXd515ECHsHuZnkYxXZsPQgXyii/ZXhrlr56BSWnggU2vMw38irz5gmO9ldcVVBk/qPDy8fsy03U/Bsx0Hxy7+nmexcZ7oGCCgo2yBnZMY1re4liIslyqkQXKWchYYYbQ3UOPGZ2Y0J92D2avZ4MdVVmzbop7EdqO6Q468qobjoKMoT+3ckRq6ShK5f4YIAHLLFZRzI42kRhOMuM442xt3XqzX6TFvSw2MkbaJb0upSE30KDxcl7ut4iTbEz1wVX8Jz7dwEWDWDtH/sn6n+gf99tx5QNU9Vt/kcMjqaoeLLuC0JBN+2M+rRwC3jDF1WropUZu8V7xBWNUu4JPJ6+uE+QuSifbMSBBTxcpf9fjiNH1glaz3e2wEk9bMIoPZx/OwlBiAYUM7QdZSvqi++jZCa84cVKEPmHLejOUSMHiufkzSDOKNjAbi9xICAFO9gePJYLBD7aaLUbevl+QEyZ3K7IMz+Mdla5mbKtquFW+W+O0um4l+C5g87qlGBQza/L2rYstnkHl1l221T4P1OnO63okHAQcxkLcIPmrAvENLmrq3cVSLuFw4GKVUcWq/dBALlwI+Dn0RyQ7xQHy8iw5LLKl78b+ES5HvQDEt44UzgmIkxzekwN1LHmA6PXrwjoVxhi31szcA9VwvKarKnmQwuVNzHuNZlUDUB1Bm/P+1sxv0hEcEkXLOx+JJm8+bgIgL2FRh7Ahek3LV+A== 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:(13230025)(39860400002)(366004)(346002)(376002)(136003)(396003)(451199018)(8936002)(9686003)(52536014)(53546011)(186003)(5660300002)(41300700001)(4326008)(26005)(33656002)(86362001)(6506007)(64756008)(2906002)(83380400001)(66556008)(8676002)(450100002)(76116006)(7696005)(54906003)(316002)(478600001)(38070700005)(66476007)(71200400001)(66446008)(55016003)(38100700002)(122000001)(66946007)(110136005)(107886003)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BLjbH5HtYfL6NHbvc9CMcXz9Pj5jBGb0wyiczqGYhOx2/sgfqPLUQFF/Trn3?= =?us-ascii?Q?mFXdcCF/rUfDtICWSHR6EP53+d55xD1jnnK4sU5k5t14rl0DEcroekI5KO8p?= =?us-ascii?Q?uDgAOJasR1LY1cbDC7yUvy4AStPFWS6mNeNLZEu0Dqi0bRRmzr8G4s1xS1Ve?= =?us-ascii?Q?no/oFcIszrxG2rVqNyBoa1T4yAbneX6Jg/FSwWeG3fSVFxktlaY7hs4kqb92?= =?us-ascii?Q?J+IEPCO8AphbOVheIjRH2vuc5/OmP/We/edl6zcY/ZCGJbMwbBD4GCTg+DDC?= =?us-ascii?Q?Xc47dCUtplPeD1oLfQJsLh3KgvE0fwq1hZeiqe2bdsR4cgQ29jmEcxAbPk+c?= =?us-ascii?Q?w3wCiS3RqjIHZbBU29FqSp+pD/QqtHdIPQfhG2qILG1Zj3o7UePadbbK20X0?= =?us-ascii?Q?obS031Cdr7JQZS72S+J68AA6gFhMgnaCWSl1xcXlP9QfwDdgYEtKp8t6GTe4?= =?us-ascii?Q?3d2Y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Jc2SiODu9q/EPx?= =?us-ascii?Q?LfPga3SpJE2rbuLcFqxCKk1XpT4/JfKu6mGYfr/ZxJj3dIEHKpioINwaF51g?= =?us-ascii?Q?B1dyxswYWGODjGKTWOmWjL5SnjwDN5lS8upjfWDXYvcXR1gRYnaO/rwTXmhM?= =?us-ascii?Q?FrCQGMqR6CZa4ZNjMbLuEQUplcZNB4MBdhK98cRCS7GMDY43meQu+exm4wYk?= =?us-ascii?Q?6IY4VkT3sEXIjerTotWu2+cdovJ+IwkAT3+S7wfE?= 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: 63702479-8546-4ca2-f7f0-08db25561e0f X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2023 13:06:40.4679 (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: jEjl1DnF9vM8t2SO23Rvwv6+EVqoHTyi6bMbW2sVtvSNplgdjNMVj8C9oIilHBwQaW55W4OJIytnckz9Vv5t6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6955 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: Wednesday, March 15, 2023 4:20 PM > To: dev@dpdk.org > Cc: Yang, Qiming ; stable@dpdk.org; Zhou, YidingX > ; Ye, MingjinX ; Zhang, > Ke1X ; Zhang, Qi Z > Subject: [PATCH v3] net/ice: fix ice dcf control thread crash >=20 > The control thread accesses the hardware resources after the resources we= re > released, resulting in a segment error. >=20 > This commit fixes the issue by waiting for all `ice-reset` threads to fin= ish > before reclaiming resources. Please explain how the patch implemented this, I didn't see the code that w= aiting for other thread ready, like "pthread_join" call Please try to add more comments in your code for easy review. >=20 > Fixes: b71573ec2fc2 ("net/ice: retry getting VF VSI map after failure") > Fixes: 7564d5509611 ("net/ice: add DCF hardware initialization") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ke Zhang > Signed-off-by: Mingjin Ye > --- > v2: add pthread_exit() for windows > --- > V3: Optimization. It is unsafe for a thread to forcibly exit, which will = cause > the spin lock to not be released correctly > --- > drivers/net/ice/ice_dcf.c | 15 +++++++++++++-- > drivers/net/ice/ice_dcf.h | 2 ++ > drivers/net/ice/ice_dcf_parent.c | 1 - > 3 files changed, 15 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index > 1c3d22ae0f..b3dea779aa 100644 > --- a/drivers/net/ice/ice_dcf.c > +++ b/drivers/net/ice/ice_dcf.c > @@ -543,6 +543,8 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw > *hw) > ice_dcf_disable_irq0(hw); >=20 > for (;;) { > + if (hw->vc_event_msg_cb =3D=3D NULL) > + break; > if (ice_dcf_get_vf_resource(hw) =3D=3D 0 && > ice_dcf_get_vf_vsi_map(hw) >=3D 0) { > err =3D 0; > @@ -555,8 +557,10 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw > *hw) > rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); > } >=20 > - rte_intr_enable(pci_dev->intr_handle); > - ice_dcf_enable_irq0(hw); > + if (hw->vc_event_msg_cb !=3D NULL) { > + rte_intr_enable(pci_dev->intr_handle); > + ice_dcf_enable_irq0(hw); > + } >=20 > rte_spinlock_unlock(&hw->vc_cmd_send_lock); >=20 > @@ -749,6 +753,8 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, > struct ice_dcf_hw *hw) > struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); > struct rte_intr_handle *intr_handle =3D pci_dev->intr_handle; >=20 > + hw->vc_event_msg_cb =3D NULL; > + > if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS) > if (hw->tm_conf.committed) { > ice_dcf_clear_bw(hw); > @@ -760,6 +766,9 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, > struct ice_dcf_hw *hw) > rte_intr_callback_unregister(intr_handle, > ice_dcf_dev_interrupt_handler, hw); >=20 > + rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL); > + rte_spinlock_lock(&hw->vc_cmd_send_lock); > + > ice_dcf_mode_disable(hw); > iavf_shutdown_adminq(&hw->avf); >=20 > @@ -783,6 +792,8 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, > struct ice_dcf_hw *hw) >=20 > rte_free(hw->ets_config); > hw->ets_config =3D NULL; > + > + rte_spinlock_unlock(&hw->vc_cmd_send_lock); > } >=20 > int > diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index > 7f42ebabe9..f9465f60a6 100644 > --- a/drivers/net/ice/ice_dcf.h > +++ b/drivers/net/ice/ice_dcf.h > @@ -15,6 +15,8 @@ > #include "base/ice_type.h" > #include "ice_logs.h" >=20 > +#define ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL 100000 /* us */ > + > /* ICE_DCF_DEV_PRIVATE_TO */ > #define ICE_DCF_DEV_PRIVATE_TO_ADAPTER(adapter) \ > ((struct ice_dcf_adapter *)adapter) > diff --git a/drivers/net/ice/ice_dcf_parent.c > b/drivers/net/ice/ice_dcf_parent.c > index 01e390ddda..d1b227c431 100644 > --- a/drivers/net/ice/ice_dcf_parent.c > +++ b/drivers/net/ice/ice_dcf_parent.c > @@ -12,7 +12,6 @@ > #include "ice_dcf_ethdev.h" > #include "ice_generic_flow.h" >=20 > -#define ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL 100000 /* us */ > static rte_spinlock_t vsi_update_lock =3D RTE_SPINLOCK_INITIALIZER; >=20 > struct ice_dcf_reset_event_param { > -- > 2.25.1