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 1B4F0A00C2 for ; Thu, 3 Nov 2022 10:30:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16AEC41156; Thu, 3 Nov 2022 10:30:30 +0100 (CET) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id 990BA40693 for ; Thu, 3 Nov 2022 10:30:28 +0100 (CET) Received: by mail-wm1-f43.google.com with SMTP id m29-20020a05600c3b1d00b003c6bf423c71so2899360wms.0 for ; Thu, 03 Nov 2022 02:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=UT+AAGOzVPSh0dMnJGYsKO8+sIgleAmR+kjyNXdbF2I=; b=Uhk3v1lRFFsoZzIHMJJ3HD4qvdgqEIF+NupaiqIreUEGCpW4A9vQ9OqWj32FccdEgr M16SL4djEqEuALPwmDtx1U7K+so8mw8jRkQOu3nr1iAst3AwrKJHozIcKGop6BvH7R4/ wA9X2It2ecanNjKPxQ0QJ9x8ZWORm2eCGNh7OWzSV90BmXYg94ZE3EEi9yREuAY4Kqd8 bR5tbsIYxQs18/gUBJUvhVqbrxNkoOwIafUxM58O8K1F6jhdUU3JDnKA0P67LiBh5HaD XTpfikHRLC0KYsfv9qPmFA9/bFy/8WfFXPzvxWKSQI0QLv53UPPPvKN1F+2xXjtKBQEk b4Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=UT+AAGOzVPSh0dMnJGYsKO8+sIgleAmR+kjyNXdbF2I=; b=nDls2it3nDw/nOf2ZQa+CcADaYfGt1aH0qz7cA19wt/XlWHB1FP8q89Y7Ip8A5UZru J2tnPikFiT6R2KBiS9ku0h0/094ISKyPRJqvxw8t8dmy2Sj5wKG+u6D1JvZpJL614a2N yVtPISA3ucqCbhmlUP97+PZzM+ghENT8zxwhE948eiDF7Es56M6OYVUZMfF8HNlQD72J gh9o9To1nmJu1VlWaY6XF38n4O5tKkheTtIW7SqADuyR3ABOBUl9/lrRdZdSqLiX0Zxr UpDc6QGIsCuLLfqLddD9maSwOotYa0klQLlWHpgnAVr1DeetlYBZPXtuFaBjQpmM34x2 1jWA== X-Gm-Message-State: ACrzQf0Ius7dZjXp+loIpy5AM45YS3C+TM73A/pW1sp/VFUYDfAhUkjk B/xwBK77pJbij79IdqOh2q8coXine9AJQDqH X-Google-Smtp-Source: AMsMyM540Xb7bgjOErrMDy8P6CaCoY9NdVE9ahQF6uHiyH29q4QyhZlDMJQKej/Kse1v24vzGRwiaw== X-Received: by 2002:a05:600c:2287:b0:3cf:4dfb:c223 with SMTP id 7-20020a05600c228700b003cf4dfbc223mr26448604wmf.19.1667467828279; Thu, 03 Nov 2022 02:30:28 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id l13-20020a05600c2ccd00b003a2f2bb72d5sm5048274wmc.45.2022.11.03.02.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 02:30:27 -0700 (PDT) From: luca.boccassi@gmail.com To: Long Li Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx4: fix Verbs FD leak in secondary process' has been queued to stable release 20.11.7 Date: Thu, 3 Nov 2022 09:27:00 +0000 Message-Id: <20221103092758.1099402-42-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103092758.1099402-1-luca.boccassi@gmail.com> References: <20221103092758.1099402-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.7 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/05/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/b0e08d7e8610334864a1269c2065eedfd96b7429 Thanks. Luca Boccassi --- >From b0e08d7e8610334864a1269c2065eedfd96b7429 Mon Sep 17 00:00:00 2001 From: Long Li Date: Wed, 6 Jul 2022 10:48:52 -0700 Subject: [PATCH] net/mlx4: fix Verbs FD leak in secondary process [ upstream commit ff9c3548c05b356753a4f53bc945c625263c1ee9 ] FDs passed from rte_mp_msg are duplicated to the secondary process and need to be closed. Fixes: 0203d33a10 ("net/mlx4: support secondary process") Signed-off-by: Long Li Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx4/mlx4.c | 9 ++++++--- drivers/net/mlx4/mlx4_mp.c | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index b35372ed64..a5e4205bcd 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -877,6 +877,8 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) snprintf(name, sizeof(name), "%s port %u", mlx4_glue->get_device_name(ibv_dev), port); if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + int fd; + eth_dev = rte_eth_dev_attach_secondary(name); if (eth_dev == NULL) { ERROR("can not attach rte ethdev"); @@ -899,13 +901,14 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) if (err) goto err_secondary; /* Receive command fd from primary process. */ - err = mlx4_mp_req_verbs_cmd_fd(eth_dev); - if (err < 0) { + fd = mlx4_mp_req_verbs_cmd_fd(eth_dev); + if (fd < 0) { err = rte_errno; goto err_secondary; } /* Remap UAR for Tx queues. */ - err = mlx4_tx_uar_init_secondary(eth_dev, err); + err = mlx4_tx_uar_init_secondary(eth_dev, fd); + close(fd); if (err) { err = rte_errno; goto err_secondary; diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c index dd72755252..edc3067c60 100644 --- a/drivers/net/mlx4/mlx4_mp.c +++ b/drivers/net/mlx4/mlx4_mp.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -134,15 +135,19 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) mlx4_tx_uar_uninit_secondary(dev); mlx4_proc_priv_uninit(dev); ret = mlx4_proc_priv_init(dev); - if (ret) + if (ret) { + close(mp_msg->fds[0]); return -rte_errno; + } ret = mlx4_tx_uar_init_secondary(dev, mp_msg->fds[0]); if (ret) { + close(mp_msg->fds[0]); mlx4_proc_priv_uninit(dev); return -rte_errno; } } #endif + close(mp_msg->fds[0]); rte_mb(); mp_init_msg(dev, &mp_res, param->type); res->result = 0; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-03 09:27:27.983075885 +0000 +++ 0042-net-mlx4-fix-Verbs-FD-leak-in-secondary-process.patch 2022-11-03 09:27:25.417423292 +0000 @@ -1 +1 @@ -From ff9c3548c05b356753a4f53bc945c625263c1ee9 Mon Sep 17 00:00:00 2001 +From b0e08d7e8610334864a1269c2065eedfd96b7429 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ff9c3548c05b356753a4f53bc945c625263c1ee9 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index 7e7e1824ef..a54016f4a2 100644 +index b35372ed64..a5e4205bcd 100644 @@ -51 +52 @@ -index 3282afceda..534cb31151 100644 +index dd72755252..edc3067c60 100644 @@ -54 +55,2 @@ -@@ -6,6 +6,7 @@ +@@ -5,6 +5,7 @@ + @@ -56 +57,0 @@ - #include @@ -61,2 +62,2 @@ - #include -@@ -135,15 +136,19 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) + #include +@@ -134,15 +135,19 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)