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 5C68EA0544 for ; Fri, 11 Nov 2022 12:40:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5672742B7E; Fri, 11 Nov 2022 12:40:59 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 77341410F2 for ; Fri, 11 Nov 2022 12:40:58 +0100 (CET) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 4125D42240 for ; Fri, 11 Nov 2022 11:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668166858; bh=bfU70Za03JCzZLU726U8CeMZlVPLapgjzDOjtYmMeTg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=egec5r4rvdMf6w8q0eXVkWMMuBeRRsXA8Hw6UXQtJtICuTtzRWdccXPro2/vSPYl4 sAQKSiuRJD6NfPxvt1ig509lHiurDGMKomxfcWyL+MEiAGdF53ROCQBqQYGxLL3/7f vRaxDbtyCur3c8z4bhYptg+fduyUDjQNREQUbJ2Zju4pWCeZnUNh4EAV2uIRwVgTl+ f+nY7HLGUP7SSpbJXvetcuzx0EXiQXjSnqUOx80mkvx7OGcHqzmCzemlGe1iKpw1YG VGvqSKrEXTaHyT8EkQcFBUSq2R7jaLRewtq9RiYAFd82j92s0bEVb1eF465mMxFJv1 klrIasScoWDlQ== Received: by mail-ed1-f72.google.com with SMTP id t4-20020a056402524400b004620845ba7bso3446211edd.4 for ; Fri, 11 Nov 2022 03:40:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bfU70Za03JCzZLU726U8CeMZlVPLapgjzDOjtYmMeTg=; b=nhIHL1UHl5a6hIZ20/7U2xEn/P3uw63yJRUsE9Q+Nv6DsLCNwW+F76OgXh3dsdCScz BvYQYQb5af/OJc7+ONDIMUMUhjonQVj/Eje51Y8/0K2lCtTTmW5zgbTNNZfeWihdSGay mAZRxvzD3SMxz4Xy0SUXI6+JqnopiKZbjMtpKNnwwiio1MKmr71j4hoiE7l9ZiVbp9He xH3hCp55l3/a7qmMux37XW1f2mgkSF4p633xdXQ/NYa0+/lgiFEBhGj72rky6ayKVJv0 gQlrfDRhXZSp+lvuFD0oC2eSulUKNE7Lijxhq8kR/O54Whyc4ZypX53SxTwiMNrP1BrE xiYQ== X-Gm-Message-State: ANoB5pkIVFWVTbZq9Rk55hGbVV81hF2fKdxIpBxoTR9LWB4abdt6Q6A5 YVCaOMBTBaIBYb9dWA1hmH/XD7NqNiQN4mSf0sGgYryE6M6xWeZYuonJrcc0nTlLCV0Im9iHf+Q XpUKkcPlO5+DoWyUFGBZW/nle X-Received: by 2002:a17:907:c94:b0:78d:b8ab:9a5a with SMTP id gi20-20020a1709070c9400b0078db8ab9a5amr1523220ejc.454.1668166857963; Fri, 11 Nov 2022 03:40:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Yti1opkicX08+kjS7yAXH3hwCiXHo+kcqzG3do32QTwJWLFsohwEvGgD6/GE74MtI9W9flg== X-Received: by 2002:a17:907:c94:b0:78d:b8ab:9a5a with SMTP id gi20-20020a1709070c9400b0078db8ab9a5amr1523207ejc.454.1668166857718; Fri, 11 Nov 2022 03:40:57 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39af:c100:1891:6c61:50fd:e567]) by smtp.gmail.com with ESMTPSA id jz22-20020a17090775f600b0073dc4385d3bsm782322ejc.105.2022.11.11.03.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 03:40:56 -0800 (PST) From: christian.ehrhardt@canonical.com To: Chengwen Feng Cc: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: fix crash when secondary process access FW' has been queued to stable release 19.11.14 Date: Fri, 11 Nov 2022 12:38:50 +0100 Message-Id: <20221111113904.1549618-33-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> References: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 19.11.14 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/18/22. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/10690bdfc448c47b6d739880f98dbda67f6134bc Thanks. Christian Ehrhardt --- >From 10690bdfc448c47b6d739880f98dbda67f6134bc Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Mon, 5 Sep 2022 16:59:36 +0800 Subject: [PATCH] net/hns3: fix crash when secondary process access FW [ upstream commit a8f1f7cf1b429c3b95fa94f794f697a30f4c482d ] Currently, to prevent missing reporting of reset interrupts and quickly identify reset interrupts, the following logic is designed in the FW (firmware) command interface hns3_cmd_send: if an unprocessed interrupt exist (by checking reset registers), related reset task is scheduled. The secondary process may invoke the hns3_cmd_send interface (e.g. using proc-info query some stats). Unfortunately, the secondary process does not support reset processing, and a segment fault may occur if it schedules reset task. Fix it by limit the checking and scheduling of reset under only primary process. Fixes: 2790c6464725 ("net/hns3: support device reset") Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 10 +++++++++- drivers/net/hns3/hns3_ethdev_vf.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 1a8d729bc4..4cf3eb1b47 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4999,7 +4999,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns) struct hns3_hw *hw = &hns->hw; enum hns3_reset_level reset; - hns3_check_event_cause(hns, NULL); + /* + * Check the registers to confirm whether there is reset pending. + * Note: This check may lead to schedule reset task, but only primary + * process can process the reset event. Therefore, limit the + * checking under only primary process. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + hns3_check_event_cause(hns, NULL); + reset = hns3_get_reset_level(hns, &hw->reset.pending); if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { hns3_warn(hw, "High level reset %d is pending", reset); diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 29a483b2f4..6e1d868a91 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1918,8 +1918,15 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) if (hw->reset.level == HNS3_VF_FULL_RESET) return false; - /* Check the registers to confirm whether there is reset pending */ - hns3vf_check_event_cause(hns, NULL); + /* + * Check the registers to confirm whether there is reset pending. + * Note: This check may lead to schedule reset task, but only primary + * process can process the reset event. Therefore, limit the + * checking under only primary process. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + hns3vf_check_event_cause(hns, NULL); + reset = hns3vf_get_reset_level(hw, &hw->reset.pending); if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { hns3_warn(hw, "High level reset %d is pending", reset); -- 2.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-11 12:35:05.950534697 +0100 +++ 0033-net-hns3-fix-crash-when-secondary-process-access-FW.patch 2022-11-11 12:35:04.789192151 +0100 @@ -1 +1 @@ -From a8f1f7cf1b429c3b95fa94f794f697a30f4c482d Mon Sep 17 00:00:00 2001 +From 10690bdfc448c47b6d739880f98dbda67f6134bc Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a8f1f7cf1b429c3b95fa94f794f697a30f4c482d ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index 95d3c93c42..3d9f7c6ec7 100644 +index 1a8d729bc4..4cf3eb1b47 100644 @@ -34 +35 @@ -@@ -5602,7 +5602,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns) +@@ -4999,7 +4999,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns) @@ -49,2 +50,2 @@ - if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET && - hw->reset.level < reset) { + if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { + hns3_warn(hw, "High level reset %d is pending", reset); @@ -52 +53 @@ -index 86f2ba24cc..a72535eb7d 100644 +index 29a483b2f4..6e1d868a91 100644 @@ -55 +56 @@ -@@ -1864,8 +1864,15 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) +@@ -1918,8 +1918,15 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) @@ -71,2 +72,2 @@ - if (hw->reset.level != HNS3_NONE_RESET && reset != HNS3_NONE_RESET && - hw->reset.level < reset) { + if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { + hns3_warn(hw, "High level reset %d is pending", reset);