On Mon, May 06, 2024 at 06:12:54PM -0700, Jakub Kicinski wrote:
On Mon, 6 May 2024 20:53:22 +0000 Joe Damato 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).
Hm, we get:
# timeout set to 3600 # selftests: net: epoll_busy_poll # TAP version 13 # 1..5 # # Starting 5 tests from 2 test cases. # # RUN invalid_fd.test_invalid_fd ... # # OK invalid_fd.test_invalid_fd # ok 1 invalid_fd.test_invalid_fd # # RUN epoll_busy_poll.test_get_params ... # # OK epoll_busy_poll.test_get_params # ok 2 epoll_busy_poll.test_get_params # # RUN epoll_busy_poll.test_set_invalid ... # # epoll_busy_poll.c:204:test_set_invalid:Expected -1 (-1) == ret (0) # # epoll_busy_poll.c:205:test_set_invalid:EPIOCSPARAMS should error busy_poll_budget > NAPI_POLL_WEIGHT # # epoll_busy_poll.c:207:test_set_invalid:Expected EPERM (1) == errno (22) # # epoll_busy_poll.c:208:test_set_invalid:EPIOCSPARAMS errno should be EPERM busy_poll_budget > NAPI_POLL_WEIGHT # # test_set_invalid: Test failed # # FAIL epoll_busy_poll.test_set_invalid # not ok 3 epoll_busy_poll.test_set_invalid # # RUN epoll_busy_poll.test_set_and_get_valid ... # # OK epoll_busy_poll.test_set_and_get_valid # ok 4 epoll_busy_poll.test_set_and_get_valid # # RUN epoll_busy_poll.test_invalid_ioctl ... # # OK epoll_busy_poll.test_invalid_ioctl # ok 5 epoll_busy_poll.test_invalid_ioctl
https://netdev-3.bots.linux.dev/vmksft-net/results/584001/98-epoll-busy-poll...
Ah, sorry -- this is because I had assumed the test would run without CAP_NET_ADMIN, but since:
epoll_busy_poll.c:204:test_set_invalid:Expected -1 (-1) == ret (0)
succeeds (ret = 0), clearly I am mistaken. Sorry about that.
I think I'll spin up a v3 and I'll add a test with and without CAP_NET_ADMIN to check both cases, which would probably be better anyway.