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 9F5E443B86 for ; Tue, 5 Mar 2024 10:49:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9AA604026B; Tue, 5 Mar 2024 10:49:55 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by mails.dpdk.org (Postfix) with ESMTP id 2A5744014F for ; Tue, 5 Mar 2024 10:49:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjVr7NFUH2jritdEIvH+9VKs7hvf6J+fGD8eq9FKa01G9q/vzlAFq9qHONKgm7k37stU2vf6gEBB+WQ1uqly29WyhgpcGfoUSWWqAp5pEgjA01VYqyWGvKJvSC/8apJPBdsTMMAboAk6ceEBacQKhHXXDWW69dCJ/HfnOnRwuZu2yxe/8FibdkWyftHThTlrmVwLugxiqEHb45wfHhBWJ8SvPHhgIZsBvfY3ffLWS1th3c7bgrzGCXYOoJxWkEOjHHSIfD4Eoxz/ff2zGY2oD/99Wcav/MKJvHaFTlsPnNwf/l0Rq7Zj0cy2gpEJc5Z1gqSP/s6UjaR6teQmCs6T9Q== 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=GQu/VMt7yB+SRUxEihKhILdWSyrQIgEveJsZJPA1/oU=; b=H3tZHLtHnIiESVPmRhcO1JNj1mDOWrAVL4SDY8f0gEQB7GvCWx2vcR0VQWHl0wjMUcoVMZFBy/1tGbkB8NH0wRp4i/8K2GNhWyS9UsJfE2okHpdi+B2cYuhD8fiTt77RcQaIkaPPFHzKv+bNkC2OmBsl1Lf9zB2ZW5A/P2IZXGB6dxUXcUp7H6E7YbnR1SeSW+I/yGugwVjF4wpXpn0iN2m/zfYKEaJFccz8xveSPwfLhE4wulhgmLzcew07RIAanuodZWFTwmvO+4vqW+DTeaPf+lADVe0JXVfOqBvBSJAKpC2nZc9h3qNDQj9ZhIW6pOTAN4NqbmhVF/c4ldIGvg== 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 (0) 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=GQu/VMt7yB+SRUxEihKhILdWSyrQIgEveJsZJPA1/oU=; b=h6ILXWIXdI/n+r6Yiwk9wauvRWLSxZW1zBS4kWgeJSXUCW12fzDqJX2PvSaTjPP+XWfenoif3yLnj/aD1FueaZi4Z8EP9PLTExG7KtcZUkBYj+kJK7G5mcAdRGnqZZ09WFuRXcg1rn9AHvXwigtPhfIo3YE0/9nf3FPxPL2QzCecmtCThedk7WhrzfVXa7FDAzECkpLbs8OwDYtvOjg+tbaYUhOtCWOg+VixDZqcaDKAO/3nB4jDK0LYmTaiFy6sTYyyKorhje+3AWGgN/5K8+fdpSZXDTIImskTtV135fizwx4GDOr2WBIAJ1ts3h7nk3ROCLx18bhwJFzQaTh82w== Received: from CH0PR03CA0432.namprd03.prod.outlook.com (2603:10b6:610:10e::20) by SJ1PR12MB6364.namprd12.prod.outlook.com (2603:10b6:a03:452::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar 2024 09:49:51 +0000 Received: from SN1PEPF0002BA50.namprd03.prod.outlook.com (2603:10b6:610:10e:cafe::54) by CH0PR03CA0432.outlook.office365.com (2603:10b6:610:10e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 5 Mar 2024 09:49:51 +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 SN1PEPF0002BA50.mail.protection.outlook.com (10.167.242.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:49:50 +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.41; Tue, 5 Mar 2024 01:49:36 -0800 Received: from nvidia.com (10.126.231.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.1258.12; Tue, 5 Mar 2024 01:49:34 -0800 From: Xueming Li To: Shiyang He CC: Qi Zhang , dpdk stable Subject: patch 'net/iavf: fix crash on VF start' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:45:56 +0800 Message-ID: <20240305094757.439387-16-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: SN1PEPF0002BA50:EE_|SJ1PR12MB6364:EE_ X-MS-Office365-Filtering-Correlation-Id: 4074ede2-b92f-44f0-f74b-08dc3cf99a0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oKg6xXpSkPk6MCqa4bqBLjeRd+Vom5JwFm4fiF5/QqncY4z6zQeLw3e4l2ddVkor3daQ8ZF6C+YhXr9E+oayy1GQFefjYXKTDvMXM52A/B0fbg0EKCVEizK8wAyFUBxuLcDeL/xYH/dfB1z6OD22P/H1uI3ThwUko2sCLTadM+B2cylUpKQu/Nh0EfNxZ8LYXTfywtUqcTWwGFQSnnJ800ovCR0zGR92VyNCBeiyd/YelhD8J8eZq5IyLauQZ6tKk9FLCpn0CZIcX6EZ8WmLYouFUFH/7SrtFH4axUQS8k0SlSB4z3Il0ttlFq6/mWxs1OC3UCvwzbUsqzzvtMPNbAyeZNFXZYsKdlQhq1Rjx6ViCM6droLzuK4d88Vvpmwoglt96UsRw88mzFGPvsZBlblzd4C+zNOajT21bgbPvS57judxysv+D9FybVq0pclCssOtnhtlolN2twOLEEY6OChZAbsBqhnpfR6CM0cNUjOXqg2Jz3ObQ/WR4L1QJ8ofCGVWElWMcepxtKhDDVGZdLcDX7MRLeIdYPx0S9AyGCCIRgqBpDuZAUSedzANujorKPnKoup9bls7M6muvjx09wvoa+ufSe3GgjyRpBilRFMhftEDLTVzpRCLkdetF7q2bezS4iR5dkYb+27InLapFDaF/IFGN9dx1Nm+DRosf7SxBCqqCtJXkcpujl+D/x2CtkjlozjAlYvjCIn9/7QjrSho5rQ/PTr9Zt4YuIBF+qWE/lqC00GZsM65LR+JEYkN 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:(13230031)(82310400014)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:49:50.7713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4074ede2-b92f-44f0-f74b-08dc3cf99a0e 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: SN1PEPF0002BA50.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6364 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 23.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 03/31/24. 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=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=9aa2da4c022425461eb21ffbfef889edae9bd881 Thanks. Xueming Li --- >From 9aa2da4c022425461eb21ffbfef889edae9bd881 Mon Sep 17 00:00:00 2001 From: Shiyang He Date: Wed, 3 Jan 2024 10:42:07 +0000 Subject: [PATCH] net/iavf: fix crash on VF start Cc: Xueming Li [ upstream commit 80fb3c92045824da18af333ee8a758145b54b19f ] When the VF starts to request multiple queues, the PF sends a reset command to the VF. During the reset process, adminq sends an abnormal message to PF for an unknown reason, and the resource request fails resulting in a coredump. This patch fixes the issue by checking the reset state before resetting. Fixes: 3e6a5d2d310a ("net/iavf: add devargs to enable VF auto-reset") Signed-off-by: Shiyang He Acked-by: Qi Zhang --- drivers/net/iavf/iavf.h | 3 ++- drivers/net/iavf/iavf_ethdev.c | 45 +++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 5bfe85dabd..d273d884f5 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -19,6 +19,7 @@ #define IAVF_AQ_LEN 32 #define IAVF_AQ_BUF_SZ 4096 #define IAVF_RESET_WAIT_CNT 2000 +#define IAVF_RESET_DETECTED_CNT 500 #define IAVF_BUF_SIZE_MIN 1024 #define IAVF_FRAME_SIZE_MAX 9728 #define IAVF_QUEUE_BASE_ADDR_UNIT 128 @@ -511,6 +512,6 @@ int iavf_flow_sub_check(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter); void iavf_dev_watchdog_enable(struct iavf_adapter *adapter); void iavf_dev_watchdog_disable(struct iavf_adapter *adapter); -int iavf_handle_hw_reset(struct rte_eth_dev *dev); +void iavf_handle_hw_reset(struct rte_eth_dev *dev); void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change); #endif /* _IAVF_ETHDEV_H_ */ diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 0952998304..32a1626420 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1088,9 +1088,6 @@ iavf_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - if (vf->vf_reset) - return 0; - if (adapter->closed) return -1; @@ -2955,7 +2952,6 @@ iavf_dev_reset(struct rte_eth_dev *dev) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); /* * Check whether the VF reset has been done and inform application, @@ -2967,7 +2963,6 @@ iavf_dev_reset(struct rte_eth_dev *dev) PMD_DRV_LOG(ERR, "Wait too long for reset done!\n"); return ret; } - vf->vf_reset = false; iavf_set_no_poll(adapter, false); PMD_DRV_LOG(DEBUG, "Start dev_reset ...\n"); @@ -2978,17 +2973,47 @@ iavf_dev_reset(struct rte_eth_dev *dev) return iavf_dev_init(dev); } +static inline bool +iavf_is_reset(struct iavf_hw *hw) +{ + return !(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) & + IAVF_VF_ARQLEN1_ARQENABLE_MASK); +} + +static bool +iavf_is_reset_detected(struct iavf_adapter *adapter) +{ + struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter); + int i; + + /* poll until we see the reset actually happen */ + for (i = 0; i < IAVF_RESET_DETECTED_CNT; i++) { + if (iavf_is_reset(hw)) + return true; + rte_delay_ms(20); + } + + return false; +} + /* * Handle hardware reset */ -int +void iavf_handle_hw_reset(struct rte_eth_dev *dev) { - struct iavf_adapter *adapter = - IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); + struct iavf_adapter *adapter = dev->data->dev_private; int ret; + if (!dev->data->dev_started) + return; + + if (!iavf_is_reset_detected(adapter)) { + PMD_DRV_LOG(DEBUG, "reset not start\n"); + return; + } + vf->in_reset_recovery = true; iavf_set_no_poll(adapter, false); @@ -3007,6 +3032,7 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev) ret = iavf_dev_start(dev); if (ret) goto error; + dev->data->dev_started = 1; goto exit; @@ -3015,7 +3041,8 @@ error: exit: vf->in_reset_recovery = false; iavf_set_no_poll(adapter, false); - return ret; + + return; } void -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:31.566084319 +0800 +++ 0015-net-iavf-fix-crash-on-VF-start.patch 2024-03-05 17:39:30.683566490 +0800 @@ -1 +1 @@ -From 80fb3c92045824da18af333ee8a758145b54b19f Mon Sep 17 00:00:00 2001 +From 9aa2da4c022425461eb21ffbfef889edae9bd881 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 80fb3c92045824da18af333ee8a758145b54b19f ] @@ -14 +16,0 @@ -Cc: stable@dpdk.org