DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Long Li <longli@microsoft.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org, Randy Tice <rtice@cisco.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Jianfeng Tan <jianfeng.tan@intel.com>,
	Jeff Guo <jia.guo@intel.com>
Subject: [PATCH v5 1/4] eal/linux: filter uevent Netlink in kernel
Date: Wed, 19 Aug 2026 12:08:50 -0700	[thread overview]
Message-ID: <20260819191036.679330-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20260819191036.679330-1-stephen@networkplumber.org>

The EAL uevent only needs/wants messages from the kernel.
Better to let kernel side do the filtering to avoid any overrun
issues in DPDK interrupt thread.

There is no exposed API definition here. The convention
is kernel is 1 and libudev uses 2.

Since kernel is now filtering can remove step in uevent parsing.

Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
Cc: stable@dpdk.org

Reported-by: Randy Tice <rtice@cisco.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 .mailmap                | 1 +
 lib/eal/linux/eal_dev.c | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.mailmap b/.mailmap
index fcb3d1bb3f..9b7713b6df 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1380,6 +1380,7 @@ Ralf Hoffmann <ralf.hoffmann@allegro-packets.com>
 Rami Rosen <ramirose@gmail.com> <rami.rosen@intel.com>
 Rami Rosen <ramirose@gmail.com> <roszenrami@gmail.com>
 Randy Schacher <stuart.schacher@broadcom.com>
+Randy Tice <rtice@cisco.com>
 Rani Sharoni <ranish@nvidia.com>
 Ranjit Menon <ranjit.menon@intel.com>
 Rasesh Mody <rmody@marvell.com> <rasesh.mody@cavium.com>
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..666967667f 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -29,6 +29,9 @@ static bool hotplug_handle;
 #define EAL_UEV_MSG_LEN 4096
 #define EAL_UEV_MSG_ELEM_LEN 128
 
+/* Listen only to messages from kernel (not libudev) */
+#define EAL_UEV_GROUP_KERNEL 1
+
 /*
  * spinlock for device hot-unplug failure handling. If it try to access bus or
  * device, such as handle sigbus on bus or handle memory failure for device
@@ -116,7 +119,7 @@ dev_uev_socket_fd_create(void)
 	memset(&addr, 0, sizeof(addr));
 	addr.nl_family = AF_NETLINK;
 	addr.nl_pid = 0;
-	addr.nl_groups = 0xffffffff;
+	addr.nl_groups = EAL_UEV_GROUP_KERNEL;
 
 	ret = bind(fd, (struct sockaddr *) &addr, sizeof(addr));
 	if (ret < 0) {
@@ -164,9 +167,6 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
 		 * check device uevent from kernel side, no need to check
 		 * uevent from udev.
 		 */
-		if (!strncmp(buf, "libudev", 7)) {
-			return -1;
-		}
 		if (!strncmp(buf, "ACTION=", 7)) {
 			buf += 7;
 			i += 7;
-- 
2.53.0


  reply	other threads:[~2026-08-19 19:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 20:16 [PATCH] eal/linux: harden uevent recv error handling Randy Tice
2026-08-13 22:57 ` Stephen Hemminger
2026-08-17 18:53 ` [PATCH v2] " Randy Tice
2026-08-17 19:23 ` [PATCH v3] " Randy Tice
2026-08-17 20:16 ` [PATCH v4] " Randy Tice
2026-08-18  2:15   ` Stephen Hemminger
2026-08-19 19:08   ` [PATCH v5 0/4] eal: uevent overrun mitigation Stephen Hemminger
2026-08-19 19:08     ` Stephen Hemminger [this message]
2026-08-20  1:38       ` [EXTERNAL] [PATCH v5 1/4] eal/linux: filter uevent Netlink in kernel Long Li
2026-08-19 19:08     ` [PATCH v5 2/4] eal/linux: increase uevent socket buffer Stephen Hemminger
2026-08-20  1:39       ` [EXTERNAL] " Long Li
2026-08-19 19:08     ` [PATCH v5 3/4] eal/linux: report uevent socket overrun Stephen Hemminger
2026-08-20  1:41       ` [EXTERNAL] " Long Li
2026-08-19 19:08     ` [PATCH v5 4/4] doc: add warning about control threads Stephen Hemminger
2026-08-20  0:27     ` [EXTERNAL] [PATCH v5 0/4] eal: uevent overrun mitigation Long Li

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=20260819191036.679330-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=jia.guo@intel.com \
    --cc=jianfeng.tan@intel.com \
    --cc=longli@microsoft.com \
    --cc=rtice@cisco.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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