FAILED: patch "[PATCH] selftests/timers/posix_timers: Reimplement" failed to apply to 6.6-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 6d029c25b71f2de2838a6f093ce0fa0e69336154
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024041509-triangle-parlor-1783@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 6d029c25b71f2de2838a6f093ce0fa0e69336154 Mon Sep 17 00:00:00 2001
From: Oleg Nesterov <[email protected]>
Date: Tue, 9 Apr 2024 15:38:03 +0200
Subject: [PATCH] selftests/timers/posix_timers: Reimplement
check_timer_distribution()
check_timer_distribution() runs ten threads in a busy loop and tries to test that the kernel distributes a process posix CPU timer signal to every thread over time.
There is not guarantee that this is true even after commit bcb7ee79029d ("posix-timers: Prefer delivery of signals to the current thread") because that commit only avoids waking up the sleeping process leader thread, but that has nothing to do with the actual signal delivery.
As the signal is process wide the first thread which observes sigpending and wins the race to lock sighand will deliver the signal. Testing shows that this hangs on a regular base because some threads never win the race.
The comment "This primarily tests that the kernel does not favour any one." is wrong. The kernel does favour a thread which hits the timer interrupt when CLOCK_PROCESS_CPUTIME_ID expires.
Rewrite the test so it only checks that the group leader sleeping in join() never receives SIGALRM and the thread which burns CPU cycles receives all signals.
In older kernels which do not have commit bcb7ee79029d ("posix-timers:
Prefer delivery of signals to the current thread") the test-case fails immediately, the very 1st tick wakes the leader up. Otherwise it quickly succeeds after 100 ticks.
CI testing wants to use newer selftest versions on stable kernels. In this case the test is guaranteed to fail.
So check in the failure case whether the kernel version is less than v6.3 and skip the test result in that case.
[ tglx: Massaged change log, renamed the version check helper ]
tools/testing/selftests/kselftest.h +13 -0
@@ -51,6 +51,7 @@#include <stdarg.h> #include <string.h> #include <stdio.h> +#include <sys/utsname.h> #endif #ifndef ARRAY_SIZE
@@ -388,4 +389,16 @@ static inline __printf(1, 2) int ksft_exit_skip(const char *msg, ...) exit(KSFT_SKIP); } +static inline int ksft_min_kernel_version (unsigned int min_major, +unsigned int min_minor) +{ +unsigned int major, minor; +struct utsname info; + +if (uname (&info) ||sscanf (info.release,"%u.%u." , &major, &minor) !=2 ) +ksft_exit_fail_msg ("Can't parse kernel version\n" ); + +return major > min_major || (major == min_major && minor >= min_minor); +} +#endif /* __KSELFTEST_H */
tools/testing/selftests/timers/posix_timers.c +47 -56
127 lines not on this page · raw message
PATCH 1/1 selftests/timers/posix_timers: Reimplement check_timer_distribution()
From: Oleg Nesterov <[email protected]>
check_timer_distribution() runs ten threads in a busy loop and tries to test that the kernel distributes a process posix CPU timer signal to every thread over time.
There is not guarantee that this is true even after commit bcb7ee79029d ("posix-timers: Prefer delivery of signals to the current thread") because that commit only avoids waking up the sleeping process leader thread, but that has nothing to do with the actual signal delivery.
As the signal is process wide the first thread which observes sigpending and wins the race to lock sighand will deliver the signal. Testing shows that this hangs on a regular base because some threads never win the race.
The comment "This primarily tests that the kernel does not favour any one." is wrong. The kernel does favour a thread which hits the timer interrupt when CLOCK_PROCESS_CPUTIME_ID expires.
Rewrite the test so it only checks that the group leader sleeping in join() never receives SIGALRM and the thread which burns CPU cycles receives all signals.
In older kernels which do not have commit bcb7ee79029d ("posix-timers:
Prefer delivery of signals to the current thread") the test-case fails immediately, the very 1st tick wakes the leader up. Otherwise it quickly succeeds after 100 ticks.
CI testing wants to use newer selftest versions on stable kernels. In this case the test is guaranteed to fail.
So check in the failure case whether the kernel version is less than v6.3 and skip the test result in that case.
[ tglx: Massaged change log, renamed the version check helper ] [ edliaw: 071af0c9e582 ("selftests: timers: Convert posix_timers test to
generate KTAP output") wasn't merged to 6.6.y, so resolved merge conflicts. ]
--- tools/testing/selftests/kselftest.h | 13 +++ tools/testing/selftests/timers/posix_timers.c | 99 +++++++++---------- 2 files changed, 59 insertions(+), 53 deletions(-)
tools/testing/selftests/kselftest.h +13 -0
@@ -49,6 +49,7 @@#include <unistd.h> #include <stdarg.h> #include <stdio.h> +#include <sys/utsname.h> #endif #ifndef ARRAY_SIZE
@@ -327,4 +328,16 @@ static inline int ksft_exit_skip(const char *msg, ...) exit(KSFT_SKIP); } +static inline int ksft_min_kernel_version (unsigned int min_major, +unsigned int min_minor) +{ +unsigned int major, minor; +struct utsname info; + +if (uname (&info) ||sscanf (info.release,"%u.%u." , &major, &minor) !=2 ) +ksft_exit_fail_msg ("Can't parse kernel version\n" ); + +return major > min_major || (major == min_major && minor >= min_minor); +} +#endif /* __KSELFTEST_H */
tools/testing/selftests/timers/posix_timers.c +46 -53
124 lines not on this page · raw message
Signature · 1 line
2.44.0.769.g3c40516874-goog