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 38E88A00C2 for ; Thu, 3 Nov 2022 10:30:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3576B40694; Thu, 3 Nov 2022 10:30:31 +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 04A0440693 for ; Thu, 3 Nov 2022 10:30:29 +0100 (CET) Received: by mail-wm1-f43.google.com with SMTP id fn7-20020a05600c688700b003b4fb113b86so746743wmb.0 for ; Thu, 03 Nov 2022 02:30:29 -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=zpMFTqMxAoD+uoHMybgvqSHY7AIcnvBsZoj6iWXOdQw=; b=clnqJghgLeo79PGSJm6aACjbWxgjLPY+rTqW+i+y1GRkqw0M4OVBQkz63dcmGGwpVo 4INIXuiWH3SXzKUMjyIHR7ZJGkqBskXuURHZ8RC+Vs3beyR3dKQ1pnWlHOGZ7LNgynv1 uwu10xdVyEBbtzfjwgf/zaezfhZdueLCrvbTKcjaqRSEtTBTs9ODlveesTU04wpiK+LG 5KbouFxSyCPvpGFrNgb0wZ4xJX8KcTMKbXpBs3z3FbpIKhJwY226wWdZ2jf0FLQe5QPh Tf16sXJEt5rUY0mqrIzI1JuX7wNx0cSwwFqGv+eZGUkNuVT8W3YJXGoXyY042e4+g0kB +uVQ== 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=zpMFTqMxAoD+uoHMybgvqSHY7AIcnvBsZoj6iWXOdQw=; b=lUAgONj1QFHS1K+S25qi2aNNeiFFJcnl2BatVwrxq9uw/mohJKSZITtavdYw7ftKsO +trcgjoXuuEgehshKRqv7aZyvxraybmpueJxlUuZsRyxJesed1mCDf3QZal9mKGMkHQg 2K8vxMBxcUrnHrYhIXI4k2r1yeaqS5BC3LZncPXMrZL+B5heC99h6HKlcMd6M5nW/by0 87xkQpcBA9cNxuf33vwB6pSOXABmkvh7e2AzN/KWfQXm03bqNt0pE5MXaojGpVPNL2l0 T0siP/p42o7XjuLmKrC/FKokQJnRSJ/KKMwxXqb1Mxc0OPNccF4S5D6k29jHmr86F7rk ev9Q== X-Gm-Message-State: ACrzQf38OcIdI6BCB+zz+q/aoVYvDsF84L5K5r3dQYtRNcOpMJjcy9iK /UR1gov2gfRuGG70AmzbQCY= X-Google-Smtp-Source: AMsMyM4r4cwI66X1WmvfbtIKglBnKf7D0jO11zguzQYa0xnJfvp9RCYmUIXanvD9HzYqn2Dls1yNkA== X-Received: by 2002:a05:600c:34ca:b0:3cf:81e8:20e0 with SMTP id d10-20020a05600c34ca00b003cf81e820e0mr7718877wmq.47.1667467829681; Thu, 03 Nov 2022 02:30:29 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id 19-20020a05600c021300b003c6b874a0dfsm761609wmi.14.2022.11.03.02.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 02:30:29 -0700 (PDT) From: luca.boccassi@gmail.com 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 20.11.7 Date: Thu, 3 Nov 2022 09:27:01 +0000 Message-Id: <20221103092758.1099402-43-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/75888970cd5de90d9faec4fa978a8f3d36f18d8b Thanks. Luca Boccassi --- >From 75888970cd5de90d9faec4fa978a8f3d36f18d8b 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 8567e43471..c7272b457b 100644 --- a/drivers/net/mlx5/linux/mlx5_mp_os.c +++ b/drivers/net/mlx5/linux/mlx5_mp_os.c @@ -138,14 +138,18 @@ struct rte_mp_msg mp_res; mlx5_tx_uar_uninit_secondary(dev); 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); res->result = 0; diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 8bd717e6a9..af19b54b7e 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -813,6 +813,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(DEBUG, "naming Ethernet device \"%s\"", name); if (rte_eal_process_type() == RTE_PROC_SECONDARY) { struct mlx5_mp_id mp_id; + int fd; eth_dev = rte_eth_dev_attach_secondary(name); if (eth_dev == NULL) { @@ -836,11 +837,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mp_id.port_id = eth_dev->data->port_id; strlcpy(mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN); /* 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.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-03 09:27:28.035569258 +0000 +++ 0043-net-mlx5-fix-Verbs-FD-leak-in-secondary-process.patch 2022-11-03 09:27:25.417423292 +0000 @@ -1 +1 @@ -From bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 Mon Sep 17 00:00:00 2001 +From 75888970cd5de90d9faec4fa978a8f3d36f18d8b 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 8567e43471..c7272b457b 100644 @@ -23 +24 @@ -@@ -177,14 +177,18 @@ struct rte_mp_msg mp_res; +@@ -138,14 +138,18 @@ struct rte_mp_msg mp_res; @@ -44 +45 @@ -index 4f0a6f4d55..6e5f01dda0 100644 +index 8bd717e6a9..af19b54b7e 100644 @@ -47 +48 @@ -@@ -1080,6 +1080,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, +@@ -813,6 +813,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, @@ -55,3 +56,3 @@ -@@ -1096,11 +1097,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, - return NULL; - mlx5_mp_id_init(&mp_id, eth_dev->data->port_id); +@@ -836,11 +837,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, + mp_id.port_id = eth_dev->data->port_id; + strlcpy(mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN);