selftests/uevent: increase __UEVENT_BUFFER_SIZE to avoid ENOBUFS on busy systems
PATCH 1/1 selftests/uevent: increase __UEVENT_BUFFER_SIZE to avoid ENOBUFS on busy systems
The kselftests case uevent.uevent_filtering fails reproducibly on busy systems (e.g. Intel EMR / AMD servers) with:
No buffer space available - Failed to receive uevent
The listener binds the NETLINK_KOBJECT_UEVENT socket to all 32 multicast groups (nl_groups = -1) but only sets SO_RCVBUF to 4 KiB (__UEVENT_BUFFER_SIZE = 2048 * 2). On hosts with many devices, the kernel and userspace daemons (udev/systemd) constantly emit uevents on multiple groups, plus the test itself triggers 10 add events in a row. The 4 KiB receive buffer overflows before the listener can drain it, recvmsg() returns -ENOBUFS, and the test bails out as failure.
Increase __UEVENT_BUFFER_SIZE to 1 MiB so the receive buffer is large enough to absorb the burst of uevents on busy systems. After this change the test passes consistently across dozens of runs on Intel EMR and AMD platforms.
--- tools/testing/selftests/uevent/uevent_filtering.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/uevent/uevent_filtering.c +1 -1
@@ -22,7 +22,7 @@#include "kselftest_harness.h" #define __DEV_FULL "/sys/devices/virtual/mem/full/uevent" -#define __UEVENT_BUFFER_SIZE (2048 * 2) +#define __UEVENT_BUFFER_SIZE (1024 * 1024)#define __UEVENT_HEADER "add@/devices/virtual/mem/full"#define __UEVENT_HEADER_LEN sizeof("add@/devices/virtual/mem/full")#define __UEVENT_LISTEN_ALL -1
Signature · 1 line
2.43.7
Quoted 13 lines · On Mon, 8 Jun 2026 13:39:34 +0800 Guixin Liu <[email protected]> wrote:
The kselftests case uevent.uevent_filtering fails reproducibly on busy systems (e.g. Intel EMR / AMD servers) with:
No buffer space available - Failed to receive uevent
The listener binds the
NETLINK_KOBJECT_UEVENTsocket to all 32 multicast groups (nl_groups= -1) but only setsSO_RCVBUFto 4 KiB (__UEVENT_BUFFER_SIZE= 2048 * 2). On hosts with many devices, the kernel and userspace daemons (udev/systemd) constantly emit uevents on multiple groups, plus the test itself triggers 10 add events in a row. The 4 KiB receive buffer overflows before the listener can drain it,recvmsg()returns-ENOBUFS, and the test bails out as failure.
Quoted 5 lines
Increase
__UEVENT_BUFFER_SIZEto 1 MiB so the receive buffer is large enough to absorb the burst of uevents on busy systems. After this change the test passes consistently across dozens of runs on Intel EMR and AMD platforms.
Fair enough.
tools/testing/selftests/uevent/uevent_filtering.c line 28
Quoted 11 lines
tools/testing/selftests/uevent/uevent_filtering.c +1
-1@@ -22,7 +22,7 @@#include "kselftest_harness.h" #define __DEV_FULL "/sys/devices/virtual/mem/full/uevent" -#define __UEVENT_BUFFER_SIZE (2048 * 2) +#define __UEVENT_BUFFER_SIZE (1024 * 1024)#define __UEVENT_HEADER "add@/devices/virtual/mem/full"#define __UEVENT_HEADER_LEN sizeof("add@/devices/virtual/mem/full")#define __UEVENT_LISTEN_ALL -1
scripts/get_maintainer.sh isn't very useful with selftests code. But git-blame can be used to find out who to Cc (hi, Christian!).
Quoted 27 lines · Andrew Morton
Quoted 13 lines · On Mon, 8 Jun 2026 13:39:34 +0800 Guixin Liu <[email protected]> wrote:
The kselftests case uevent.uevent_filtering fails reproducibly on busy systems (e.g. Intel EMR / AMD servers) with:
No buffer space available - Failed to receive uevent
The listener binds the
NETLINK_KOBJECT_UEVENTsocket to all 32 multicast groups (nl_groups= -1) but only setsSO_RCVBUFto 4 KiB (__UEVENT_BUFFER_SIZE= 2048 * 2). On hosts with many devices, the kernel and userspace daemons (udev/systemd) constantly emit uevents on multiple groups, plus the test itself triggers 10 add events in a row. The 4 KiB receive buffer overflows before the listener can drain it,recvmsg()returns-ENOBUFS, and the test bails out as failure.Quoted 5 lines
Increase
__UEVENT_BUFFER_SIZEto 1 MiB so the receive buffer is large enough to absorb the burst of uevents on busy systems. After this change the test passes consistently across dozens of runs on Intel EMR and AMD platforms.Fair enough.
Quoted 5 lines
tools/testing/selftests/uevent/uevent_filtering.c +0
-0@@ -22,7 +22,7 @@#include "kselftest_harness.h"
Quoted 8 lines
tools/testing/selftests/uevent/uevent_filtering.c line 28
Quoted 6 lines
tools/testing/selftests/uevent/uevent_filtering.c +1
-1#define __DEV_FULL "/sys/devices/virtual/mem/full/uevent" -#define __UEVENT_BUFFER_SIZE (2048 * 2) +#define __UEVENT_BUFFER_SIZE (1024 * 1024)#define __UEVENT_HEADER "add@/devices/virtual/mem/full"#define __UEVENT_HEADER_LEN sizeof("add@/devices/virtual/mem/full")#define __UEVENT_LISTEN_ALL -1
scripts/get_maintainer.shisn't very useful with selftests code. But git-blame can be used to find out who to Cc (hi, Christian!).
Got it, thanks.
In addtion, It's nice to get a rb tag.
Best Regards,
Guixin Liu