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 7624142D46 for ; Sun, 25 Jun 2023 08:46:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70CD641143; Sun, 25 Jun 2023 08:46:04 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2079.outbound.protection.outlook.com [40.107.100.79]) by mails.dpdk.org (Postfix) with ESMTP id A04DE410ED for ; Sun, 25 Jun 2023 08:46:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DKH81K6IugveBrCL8hPkrEzHj1H+9WYT/blzagS9T5vQW2psSkvuV3Wp9RuCQ18Z+Sk28PaPCokhWAGRoZ2nxV4/QRc8/U1GBV7BPsr8EUJAgsEaXtTQv5gPpJgfLqqFxr+WLMteg7SrXyC3k+BUuJwNoE+hGMiq/U7nst7qOBOqw1HNTXeWcJ2nqBc0vM4wvgInCLPatS2OvKRtV8nIbF/VEs2Ucd1aoK+lEuvoi8jhAYMsbvZlIMBYaEyLNkG+392HRbEXmDcIlqGyh/iQf95qkeAwPYdEHXe7qQ462kFMorcM+f6hIyFZenjTGE2P1JgB5oUHnSyHD8Kj7F9mDQ== 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=CVmob74dvXJ22MtaS1s7QP0gE4DJTHygVAZHxEUHXU0=; b=cgRec1e9sPv15/TcV+/ZSWwhv6eQW0uSdceh/L5+RPwKFCgGyEsqO+T2yQtcGCXq4oL0l0fzFeGR3SRE/kdLE9imWm2otXogE2GfZhK9nhcjazwP15gLHZ4MPlDj0PvOT/CPAmKWoujvRZMOqIhYcterUilYLmi3DtqvFawdSiZw7/ZVV/tKylrKImBPjSCxu+o9FL+lrdHimoDpS49pXKHvLaNhqo49ZXgOgJS14QudaqsyMMOddjhUqsQvVv5bjE6YA1RMnJGGVO03y5GDNsT+C15n1EnD44YEAqt9Q9FnJPk+P3bMtXv+HxXhyofi0K+SWr9YxstO2Xf27hT3EA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CVmob74dvXJ22MtaS1s7QP0gE4DJTHygVAZHxEUHXU0=; b=Kp7QE+UPkGgCGk6+CEinXqTAuCO251w/kg9psPTW+6d1RKsIH6iHiOuhBUTtAVNasDfVssjY337oGeQ4emkcS+k0S6kTL9v53QE6wZnXhMpiH31MBulT2FCY3WAQPqWwApsfP78w7vwGXDWd5vDsJI24W2Ex7MTekxmdveirSZUVksMwwFmBOJY0k/f/rj1roLEAqPx0Ow88zrNbxeSGzHdRt4JsngbZZg04QiwqpkROMpyhDSjdCZhguc5geDJu8DUK/b1AdYB3dmbq9WS/UI/Gc/4w00LVOKubdtlEn5K6KHyi4jS28jG5ELQRm5uduXQW2fWwDmTIIDd7GKo5zg== Received: from DM6PR11CA0022.namprd11.prod.outlook.com (2603:10b6:5:190::35) by MW4PR12MB6732.namprd12.prod.outlook.com (2603:10b6:303:1ea::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Sun, 25 Jun 2023 06:46:01 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::84) by DM6PR11CA0022.outlook.office365.com (2603:10b6:5:190::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.32 via Frontend Transport; Sun, 25 Jun 2023 06:46:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.47 via Frontend Transport; Sun, 25 Jun 2023 06:46:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sat, 24 Jun 2023 23:45:54 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sat, 24 Jun 2023 23:45:52 -0700 From: Xueming Li To: Mingjin Ye CC: Ke Zhang , Qi Zhang , "dpdk stable" Subject: patch 'net/ice: fix DCF control thread crash' has been queued to stable release 22.11.3 Date: Sun, 25 Jun 2023 14:35:33 +0800 Message-ID: <20230625063544.11183-116-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230625063544.11183-1-xuemingl@nvidia.com> References: <20230625063544.11183-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|MW4PR12MB6732:EE_ X-MS-Office365-Filtering-Correlation-Id: 004015c9-69ab-4be6-2613-08db7547d6c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eSBzj/DRl978qXgsXAoiOIvkG3YDReAfzcJp2YM54W2/WCeu3hmcJ5eG65eKRkN9AKg+607+4XGFR9nhjWyVYlu5j6APi0OVpBI5rLGp6FLeU2z7TXqxtZVsfSbqBDNGfYKG/6rgWrjlifELg7jIiZn8FXfqLiN9vL3P0WniOvPIxg43BjICs3Z3LiuEKQ8sp4oridCIIxGbCWBNW0ehqLxfLSaVr4e1HroYTreE/LdHWAGDUJMp/ESNotQKS2gFlYSDH4IGKCNYbu3nrm1nMiiy3r0Y+7jKqmlZNyVVxmljWKEY14pMP0uXOrTiXVXpFAqBZqsLa5aRSYc87t/mzdKhew1b7z0ISJUTOkhvnSzaRoWw5Q6IDihu3/Va7eGCVUaIkwITA1NZpxmqwFZtxHAXCmfc31pTytDy0fzC9Hzfxqjp66dN1IqLIIX10Qg673rOyRBnqopNN7RHTKeb0V1uEXvZJWE1KlnUciJlv1icsBMG5oVpQiVYcMH+v/0UdGC8PFdKepokOpxFWUUnHBG4z0HTC58Bc+RlTnYfKQgTiu434xuGq4J2hqeL/cqcpcJCfzmDaFa+fJTblJ/irdKt7j1BtVQ4vIcWsmb1X+vznHN9PvRcZhMUX/oW7SafyaYtKFGu5drGJ1klnx9D7qKx28msQUX/cRMgY8jmAVykpPbDIqVzWv5VJbMRKKilUd2vu7NyScXDrw6pPTUc6lDaHN6frkOnOHh0ZrjC7W8Y+QtbIVnj+MtU/Ny+SODDC3AhaISxYDseJMwnPhrOKg== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(36860700001)(82310400005)(47076005)(966005)(478600001)(7696005)(6666004)(2616005)(54906003)(426003)(83380400001)(336012)(26005)(53546011)(1076003)(186003)(16526019)(6286002)(2906002)(5660300002)(40460700003)(36756003)(70206006)(356005)(4326008)(7636003)(70586007)(82740400003)(55016003)(40480700001)(316002)(86362001)(8936002)(8676002)(41300700001)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2023 06:46:00.7604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 004015c9-69ab-4be6-2613-08db7547d6c1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6732 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=4ec6da600e9573cf5f24ebc6c36cb36f4e30325a Thanks. Xueming Li --- >From 4ec6da600e9573cf5f24ebc6c36cb36f4e30325a Mon Sep 17 00:00:00 2001 From: Mingjin Ye Date: Tue, 11 Apr 2023 02:08:55 +0000 Subject: [PATCH] net/ice: fix DCF control thread crash Cc: Xueming Li [ upstream commit 6b7621cea2d9470df076c3559a2fa6ee9752f419 ] The control thread accesses the hardware resources after the resources were released, which results in a segment error. The 'ice-reset' threads are detached, so thread resources cannot be reclaimed by `pthread_join` calls. This commit synchronizes the number of "ice-reset" threads by adding a variable ("vsi_update_thread_num") to the "struct ice_dcf_hw" and performing an atomic operation on this variable. When releasing HW resources, we wait for the number of "ice-reset" threads to be reduced to 0 before releasing the resources. Fixes: c7e1a1a3bfeb ("net/ice: refactor DCF VLAN handling") Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF") Fixes: 7564d5509611 ("net/ice: add DCF hardware initialization") Fixes: 0b02c9519432 ("net/ice: handle PF initialization by DCF") Signed-off-by: Ke Zhang Signed-off-by: Mingjin Ye Acked-by: Qi Zhang --- drivers/net/ice/ice_dcf.c | 9 +++++++++ drivers/net/ice/ice_dcf.h | 2 ++ drivers/net/ice/ice_dcf_parent.c | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 3e3004f51b..6f7e103c3b 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -32,6 +32,8 @@ #define ICE_DCF_ARQ_MAX_RETRIES 200 #define ICE_DCF_ARQ_CHECK_TIME 2 /* msecs */ +#define ICE_DCF_CHECK_INTERVAL 100 /* 100ms */ + #define ICE_DCF_VF_RES_BUF_SZ \ (sizeof(struct virtchnl_vf_resource) + \ IAVF_MAX_VF_VSI * sizeof(struct virtchnl_vsi_resource)) @@ -639,6 +641,8 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) rte_spinlock_init(&hw->vc_cmd_queue_lock); TAILQ_INIT(&hw->vc_cmd_queue); + __atomic_store_n(&hw->vsi_update_thread_num, 0, __ATOMIC_RELAXED); + hw->arq_buf = rte_zmalloc("arq_buf", ICE_DCF_AQ_BUF_SZ, 0); if (hw->arq_buf == NULL) { PMD_INIT_LOG(ERR, "unable to allocate AdminQ buffer memory"); @@ -760,6 +764,11 @@ 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); + /* Wait for all `ice-thread` threads to exit. */ + while (__atomic_load_n(&hw->vsi_update_thread_num, + __ATOMIC_ACQUIRE) != 0) + rte_delay_ms(ICE_DCF_CHECK_INTERVAL); + ice_dcf_mode_disable(hw); iavf_shutdown_adminq(&hw->avf); diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 7f42ebabe9..7becf6d187 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -105,6 +105,8 @@ struct ice_dcf_hw { void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw, uint8_t *msg, uint16_t msglen); + int vsi_update_thread_num; + uint8_t *arq_buf; uint16_t num_vfs; diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 01e390ddda..0563edb0b2 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -124,6 +124,9 @@ ice_dcf_vsi_update_service_handler(void *param) container_of(hw, struct ice_dcf_adapter, real_hw); struct ice_adapter *parent_adapter = &adapter->parent; + __atomic_fetch_add(&hw->vsi_update_thread_num, 1, + __ATOMIC_RELAXED); + pthread_detach(pthread_self()); rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL); @@ -154,6 +157,9 @@ ice_dcf_vsi_update_service_handler(void *param) free(param); + __atomic_fetch_sub(&hw->vsi_update_thread_num, 1, + __ATOMIC_RELEASE); + return NULL; } -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-25 14:32:01.558800700 +0800 +++ 0115-net-ice-fix-DCF-control-thread-crash.patch 2023-06-25 14:31:58.565773900 +0800 @@ -1 +1 @@ -From 6b7621cea2d9470df076c3559a2fa6ee9752f419 Mon Sep 17 00:00:00 2001 +From 4ec6da600e9573cf5f24ebc6c36cb36f4e30325a Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 6b7621cea2d9470df076c3559a2fa6ee9752f419 ] @@ -22 +24,0 @@ -Cc: stable@dpdk.org @@ -34 +36 @@ -index b11d66f45f..c37b56b0d3 100644 +index 3e3004f51b..6f7e103c3b 100644 @@ -37 +39 @@ -@@ -31,6 +31,8 @@ +@@ -32,6 +32,8 @@ @@ -46 +48 @@ -@@ -638,6 +640,8 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) +@@ -639,6 +641,8 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) @@ -55 +57 @@ -@@ -759,6 +763,11 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) +@@ -760,6 +764,11 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) @@ -81 +83 @@ -index 3175d18b5b..d62837840d 100644 +index 01e390ddda..0563edb0b2 100644 @@ -84 +86 @@ -@@ -123,6 +123,9 @@ ice_dcf_vsi_update_service_handler(void *param) +@@ -124,6 +124,9 @@ ice_dcf_vsi_update_service_handler(void *param) @@ -91 +93 @@ - rte_thread_detach(rte_thread_self()); + pthread_detach(pthread_self()); @@ -94 +96 @@ -@@ -153,6 +156,9 @@ ice_dcf_vsi_update_service_handler(void *param) +@@ -154,6 +157,9 @@ ice_dcf_vsi_update_service_handler(void *param) @@ -101 +103 @@ - return 0; + return NULL;