From: Mingjin Ye <mingjinx.ye@intel.com>
To: dev@dpdk.org
Cc: Mingjin Ye <mingjinx.ye@intel.com>, stable@dpdk.org
Subject: [PATCH v2] bus/vdev: revert fix devargs after multi-process bus scan
Date: Tue, 13 May 2025 09:21:56 +0000 [thread overview]
Message-ID: <20250513092156.1198659-1-mingjinx.ye@intel.com> (raw)
In-Reply-To: <20240314093630.1066948-3-mingjinx.ye@intel.com>
This patch reverts commit f5b2eff0847d ("bus/vdev: fix devargs after
multi-process bus scan")
With current code, we do not add devargs to devargs list when we add a
vdev in secondary process (because `init` flag is set to `false`).
Because of this, when we do vdev_uninit, we call rte_devargs_remove on
the &devargs pointer (the one we didn't add to devargs list but did save
inside rte_vdev_device struct), but in secondary process, because
devargs were not added to the list in the first place, devargs_remove
does not find the associated devargs in its list and therefore does not
free associated resources. As a result, we get a memory leak, because we
free the rte_vdev_device but not its associated devargs.
Revert this patch to avoid leaking devargs on vdev uninit.
Fixes: f5b2eff0847d ("bus/vdev: fix devargs after multi-process bus scan")
Cc: stable@dpdk.org
Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
v2: Modify commit log.
---
drivers/bus/vdev/vdev.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index beee8c4033..7d5f862ff5 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -269,9 +269,7 @@ alloc_devargs(const char *name, const char *args)
}
static int
-insert_vdev(const char *name, const char *args,
- struct rte_vdev_device **p_dev,
- bool init)
+insert_vdev(const char *name, const char *args, struct rte_vdev_device **p_dev)
{
struct rte_vdev_device *dev;
struct rte_devargs *devargs;
@@ -304,8 +302,7 @@ insert_vdev(const char *name, const char *args,
goto fail;
}
- if (init)
- rte_devargs_insert(&devargs);
+ rte_devargs_insert(&devargs);
dev->device.devargs = devargs;
dev->device.name = devargs->name;
TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
@@ -329,7 +326,7 @@ rte_vdev_init(const char *name, const char *args)
int ret;
rte_spinlock_recursive_lock(&vdev_device_list_lock);
- ret = insert_vdev(name, args, &dev, true);
+ ret = insert_vdev(name, args, &dev);
if (ret == 0) {
ret = vdev_probe_all_drivers(dev);
if (ret) {
@@ -456,7 +453,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
break;
case VDEV_SCAN_ONE:
VDEV_LOG(INFO, "receive vdev, %s", in->name);
- ret = insert_vdev(in->name, NULL, NULL, false);
+ ret = insert_vdev(in->name, NULL, NULL);
if (ret == -EEXIST)
VDEV_LOG(DEBUG, "device already exist, %s", in->name);
else if (ret < 0)
--
2.25.1
next prev parent reply other threads:[~2025-05-13 9:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240314093630.1066948-1-mingjinx.ye@intel.com>
2024-03-14 9:36 ` [PATCH 1/3] bus/vdev: revert fix devargs in secondary process Mingjin Ye
2024-06-19 20:12 ` Thomas Monjalon
2024-03-14 9:36 ` [PATCH 2/3] bus/vdev: revert fix devargs after multi-process bus scan Mingjin Ye
2024-06-19 20:15 ` Thomas Monjalon
2024-06-20 6:10 ` Ye, MingjinX
2024-07-11 15:56 ` Burakov, Anatoly
2025-05-13 9:21 ` Mingjin Ye [this message]
2024-03-14 9:36 ` [PATCH 3/3] net/vdev: fix insert vdev core dump Mingjin Ye
2024-03-15 5:51 ` Jiang, YuX
2024-06-19 20:16 ` Thomas Monjalon
2024-06-20 6:41 ` Ye, MingjinX
2024-07-11 16:10 ` Burakov, Anatoly
2024-07-12 2:18 ` Ye, MingjinX
2024-07-12 8:38 ` Burakov, Anatoly
2024-07-16 9:53 ` [PATCH v2] " Mingjin Ye
2024-07-22 12:39 ` Burakov, Anatoly
2024-07-23 15:25 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250513092156.1198659-1-mingjinx.ye@intel.com \
--to=mingjinx.ye@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).