Skip to contentSkip to conversation

selftest: epoll_busy_poll: epoll busy poll tests

PATCH Applied Joe Damato 2 participants 2 messages May 8, 2024 – May 9, 2024

Subsystems (3)
lore
Share & tools
lore

Joe Damato

author
#0 lore raw

PATCH v3 1/1 selftest: epoll_busy_poll: epoll busy poll tests

Add a simple test for the epoll busy poll ioctls, using the kernel selftest harness.

This test ensures that the ioctls have the expected return codes and that the kernel properly gets and sets epoll busy poll parameters.

The test can be expanded in the future to do real busy polling (provided another machine to act as the client is available).

---
v2 -> v3:
- Added this changelog :)
- Add libcap to LDLIBS.
- Most other changes are in test_set_invalid:
- Check if CAP_NET_ADMIN is set in the effective set before setting busy_poll_budget over NAPI_POLL_WEIGHT. The test which follows assumes CAP_NET_ADMIN.
- Drop CAP_NET_ADMIN from effective set in order to ensure the ioctl fails when busy_poll_budget exceeds NAPI_POLL_WEIGHT.
- Put CAP_NET_ADMIN back into the effective set afterwards.
- Changed self->params.busy_poll_budget from 65535 to UINT16_MAX.
- Changed the cast for params.busy_poll_usecs from unsigned int to uint32_t in the test_set_invalid case.

v1 -> v2:
- Rewrote completely to use kernel self test harness.

 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/Makefile          |   3 +-
 tools/testing/selftests/net/epoll_busy_poll.c | 320 ++++++++++++++++++
 3 files changed, 323 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/net/epoll_busy_poll.c
tools/testing/selftests/net/.gitignore +1 -0
index d996a0ab0765..777cfd027076 100644
@@ -5,6 +5,7 @@ bind_wildcard
 csum
 cmsg_sender
 diag_uid
+epoll_busy_poll
 fin_ack_lat
 gro
 hwtstamp_config
tools/testing/selftests/net/Makefile +2 -1
index 5befca249452..c6112d08b233 100644
@@ -67,7 +67,7 @@ TEST_GEN_FILES += ipsec
 TEST_GEN_FILES += ioam6_parser
 TEST_GEN_FILES += gro
 TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
-TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls tun tap
+TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls tun tap epoll_busy_poll
 TEST_GEN_FILES += toeplitz
 TEST_GEN_FILES += cmsg_sender
 TEST_GEN_FILES += stress_reuseport_listen
@@ -102,6 +102,7 @@ TEST_INCLUDES := forwarding/lib.sh
 
 include ../lib.mk
 
+$(OUTPUT)/epoll_busy_poll: LDLIBS += -lcap
 $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
 $(OUTPUT)/tcp_mmap: LDLIBS += -lpthread -lcrypto
 $(OUTPUT)/tcp_inq: LDLIBS += -lpthread
tools/testing/selftests/net/epoll_busy_poll.c new file +320 -0

320 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Wed, 8 May 2024 18:40:04 +0000 you wrote:

Add a simple test for the epoll busy poll ioctls, using the kernel selftest harness.

This test ensures that the ioctls have the expected return codes and that the kernel properly gets and sets epoll busy poll parameters.

The test can be expanded in the future to do real busy polling (provided another machine to act as the client is available).

[...]

Here is the summary with links:
- [REPOST,net-next,v3] selftest: epoll_busy_poll: epoll busy poll tests

    https://git.kernel.org/netdev/net-next/c/60e0f986e89f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html