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 C8BDDA0544 for ; Fri, 11 Nov 2022 12:40:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4D93410F2; Fri, 11 Nov 2022 12:40:26 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id BBE2542B7E for ; Fri, 11 Nov 2022 12:40:25 +0100 (CET) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (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 smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 4F0A83F0C8 for ; Fri, 11 Nov 2022 11:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668166825; bh=A0Oq5kUndAWTp1aB7NrViPxWq+ZkuWJYsqqj1UwNSFE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Qtgw1SX0onbs3bdu8GIN+uKqvC1Ab67pKtlpaKn/PG4hFfQIDOVVT9lALNC+CngP+ s3twynMdo4LhtUYPJXS++GD49pEh7lv06CEvdLdS5Il/A/U0U2ebqkISTc1ijlXNVj sEsLwIlBzI4yQl9IFlYmt0Af0RoVvWUg+LzgabOllxbh9lyyotJMMDXQL9RfFfZ+6m hW/27gKnuoGvkgAEK6swrOxaML/wqcVxgpDaKCUgdnJrvnjP9sfugzzaNMSz3CRgAw +3YJV+98FN4IGt+tRo7Rm5XSIa2YOTOKH9tssR/vuJU115DxdZgyELEURGCjrvytDG t5Whk0gxt1OGQ== Received: by mail-ej1-f70.google.com with SMTP id hq18-20020a1709073f1200b007ade8dd3494so2886038ejc.2 for ; Fri, 11 Nov 2022 03:40:25 -0800 (PST) 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=A0Oq5kUndAWTp1aB7NrViPxWq+ZkuWJYsqqj1UwNSFE=; b=dmrF3kfJk8k46dQD+F4Ud79/H4jmZRfqSf+2VfsOCNO/2LAc4DSjcOqXPoz5APaAQ9 kxMIlBT2i2VTqyD7uxp+mBxEjsxJhAN0wiMmmZjx/JgfZWRYB7u7PmJxlfWa66UOBY0B MfkPgeAMj5NQGDp9kd9t/gjdMTLQbUaAsg+aLiZ5QO1IhX7Yw4oREe7jvIXADBuaoS2V VcekzeYsU8j9ZhcpqTL6gjs0GJi1z9bQFKuky/EjSO7VmP51S8lcAG4KiI5iz7BRI527 cjTIoO2TLmY4jTTFcIAZUkq1Ke2v8A6Cuflm7WmaoMEBIQTR3tAdAZ6QK72RFkNOHDHj tadg== X-Gm-Message-State: ANoB5plnhBWw/syWBLQdaefbW6qx2yXX6KIHAHHpWSWs0CVKpXUsqrWL 16DUFnpLSlvKDx/uojYO53M0cp9CrDQjMQYqCWwLbGEasjqBEQFaC6h+HaIyVNenxS+ff+4H/jB guBz3AKQ2IFzBkT8ZB03NYF+w X-Received: by 2002:a05:6402:381b:b0:456:d9f9:8f3a with SMTP id es27-20020a056402381b00b00456d9f98f3amr1108006edb.258.1668166824962; Fri, 11 Nov 2022 03:40:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf6J1POjVB/hPneh2Z5Ef726fMLCh921UdiwLboi0e77FE92cCAx9MFISq5w6jR6OwFSRdOGiA== X-Received: by 2002:a05:6402:381b:b0:456:d9f9:8f3a with SMTP id es27-20020a056402381b00b00456d9f98f3amr1107995edb.258.1668166824759; Fri, 11 Nov 2022 03:40:24 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39af:c100:1891:6c61:50fd:e567]) by smtp.gmail.com with ESMTPSA id n23-20020a170906701700b0078db18d7972sm777713ejj.117.2022.11.11.03.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 03:40:23 -0800 (PST) From: christian.ehrhardt@canonical.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 19.11.14 Date: Fri, 11 Nov 2022 12:38:40 +0100 Message-Id: <20221111113904.1549618-23-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221111113904.1549618-1-christian.ehrhardt@canonical.com> References: <20221111113904.1549618-1-christian.ehrhardt@canonical.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 19.11.14 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/18/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/10485ca54510fd486c40207e891070e47efcea36 Thanks. Christian Ehrhardt --- >From 10485ca54510fd486c40207e891070e47efcea36 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 8397f408f4..ec607c8770 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -880,6 +880,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"); @@ -902,13 +904,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 1e9b4de500..32369e81e4 100644 --- a/drivers/net/mlx4/mlx4_mp.c +++ b/drivers/net/mlx4/mlx4_mp.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -135,15 +136,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.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-11 12:35:05.613617706 +0100 +++ 0023-net-mlx4-fix-Verbs-FD-leak-in-secondary-process.patch 2022-11-11 12:35:04.765192018 +0100 @@ -1 +1 @@ -From ff9c3548c05b356753a4f53bc945c625263c1ee9 Mon Sep 17 00:00:00 2001 +From 10485ca54510fd486c40207e891070e47efcea36 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 8397f408f4..ec607c8770 100644 @@ -23 +24 @@ -@@ -877,6 +877,8 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +@@ -880,6 +880,8 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) @@ -32 +33 @@ -@@ -899,13 +901,14 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +@@ -902,13 +904,14 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) @@ -51 +52 @@ -index 3282afceda..534cb31151 100644 +index 1e9b4de500..32369e81e4 100644 @@ -54,0 +56 @@ + #include @@ -56 +57,0 @@ - #include @@ -61 +62 @@ - #include + #include