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 8A81045DB9 for ; Wed, 27 Nov 2024 18:21:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 85FD74066C; Wed, 27 Nov 2024 18:21:49 +0100 (CET) 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 E937D4066C for ; Wed, 27 Nov 2024 18:21:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728107; 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=7Q7BvAIB7M5j1gAJYXsezJXgAhRCzk6vkQinbe/6dDg=; b=MlbduYKRT0iGarXNOjOM/NdxABmf0CoQNYs9BltnPzNwkZ8fNnkxJYqgg4I8V7KGE2yx1e kWRZOnujovln1DM4BzsgdG/JEV+ao1QmGjrZ50fv4IbiFPW309Xt2vLiRh9H4NASH22lIC qc80w18VkU6Dohq9Zp+uF7XTGAZnpeE= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-553-hP7H92DoOnaVagn5NhaaRQ-1; Wed, 27 Nov 2024 12:21:44 -0500 X-MC-Unique: hP7H92DoOnaVagn5NhaaRQ-1 X-Mimecast-MFC-AGG-ID: hP7H92DoOnaVagn5NhaaRQ Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 788DA1956080; Wed, 27 Nov 2024 17:21:43 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.52]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E41B7300019E; Wed, 27 Nov 2024 17:21:41 +0000 (UTC) From: Kevin Traynor To: Bing Zhao Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: workaround list management of Rx queue control' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:18:09 +0000 Message-ID: <20241127171916.690404-62-ktraynor@redhat.com> In-Reply-To: <20241127171916.690404-1-ktraynor@redhat.com> References: <20241127171916.690404-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Xg9GyxpesNmiE4SMqtOgmW_CT4bkEbTWI5PjCRJvAqk_1732728103 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.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 12/02/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/c360d3ce339bfbe9cb6abf5bd04e8c5a2b769246 Thanks. Kevin --- >From c360d3ce339bfbe9cb6abf5bd04e8c5a2b769246 Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Tue, 23 Jul 2024 14:14:11 +0300 Subject: [PATCH] net/mlx5: workaround list management of Rx queue control [ upstream commit f957ac99643535fd218753f4f956fc9c5aadd23c ] The LIST_REMOVE macro only removes the entry from the list and updates list itself. The pointers of this entry are not reset to NULL to prevent the accessing for the 2nd time. In the previous fix for the memory accessing, the "rxq_ctrl" was removed from the list in a device private data when the "refcnt" was decreased to 0. Under only shared or non-shared queues scenarios, this was safe since all the "rxq_ctrl" entries were freed or kept. There is one case that shared and non-shared Rx queues are configured simultaneously, for example, a hairpin Rx queue cannot be shared. When closing the port that allocated the shared Rx queues' "rxq_ctrl", if the next entry is hairpin "rxq_ctrl", the hairpin "rxq_ctrl" will be freed directly with other resources. When trying to close the another port sharing the "rxq_ctrl", the LIST_REMOVE will be called again and cause some UFA issue. If the memory is no longer mapped, there will be a SIGSEGV. Adding a flag in the Rx queue private structure to remove the "rxq_ctrl" from the list only on the port/queue that allocated it. Fixes: bcc220cb57d7 ("net/mlx5: fix shared Rx queue list management") Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_rx.h | 1 + drivers/net/mlx5/mlx5_rxq.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index 5bcb6cb03a..62f6323cdc 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -175,4 +175,5 @@ struct mlx5_rxq_ctrl { struct mlx5_rxq_priv { uint16_t idx; /* Queue index. */ + bool possessor; /* Shared rxq_ctrl allocated for the 1st time. */ uint32_t refcnt; /* Reference counter. */ struct mlx5_rxq_ctrl *ctrl; /* Shared Rx Queue. */ diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index da1b1f8bb9..4e958d2005 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -941,4 +941,5 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, return -rte_errno; } + rxq->possessor = true; } mlx5_rxq_ref(dev, idx); @@ -2013,4 +2014,5 @@ mlx5_rxq_hairpin_new(struct rte_eth_dev *dev, struct mlx5_rxq_priv *rxq, tmpl->rxq.idx = idx; rxq->hairpin_conf = *hairpin_conf; + rxq->possessor = true; mlx5_rxq_ref(dev, idx); LIST_INSERT_HEAD(&priv->rxqsctrl, tmpl, next); @@ -2162,5 +2164,6 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) } } else { /* Refcnt zero, closing device. */ - LIST_REMOVE(rxq_ctrl, next); + if (rxq->possessor) + LIST_REMOVE(rxq_ctrl, next); LIST_REMOVE(rxq, owner_entry); if (LIST_EMPTY(&rxq_ctrl->owners)) { -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:40.212579628 +0000 +++ 0062-net-mlx5-workaround-list-management-of-Rx-queue-cont.patch 2024-11-27 17:17:38.242269461 +0000 @@ -1 +1 @@ -From f957ac99643535fd218753f4f956fc9c5aadd23c Mon Sep 17 00:00:00 2001 +From c360d3ce339bfbe9cb6abf5bd04e8c5a2b769246 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f957ac99643535fd218753f4f956fc9c5aadd23c ] + @@ -28 +29,0 @@ -Cc: stable@dpdk.org @@ -38 +39 @@ -index 7d144921ab..9bcb43b007 100644 +index 5bcb6cb03a..62f6323cdc 100644 @@ -41 +42 @@ -@@ -174,4 +174,5 @@ struct mlx5_rxq_ctrl { +@@ -175,4 +175,5 @@ struct mlx5_rxq_ctrl { @@ -45 +46 @@ - RTE_ATOMIC(uint32_t) refcnt; /* Reference counter. */ + uint32_t refcnt; /* Reference counter. */ @@ -48 +49 @@ -index f13fc3b353..c6655b7db4 100644 +index da1b1f8bb9..4e958d2005 100644 @@ -51 +52 @@ -@@ -939,4 +939,5 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, +@@ -941,4 +941,5 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, @@ -56,2 +57,2 @@ - rxq->priv = priv; -@@ -2016,4 +2017,5 @@ mlx5_rxq_hairpin_new(struct rte_eth_dev *dev, struct mlx5_rxq_priv *rxq, + mlx5_rxq_ref(dev, idx); +@@ -2013,4 +2014,5 @@ mlx5_rxq_hairpin_new(struct rte_eth_dev *dev, struct mlx5_rxq_priv *rxq, @@ -63 +64 @@ -@@ -2283,5 +2285,6 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx) +@@ -2162,5 +2164,6 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)