epoll_pwait06: Skip BPF map file descriptor
PATCH 1/1 epoll_pwait06: Skip BPF map file descriptor
Older kernels don't support waiting for BPF map file descriptors using epoll. Skip the subtest, other file descriptor types are sufficient.
---
epoll_ctl(EPOLL_CTL_ADD) returns EPERM for BPF map file descriptor on kernel v4.12.
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c | 1 + 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c +1 -0
@@ -36,6 +36,7 @@ static void run(void)case TST_FD_DIR :case TST_FD_DEV_ZERO :case TST_FD_PROC_MAPS : +case TST_FD_BPF_MAP :case TST_FD_FSOPEN :case TST_FD_FSPICK :case TST_FD_OPEN_TREE :
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 17 lines
Older kernels don't support waiting for BPF map file descriptors using epoll. Skip the subtest, other file descriptor types are sufficient.
Signed-off-by Martin Doucha <[email protected]>---
epoll_ctl(EPOLL_CTL_ADD)returns EPERM for BPF map file descriptor on kernel v4.12.testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c | 1 + 1 file changed, 1 insertion(+)testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c +0
-0
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c static void run(void) · line 42
Quoted 7 lines
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c +1
-0@@ -36,6 +36,7 @@ static void run(void)case TST_FD_DIR :case TST_FD_DEV_ZERO :case TST_FD_PROC_MAPS : +case TST_FD_BPF_MAP :case TST_FD_FSOPEN :case TST_FD_FSPICK :case TST_FD_OPEN_TREE :
Can we make this kernel version dependent? I do not like disabling tests that work on newer kernels just because it does not work on something that is eight years old.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 17 lines · Cyril Hrubis
Hi!
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c static void run(void) · line 42
Quoted 12 lines
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c +1
-0@@ -36,6 +36,7 @@ static void run(void)case TST_FD_DIR :case TST_FD_DEV_ZERO :case TST_FD_PROC_MAPS : +case TST_FD_BPF_MAP :case TST_FD_FSOPEN :case TST_FD_FSPICK :case TST_FD_OPEN_TREE :Can we make this kernel version dependent? I do not like disabling tests that work on newer kernels just because it does not work on something that is eight years old.
I like kernel version checks even less. I could call epoll_ctl() directly without the safe macro instead and check for EPERM. That's the appropriate feature check.
Signature · 10 lines
Martin Doucha [email protected] SW Quality Engineer SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c +0
-0@@ -36,6 +36,7 @@ static void run(void)case TST_FD_DIR :case TST_FD_DEV_ZERO :case TST_FD_PROC_MAPS :Quoted 8 lines
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c static void run(void) · line 42
Quoted 4 lines
testcases/kernel/syscalls/epoll_pwait/epoll_pwait06.c +1
-0+case TST_FD_BPF_MAP :case TST_FD_FSOPEN :case TST_FD_FSPICK :case TST_FD_OPEN_TREE :Can we make this kernel version dependent? I do not like disabling tests that work on newer kernels just because it does not work on something that is eight years old.
Quoted 3 lines
I like kernel version checks even less. I could call
epoll_ctl()directly without the safe macro instead and check for EPERM. That's the appropriate feature check.
That does not work either. We had patches that were misapplied and broke kernel so that it wrongly returned error instead of the expected operation. Just checking for EPERM would silence such bugs.
In the end I came to a conclusion that the only way how to make sure things are not broken is to expect that certain functionality is present either on CONFIG_ options or if that is not possible on kernel version. It's ugly but that's how things are.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 5 lines · Cyril Hrubis
Hi!
Quoted 3 lines
I like kernel version checks even less. I could call
epoll_ctl()directly without the safe macro instead and check for EPERM. That's the appropriate feature check.
Quoted 8 lines
That does not work either. We had patches that were misapplied and broke kernel so that it wrongly returned error instead of the expected operation. Just checking for EPERM would silence such bugs.
In the end I came to a conclusion that the only way how to make sure things are not broken is to expect that certain functionality is present either on
CONFIG_options or if that is not possible on kernel version. It's ugly but that's how things are.
I'll accept EPERM only for the file descriptor types which are now unconditionally skipped. The only file descriptor type which could then get skipped incorrectly will be BPF. But that's not a problem because verifying epoll support is out of scope of this test. The primary purpose is to verify that small epoll_pwait() timeouts won't get misinterpreted as infinity. In theory, verifying that on a single file descriptor type should be sufficient.
Signature · 10 lines
Martin Doucha [email protected] SW Quality Engineer SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 7 lines
I'll accept EPERM only for the file descriptor types which are now unconditionally skipped. The only file descriptor type which could then get skipped incorrectly will be BPF. But that's not a problem because verifying epoll support is out of scope of this test. The primary purpose is to verify that small
epoll_pwait()timeouts won't get misinterpreted as infinity. In theory, verifying that on a single file descriptor type should be sufficient.
Ah, I had no idea that this is a regression test for a generic epoll code, it never occured to me that we run something like that for all types of file descriptors. For that test it makes sense to just skip unsupported fds.
I guess that we are actually mixing two tests and it would make sense to separate these two. I.e. one that is a regression test for the epoll bug and second, probably called epoll_ctl06.c that would hammer the EPOLL_CTL_ADD with all kinds of fds and expect either success or error.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 14 lines · Cyril Hrubis
Hi!
Quoted 7 lines
I'll accept EPERM only for the file descriptor types which are now unconditionally skipped. The only file descriptor type which could then get skipped incorrectly will be BPF. But that's not a problem because verifying epoll support is out of scope of this test. The primary purpose is to verify that small
epoll_pwait()timeouts won't get misinterpreted as infinity. In theory, verifying that on a single file descriptor type should be sufficient.Ah, I had no idea that this is a regression test for a generic epoll code, it never occured to me that we run something like that for all types of file descriptors. For that test it makes sense to just skip unsupported fds.
Quoted 4 lines
I guess that we are actually mixing two tests and it would make sense to separate these two. I.e. one that is a regression test for the epoll bug and second, probably called
epoll_ctl06.cthat would hammer theEPOLL_CTL_ADDwith all kinds of fds and expect either success or error.
Sure, we can add another test for epoll_ctl() later. I wrote epoll_pwait06 because I actually ran into the timeout regression while playing a game at home. I decided to loop over multiple file descriptor types because it's simple enough and provides better coverage for edge cases.
Now, should I resubmit with that EPERM check or is the one-line fix good enough as is?
Signature · 10 lines
Martin Doucha [email protected] SW Quality Engineer SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis
Reviewed-byHi!
Quoted 8 lines
Sure, we can add another test for
epoll_ctl()later. I wroteepoll_pwait06because I actually ran into the timeout regression while playing a game at home. I decided to loop over multiple file descriptor types because it's simple enough and provides better coverage for edge cases.Now, should I resubmit with that EPERM check or is the one-line fix good enough as is?
Let's go with that for the release as long as you promise to add more tests later.
For the original patch:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Pushed, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp