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 A7498A0547 for ; Tue, 9 Feb 2021 11:36:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1C0740147; Tue, 9 Feb 2021 11:36:30 +0100 (CET) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mails.dpdk.org (Postfix) with ESMTP id D458640147 for ; Tue, 9 Feb 2021 11:36:27 +0100 (CET) Received: by mail-wr1-f50.google.com with SMTP id q7so20928615wre.13 for ; Tue, 09 Feb 2021 02:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hAQRHUHqr4u987NICL/s34cYz47kKJKGEmgtfqubIoA=; b=aa9XgpQgAv80Svrd0egiG86lmZwsHey7VZ0cmMclA0I+1l9AfeCjs8Xz+Ro4QDfzcv SpLuFJfHTSWempEeQFk6x6szI6FhAmCY6O+dOE7c8ZsogQd5c6mpIp9y+bbiflDCinF5 c1qXN2mvtBvUOm8rPNHiKt5ygJzaL9bbCt7VLWT139fdld4NdATYCyUafU7Uf0I1Ufu0 Bgh0+qs6nwVi+CcUN38sQdhXvrrieX2CaJ9OuotwD7gPlAy1Hlro2gPjH+8TJgV/5v5n Mfj68RJZfb9rtumigGIGMHO0lQvmYqiW3QcKGy+Z82HqCyNT9b1v899bdWajhRWvxflk JS8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hAQRHUHqr4u987NICL/s34cYz47kKJKGEmgtfqubIoA=; b=l2sUelXWYAWmhkVNvuePEOCeiDZ8td3JXUbV1c7cuHT+A5SOdJ4yg0Kiiae14omLG7 UXrC5re+R4lF8Fk/uZt1ZDx2BdHti5SEfaNIcjF/aGPnbamS1lqJiH4RfQXN0Ad5d3Dn UgsyhRXn7kP+2WF/SftVS+PmaTHM5VrUyuoQx5Y8SiTGmAQCnm5z+uA+ww5DNJTCr3mD ige+fukVH/MKtuE7wtttiHIXXgxTrRa1QUBaXJimH1J0PA8yIg+pDiVI9zR9/TTblAyV dIyjyYRY137Hg2lgtb8vplSQqa3gYgYxO2kZZHAuvLKPHHFcuqKt/dNVES4lpJLHI9t8 zEmQ== X-Gm-Message-State: AOAM533NnCgfAG7n6dCQyq6F5NVVr2oKk76WIbZ8iN8tCzKakFBwsvIN auihrzOc9yHWEByewVmB4KvgVX3eXBgdgQ== X-Google-Smtp-Source: ABdhPJzGkzPybuX90PZKmvsShhZSitO0bAuo8F2Nqu4gSUxhTU2HX2UNx30Ac3v/LkUeCRbKaUEX7w== X-Received: by 2002:a5d:6292:: with SMTP id k18mr2767974wru.384.1612866987668; Tue, 09 Feb 2021 02:36:27 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id d23sm4139632wmd.11.2021.02.09.02.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 02:36:27 -0800 (PST) From: luca.boccassi@gmail.com To: Chengchang Tang Cc: Lijun Ou , dpdk stable Date: Tue, 9 Feb 2021 10:35:17 +0000 Message-Id: <20210209103529.466775-19-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210209103529.466775-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> <20210209103529.466775-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix firmware exceptions by concurrent commands' has been queued to stable release 20.11.1 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/11/21. 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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/11049ebbd3719e155ce880ad5fbb29c481396677 Thanks. Luca Boccassi --- >From 11049ebbd3719e155ce880ad5fbb29c481396677 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Wed, 3 Feb 2021 20:23:55 +0800 Subject: [PATCH] net/hns3: fix firmware exceptions by concurrent commands [ upstream commit 5ef63df1286861530d23da828415411a4c0a48a5 ] There are two scenarios that command queue uninit performed concurrently with the firmware command: asynchronous command and timeout command. For asynchronous command, if a large number of functions send commands, these commands may need to be queued to wait for firmware processing. If a function is uninited suddenly, CMDQ clearing and firmware processing may be performed concurrently. For timeout command, if the command failed due to busy scheduling of firmware, this command will be processed in the next scheduling. And this may lead to concurrency. The preceding concurrency may lead to a firmware exceptions. This patch add a waiting time to ensure the firmware complete the processing of left over command when PMD uninit. Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware") Signed-off-by: Chengchang Tang Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_cmd.c | 14 +++++++++++++- drivers/net/hns3/hns3_cmd.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c index cd14b1b69d..76d16a5a92 100644 --- a/drivers/net/hns3/hns3_cmd.c +++ b/drivers/net/hns3/hns3_cmd.c @@ -583,9 +583,21 @@ hns3_cmd_destroy_queue(struct hns3_hw *hw) void hns3_cmd_uninit(struct hns3_hw *hw) { + rte_atomic16_set(&hw->reset.disable_cmd, 1); + + /* + * A delay is added to ensure that the register cleanup operations + * will not be performed concurrently with the firmware command and + * ensure that all the reserved commands are executed. + * Concurrency may occur in two scenarios: asynchronous command and + * timeout command. If the command fails to be executed due to busy + * scheduling, the command will be processed in the next scheduling + * of the firmware. + */ + rte_delay_ms(HNS3_CMDQ_CLEAR_WAIT_TIME); + rte_spinlock_lock(&hw->cmq.csq.lock); rte_spinlock_lock(&hw->cmq.crq.lock); - rte_atomic16_set(&hw->reset.disable_cmd, 1); hns3_cmd_clear_regs(hw); rte_spinlock_unlock(&hw->cmq.crq.lock); rte_spinlock_unlock(&hw->cmq.csq.lock); diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index f7ab1f4ca3..20c373590f 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -8,6 +8,7 @@ #include #define HNS3_CMDQ_TX_TIMEOUT 30000 +#define HNS3_CMDQ_CLEAR_WAIT_TIME 200 #define HNS3_CMDQ_RX_INVLD_B 0 #define HNS3_CMDQ_RX_OUTVLD_B 1 #define HNS3_CMD_DESC_ALIGNMENT 4096 -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-09 10:34:58.690591920 +0000 +++ 0019-net-hns3-fix-firmware-exceptions-by-concurrent-comma.patch 2021-02-09 10:34:57.910584004 +0000 @@ -1 +1 @@ -From 5ef63df1286861530d23da828415411a4c0a48a5 Mon Sep 17 00:00:00 2001 +From 11049ebbd3719e155ce880ad5fbb29c481396677 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5ef63df1286861530d23da828415411a4c0a48a5 ] + @@ -25 +26,0 @@ -Cc: stable@dpdk.org @@ -35 +36 @@ -index 3d6ffc090f..32cd56b478 100644 +index cd14b1b69d..76d16a5a92 100644 @@ -38 +39 @@ -@@ -582,9 +582,21 @@ hns3_cmd_destroy_queue(struct hns3_hw *hw) +@@ -583,9 +583,21 @@ hns3_cmd_destroy_queue(struct hns3_hw *hw) @@ -42 +43 @@ -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); ++ rte_atomic16_set(&hw->reset.disable_cmd, 1); @@ -57 +58 @@ -- __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); +- rte_atomic16_set(&hw->reset.disable_cmd, 1); @@ -62 +63 @@ -index 5640fe4ead..5010278e22 100644 +index f7ab1f4ca3..20c373590f 100644