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 09A7BA054A for ; Tue, 25 Oct 2022 17:09:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB96B42C59; Tue, 25 Oct 2022 17:09:34 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id D309A42C38 for ; Tue, 25 Oct 2022 17:09:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666710573; 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=2zXAWR+NXUr/YdQ1DzvMWuuy0XK/XJl066en8AFK71g=; b=A6erHRtxfwz89TFNI0ybZRg8wL0TddyXBnNidlj6blTD6CaQu13Y6Acpdogr5wlSlcVMaI hj+8GeAO/QurXEuf1CxI8Sy1ceb10oCRrzQmKTTYneaJimy86azcqd2UaDZAHXHlfGsEvX ZRtiwEGnOqajGaKOZl/kBtgC9lvBmKg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-322-vOEARPCwOjW94nM7xSdm5g-1; Tue, 25 Oct 2022 11:09:30 -0400 X-MC-Unique: vOEARPCwOjW94nM7xSdm5g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F84C29AA3AE; Tue, 25 Oct 2022 15:09:29 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9D8347505E; Tue, 25 Oct 2022 15:09:28 +0000 (UTC) From: Kevin Traynor To: Long Li Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix Verbs FD leak in secondary process' has been queued to stable release 21.11.3 Date: Tue, 25 Oct 2022 16:07:00 +0100 Message-Id: <20221025150734.142189-65-ktraynor@redhat.com> In-Reply-To: <20221025150734.142189-1-ktraynor@redhat.com> References: <20221025150734.142189-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.3 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/01/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/879ebb7dcee5d4e8bc19c5e985cd005579ee604a Thanks. Kevin --- >From 879ebb7dcee5d4e8bc19c5e985cd005579ee604a Mon Sep 17 00:00:00 2001 From: Long Li Date: Wed, 6 Jul 2022 10:48:53 -0700 Subject: [PATCH] net/mlx5: fix Verbs FD leak in secondary process [ upstream commit bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 ] FDs passed from rte_mp_msg are duplicated to the secondary process and need to be closed. Fixes: 9a8ab29b84 ("net/mlx5: replace IPC socket with EAL API") Signed-off-by: Long Li Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_mp_os.c | 6 +++++- drivers/net/mlx5/linux/mlx5_os.c | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_mp_os.c b/drivers/net/mlx5/linux/mlx5_mp_os.c index c448a3e9eb..0ba2208fe0 100644 --- a/drivers/net/mlx5/linux/mlx5_mp_os.c +++ b/drivers/net/mlx5/linux/mlx5_mp_os.c @@ -178,12 +178,16 @@ struct rte_mp_msg mp_res; mlx5_proc_priv_uninit(dev); ret = mlx5_proc_priv_init(dev); - if (ret) + if (ret) { + close(mp_msg->fds[0]); return -rte_errno; + } ret = mlx5_tx_uar_init_secondary(dev, mp_msg->fds[0]); if (ret) { + close(mp_msg->fds[0]); mlx5_proc_priv_uninit(dev); return -rte_errno; } } + close(mp_msg->fds[0]); rte_mb(); mp_init_msg(&priv->mp_id, &mp_res, param->type); diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 792dd2cb22..27d6fe644d 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -934,4 +934,5 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (rte_eal_process_type() == RTE_PROC_SECONDARY) { struct mlx5_mp_id mp_id; + int fd; eth_dev = rte_eth_dev_attach_secondary(name); @@ -950,9 +951,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mlx5_mp_id_init(&mp_id, eth_dev->data->port_id); /* Receive command fd from primary process */ - err = mlx5_mp_req_verbs_cmd_fd(&mp_id); - if (err < 0) + fd = mlx5_mp_req_verbs_cmd_fd(&mp_id); + if (fd < 0) goto err_secondary; /* Remap UAR for Tx queues. */ - err = mlx5_tx_uar_init_secondary(eth_dev, err); + err = mlx5_tx_uar_init_secondary(eth_dev, fd); + close(fd); if (err) goto err_secondary; -- 2.37.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-10-25 14:19:00.017118199 +0100 +++ 0065-net-mlx5-fix-Verbs-FD-leak-in-secondary-process.patch 2022-10-25 14:18:58.471798306 +0100 @@ -1 +1 @@ -From bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 Mon Sep 17 00:00:00 2001 +From 879ebb7dcee5d4e8bc19c5e985cd005579ee604a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index e607089e0e..f2e71c9bd4 100644 +index c448a3e9eb..0ba2208fe0 100644 @@ -42 +43 @@ -index 4f0a6f4d55..6e5f01dda0 100644 +index 792dd2cb22..27d6fe644d 100644 @@ -45 +46 @@ -@@ -1081,4 +1081,5 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, +@@ -934,4 +934,5 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, @@ -51 +52 @@ -@@ -1097,9 +1098,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, +@@ -950,9 +951,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,