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 AF8D942ECF for ; Thu, 20 Jul 2023 17:24:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB77540685; Thu, 20 Jul 2023 17:24:15 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id F00C6400D6 for ; Thu, 20 Jul 2023 17:24:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689866653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OeraxQMrdt80wsQsLLt5ID5IqlgwgVq2UjO6DorthHQ=; b=By8Nze1E2uUneTDy6YcwwcvjY5K8s0IVBmZRt1xQwJO3NJtgM89Yfom8jvQsx8wr6ZXorM b43YmWZrn9+7pZHym8+Tfn8k9InbEIKjKbi6zmZx+NDDXdVXfgEej8AECi5ezdQikttnOw moZTFewdkVmMLtJZgMPMiSVW8tLKW7k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-625-hdmSAaQTMUGUUX7xyeIX7A-1; Thu, 20 Jul 2023 11:23:10 -0400 X-MC-Unique: hdmSAaQTMUGUUX7xyeIX7A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C1F01830DB3; Thu, 20 Jul 2023 15:22:33 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9879492C13; Thu, 20 Jul 2023 15:22:32 +0000 (UTC) From: Kevin Traynor To: Mingjin Ye Cc: Qi Zhang , dpdk stable Subject: patch 'net/iavf: fix abnormal disable HW interrupt' has been queued to stable release 21.11.5 Date: Thu, 20 Jul 2023 16:18:52 +0100 Message-ID: <20230720151942.262154-101-ktraynor@redhat.com> In-Reply-To: <20230720151942.262154-1-ktraynor@redhat.com> References: <20230720151942.262154-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/25/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/8fcb633704411ed5e587b68683047c6b84596445 Thanks. Kevin --- >From 8fcb633704411ed5e587b68683047c6b84596445 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 | 25 +++++++++--------- drivers/net/iavf/iavf_vchnl.c | 48 +++++++--------------------------- 2 files changed, 23 insertions(+), 50 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 0a5847ee53..1afbc22d54 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2645,4 +2645,17 @@ 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; + } + adapter->closed = true; @@ -2661,16 +2674,4 @@ iavf_dev_close(struct rte_eth_dev *dev) 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); if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) { diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 930a67f517..ecba88ffea 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -176,4 +176,5 @@ 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); @@ -199,31 +200,4 @@ 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: /* For other virtchnl ops in running time, @@ -1723,9 +1697,9 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) 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 & @@ -1748,14 +1722,5 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) 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); @@ -1770,4 +1735,11 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) } + /* 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) { -- 2.41.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-07-20 16:18:07.417069200 +0100 +++ 0101-net-iavf-fix-abnormal-disable-HW-interrupt.patch 2023-07-20 16:17:55.058752129 +0100 @@ -1 +1 @@ -From 675a104e2e940ec476e8b469725e8465d01c0098 Mon Sep 17 00:00:00 2001 +From 8fcb633704411ed5e587b68683047c6b84596445 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 675a104e2e940ec476e8b469725e8465d01c0098 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -29 +30 @@ -index b72dbc8ceb..00b963128b 100644 +index 0a5847ee53..1afbc22d54 100644 @@ -32 +33 @@ -@@ -2758,4 +2758,17 @@ iavf_dev_close(struct rte_eth_dev *dev) +@@ -2645,4 +2645,17 @@ iavf_dev_close(struct rte_eth_dev *dev) @@ -50 +51 @@ -@@ -2774,16 +2787,4 @@ iavf_dev_close(struct rte_eth_dev *dev) +@@ -2661,16 +2674,4 @@ iavf_dev_close(struct rte_eth_dev *dev) @@ -68 +69 @@ -index 07eb358824..524732f67d 100644 +index 930a67f517..ecba88ffea 100644 @@ -71 +72 @@ -@@ -325,4 +325,5 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, +@@ -176,4 +176,5 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, @@ -77 +78 @@ -@@ -348,31 +349,4 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, +@@ -199,31 +200,4 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, @@ -108,2 +109,2 @@ - if (rte_thread_is_intr()) { -@@ -2083,9 +2057,9 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) + /* For other virtchnl ops in running time, +@@ -1723,9 +1697,9 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) @@ -120 +121 @@ -@@ -2108,14 +2082,5 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) +@@ -1748,14 +1722,5 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) @@ -136 +137 @@ -@@ -2130,4 +2095,11 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num) +@@ -1770,4 +1735,11 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)