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 C95F442D83 for ; Wed, 28 Jun 2023 16:11:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C464E40151; Wed, 28 Jun 2023 16:11:51 +0200 (CEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id 9379D40151 for ; Wed, 28 Jun 2023 16:11:50 +0200 (CEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-3fa7512e599so69897755e9.2 for ; Wed, 28 Jun 2023 07:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687961510; x=1690553510; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o7pB8sxam8ucSpO9njfcDHEhgmC1NJxg+6pwidtd5+Y=; b=jytK4B9LnoYNbCUGg1B3uzRnEHhN5fM0wLRL34EV8rV1RKucxTj4ivps8BXTvArjme KdvFr8+Np6UBO3FVrZTqahMpkZH3S4PeHh9YmRKJ82bsYEy/oMvaT+2ZQ0DoY4GczEO1 9aCVHdC1MW5IvJTol4Je47uzdz9Q2IKVhnI9Uc5YOG57opHtHt1nAvVyBT/vZSv3Z4/U An2NfDLpfxBXYGH78Irgusc/83p+7KVn1V9C9X8zNFGLYWl4CaKWr3O5UA3di+P7SEod hT5TH46ua5w5tQotBH0ey43+h4WTiuQx2GOnKgHUNKjTtD2lwFv5VreYiYY3Tu6vo4FV EvNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687961510; x=1690553510; 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=o7pB8sxam8ucSpO9njfcDHEhgmC1NJxg+6pwidtd5+Y=; b=gMfyfVId0OB6UFc1t5q3gpjF/3YHRsUPZXCEOPT8z/fWkMw5Ts4Uvpr9GqS1TnXSFG eeMa8Zq2Obv5iIq3ht3u0XV9yCDqm40OxDZbhl65WEcn+yAh3IAlAulspErSwHow3sl/ JUZoyKCo45I6klhqikT81SDMZ4jZZct1DPlNgYa4rKCXKvnSWjHJjMer+5Lq7LaZOeBC BN0iUHYpPc0pArBiXG3G7xtW/22RpSq8hv3IzD/lTR8FRWtUm89N18O9d9QfUb6Uc0iw shc854/db/rO/vEK1H2wpFtungmRhdt3edNPXx/M6pgXQwzzKVgHB+SXT8vTV+hgCZ/F pgoQ== X-Gm-Message-State: AC+VfDwXZb/ydjYKm/HA4xYq4LImtb0VAUNW7U1a4uJLS+gsKBAUXIR5 INvc3C1CZuXGCgj+A7gLC/arOP7sxa4gRQ== X-Google-Smtp-Source: ACHHUZ7ZSaGjFNKcykx7t7xhBaxT44eTc91IOHtwqFfaZv6YsP5v1sWGrkA9dkF0uzKtZywxTEF2zg== X-Received: by 2002:a05:600c:2051:b0:3f7:3545:4630 with SMTP id p17-20020a05600c205100b003f735454630mr31441875wmg.20.1687961510214; Wed, 28 Jun 2023 07:11:50 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm13833613wmc.7.2023.06.28.07.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 07:11:49 -0700 (PDT) From: luca.boccassi@gmail.com To: Mingjin Ye Cc: Qi Zhang , dpdk stable Subject: patch 'net/iavf: fix abnormal disable HW interrupt' has been queued to stable release 20.11.9 Date: Wed, 28 Jun 2023 15:10:41 +0100 Message-Id: <20230628141046.2145871-17-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628141046.2145871-1-luca.boccassi@gmail.com> References: <20230615013258.1439718-63-luca.boccassi@gmail.com> <20230628141046.2145871-1-luca.boccassi@gmail.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 20.11.9 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/30/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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/790a74ad5ed97175068d171b8a8d973f7deb2c4c Thanks. Luca Boccassi --- >From 790a74ad5ed97175068d171b8a8d973f7deb2c4c Mon Sep 17 00:00:00 2001 From: Mingjin Ye Date: Wed, 14 Jun 2023 09:53:03 +0000 Subject: [PATCH] net/iavf: fix abnormal disable HW interrupt [ upstream commit 675a104e2e940ec476e8b469725e8465d01c0098 ] For command VIRTCHNL_OP_REQUEST_QUEUES, polling access to the admin queue has the issue of access overruns after disabling interrupt. That results in FW disabling HW interrupt for protection purposes. The updates/changes in this patch: 1. Remove the polling admin queue processing and use the generic interrupt processing instead. 2. Release redundant queue resource before stopping processing interrupt events. Fixes: 22b123a36d07 ("net/avf: initialize PMD") Fixes: ef807926e148 ("net/iavf: support requesting additional queues from PF") Fixes: 84108425054a ("net/iavf: support asynchronous virtual channel message") Signed-off-by: Mingjin Ye Acked-by: Qi Zhang --- drivers/net/iavf/iavf_ethdev.c | 24 ++++++++--------- drivers/net/iavf/iavf_vchnl.c | 49 +++++++--------------------------- 2 files changed, 22 insertions(+), 51 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 40f5693d28..ddd877724a 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2077,6 +2077,18 @@ iavf_dev_close(struct rte_eth_dev *dev) ret = iavf_dev_stop(dev); + /* + * Release redundant queue resource when close the dev + * so that other vfs can re-use the queues. + */ + if (vf->lv_enabled) { + ret = iavf_request_queues(dev, IAVF_MAX_NUM_QUEUES_DFLT); + if (ret) + PMD_DRV_LOG(ERR, "Reset the num of queues failed"); + + vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT; + } + iavf_flow_flush(dev, NULL); iavf_flow_uninit(adapter); @@ -2088,18 +2100,6 @@ iavf_dev_close(struct rte_eth_dev *dev) if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled) iavf_config_promisc(adapter, false, false); - /* - * Release redundant queue resource when close the dev - * so that other vfs can re-use the queues. - */ - if (vf->lv_enabled) { - ret = iavf_request_queues(dev, IAVF_MAX_NUM_QUEUES_DFLT); - if (ret) - PMD_DRV_LOG(ERR, "Reset the num of queues failed"); - - vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT; - } - iavf_shutdown_adminq(hw); /* disable uio intr before callback unregister */ rte_intr_disable(intr_handle); diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 1a09acafb1..b9dfcd62eb 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -309,6 +309,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) switch (args->ops) { case VIRTCHNL_OP_RESET_VF: + case VIRTCHNL_OP_REQUEST_QUEUES: /*no need to wait for response */ _clear_cmd(vf); break; @@ -331,33 +332,6 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) } _clear_cmd(vf); break; - case VIRTCHNL_OP_REQUEST_QUEUES: - /* - * ignore async reply, only wait for system message, - * vf_reset = true if get VIRTCHNL_EVENT_RESET_IMPENDING, - * if not, means request queues failed. - */ - do { - result = iavf_read_msg_from_pf(adapter, args->out_size, - args->out_buffer); - if (result == IAVF_MSG_SYS && vf->vf_reset) { - break; - } else if (result == IAVF_MSG_CMD || - result == IAVF_MSG_ERR) { - err = -1; - break; - } - iavf_msec_delay(ASQ_DELAY_MS); - /* If don't read msg or read sys event, continue */ - } while (i++ < MAX_TRY_TIMES); - if (i >= MAX_TRY_TIMES || - vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) { - err = -1; - PMD_DRV_LOG(ERR, "No response or return failure (%d)" - " for cmd %d", vf->cmd_retval, args->ops); - } - _clear_cmd(vf); - break; default: if (rte_thread_is_intr()) { /* For virtchnl ops were executed in eal_intr_thread, @@ -1594,11 +1568,11 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct virtchnl_vf_res_request vfres; struct iavf_cmd_info args; uint16_t num_queue_pairs; int err; + int i = 0; if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)) { @@ -1618,22 +1592,19 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) args.out_buffer = vf->aq_resp; args.out_size = IAVF_AQ_BUF_SZ; - /* - * disable interrupt to avoid the admin queue message to be read - * before iavf_read_msg_from_pf. - * - * don't disable interrupt handler until ready to execute vf cmd. - */ - rte_spinlock_lock(&vf->aq_lock); - rte_intr_disable(&pci_dev->intr_handle); - err = iavf_execute_vf_cmd(adapter, &args); - rte_intr_enable(&pci_dev->intr_handle); - rte_spinlock_unlock(&vf->aq_lock); + err = iavf_execute_vf_cmd_safe(adapter, &args); if (err) { PMD_DRV_LOG(ERR, "fail to execute command OP_REQUEST_QUEUES"); return err; } + /* wait for interrupt notification vf is resetting */ + while (i++ < MAX_TRY_TIMES) { + if (vf->vf_reset) + break; + iavf_msec_delay(ASQ_DELAY_MS); + } + /* request queues succeeded, vf is resetting */ if (vf->vf_reset) { PMD_DRV_LOG(INFO, "vf is resetting"); -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-28 11:40:08.792691715 +0100 +++ 0017-net-iavf-fix-abnormal-disable-HW-interrupt.patch 2023-06-28 11:40:08.080028000 +0100 @@ -1 +1 @@ -From 675a104e2e940ec476e8b469725e8465d01c0098 Mon Sep 17 00:00:00 2001 +From 790a74ad5ed97175068d171b8a8d973f7deb2c4c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 675a104e2e940ec476e8b469725e8465d01c0098 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -24,3 +25,3 @@ - drivers/net/iavf/iavf_ethdev.c | 25 +++++++++--------- - drivers/net/iavf/iavf_vchnl.c | 48 +++++++--------------------------- - 2 files changed, 23 insertions(+), 50 deletions(-) + drivers/net/iavf/iavf_ethdev.c | 24 ++++++++--------- + drivers/net/iavf/iavf_vchnl.c | 49 +++++++--------------------------- + 2 files changed, 22 insertions(+), 51 deletions(-) @@ -29 +30 @@ -index b72dbc8ceb..00b963128b 100644 +index 40f5693d28..ddd877724a 100644 @@ -32,2 +33 @@ -@@ -2757,6 +2757,19 @@ iavf_dev_close(struct rte_eth_dev *dev) - } +@@ -2077,6 +2077,18 @@ iavf_dev_close(struct rte_eth_dev *dev) @@ -36 +36 @@ -+ + @@ -49 +49,2 @@ - adapter->closed = true; + iavf_flow_flush(dev, NULL); + iavf_flow_uninit(adapter); @@ -51,2 +52 @@ - /* free iAVF security device context all related resources */ -@@ -2773,18 +2786,6 @@ iavf_dev_close(struct rte_eth_dev *dev) +@@ -2088,18 +2100,6 @@ iavf_dev_close(struct rte_eth_dev *dev) @@ -69,2 +69,2 @@ - if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) { - /* disable uio intr before callback unregister */ + /* disable uio intr before callback unregister */ + rte_intr_disable(intr_handle); @@ -72 +72 @@ -index 07eb358824..524732f67d 100644 +index 1a09acafb1..b9dfcd62eb 100644 @@ -75 +75 @@ -@@ -324,6 +324,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, +@@ -309,6 +309,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) @@ -83 +83 @@ -@@ -347,33 +348,6 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, +@@ -331,33 +332,6 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) @@ -117 +117 @@ -@@ -2082,11 +2056,11 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) +@@ -1594,11 +1568,11 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) @@ -130 +130,2 @@ -@@ -2107,16 +2081,7 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) +@@ -1618,22 +1592,19 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) + args.out_buffer = vf->aq_resp; @@ -133,16 +134,14 @@ - if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) { -- /* disable interrupt to avoid the admin queue message to be read -- * before iavf_read_msg_from_pf. -- * -- * don't disable interrupt handler until ready to execute vf cmd. -- */ -- rte_spinlock_lock(&vf->aq_lock); -- rte_intr_disable(pci_dev->intr_handle); -- err = iavf_execute_vf_cmd(adapter, &args, 0); -- rte_intr_enable(pci_dev->intr_handle); -- rte_spinlock_unlock(&vf->aq_lock); -+ err = iavf_execute_vf_cmd_safe(adapter, &args, 0); - } else { - rte_eal_alarm_cancel(iavf_dev_alarm_handler, dev); - err = iavf_execute_vf_cmd_safe(adapter, &args, 0); -@@ -2129,6 +2094,13 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) +- /* +- * disable interrupt to avoid the admin queue message to be read +- * before iavf_read_msg_from_pf. +- * +- * don't disable interrupt handler until ready to execute vf cmd. +- */ +- rte_spinlock_lock(&vf->aq_lock); +- rte_intr_disable(&pci_dev->intr_handle); +- err = iavf_execute_vf_cmd(adapter, &args); +- rte_intr_enable(&pci_dev->intr_handle); +- rte_spinlock_unlock(&vf->aq_lock); ++ err = iavf_execute_vf_cmd_safe(adapter, &args); + if (err) { + PMD_DRV_LOG(ERR, "fail to execute command OP_REQUEST_QUEUES");