Message ID | 0744cfd7d2f14d8e8c6d8e74420b35ef273a7737.1593761725.git.viresh.kumar@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | syscalls/sched_rr_get_interval: Validate the timeslice | expand |
Hi Viresh Can we add a linux tag for this case(also a regression test for the before kernel patch). > Validate the timespec returned by sched_rr_get_interval() against the > value read from /proc/sys/kernel/sched_rr_timeslice_ms. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > .../syscalls/sched_rr_get_interval/sched_rr_get_interval01.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > index 31d7b5d56a52..f358c91ac505 100644 > --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > @@ -62,6 +62,7 @@ static void run(void) > tst_ts_get_sec(tp), tst_ts_get_nsec(tp)); > } > > + TST_ASSERT_INT("/proc/sys/kernel/sched_rr_timeslice_ms", tst_ts_to_ms(tp)); > } > > static struct tst_test test = {
On 03-07-20, 15:43, Yang Xu wrote: > Hi Viresh > > Can we add a linux tag for this case(also a regression test for the before kernel patch). Right, so this patch must be tested for kernels >= v3.9. I missed that. This is what you were referring to, right ? What's the regression test you are suggesting here ?
Hi Viresh > On 03-07-20, 15:43, Yang Xu wrote: >> Hi Viresh >> >> Can we add a linux tag for this case(also a regression test for the before kernel patch). > Right, so this patch must be tested for kernels >= v3.9. I missed > that. This is what you were referring to, right ? We only need to check /proc/sys/kernel/sched_rr_timeslice_ms whether existed in setup phase and then check proc value in run like prctl08.c[1]. [1]https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/prctl/prctl08.c > > What's the regression test you are suggesting here ? The following kernel patch. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=975e155ed8732cb81f55c021c441ae662dd040b5 >
On 03-07-20, 16:00, Yang Xu wrote: > We only need to check /proc/sys/kernel/sched_rr_timeslice_ms whether existed in setup phase and > then check proc value in run like prctl08.c[1]. > > [1]https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/prctl/prctl08.c This is certainly better, thanks. > > What's the regression test you are suggesting here ? > > The following kernel patch. > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=975e155ed8732cb81f55c021c441ae662dd040b5 Yeah I got that you were talking about this, but I am not sure of what regression test you are asking for and if we should be adding a test towards it at all as this is a kernel bug and we should keep showing the error for such kernels, isn't it ?
Hi Viresh > Yeah I got that you were talking about this, but I am not sure of what > regression test you are asking for and if we should be adding a test > towards it at all as this is a kernel bug and we should keep showing > the error for such kernels, isn't it ? Yes, we only add a linux tag and comment as below: --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c @@ -5,6 +5,10 @@ * * Gets round-robin time quantum by calling sched_rr_get_interval() and * checks that the value is sane. + * + * It is also a regression test for kernel + * commit 975e155ed873 ("sched/rt: Show the 'sched_rr_timeslice' SCHED_RR + * timeslice tuning knob in milliseconds"). */ #include <sched.h> @@ -53,7 +57,6 @@ static void run(void) tst_res(TFAIL | TTERRNO, "Test Failed, sched_rr_get_interval() returned %ld", TST_RET); } - if (!tst_ts_valid(&tp)) { tst_res(TPASS, "Time quantum %llis %llins", tst_ts_get_sec(tp), tst_ts_get_nsec(tp)); @@ -61,7 +64,7 @@ static void run(void) tst_res(TFAIL, "Invalid time quantum %llis %llins", tst_ts_get_sec(tp), tst_ts_get_nsec(tp)); } - + TST_ASSERT_INT("/proc/sys/kernel/sched_rr_timeslice_ms", tst_ts_to_ms(tp)); } static struct tst_test test = { @@ -69,4 +72,8 @@ static struct tst_test test = { .test_variants = ARRAY_SIZE(variants), .setup = setup, .needs_root = 1, + .tags = (const struct tst_tag[]) { + {"linux-git", "975e155ed873"}, + {} + } }; so run this case without this kernel patch and config_hz=250 fail as below: sched_rr_get_interval01.c:40: INFO: Testing variant: syscall with old kernel spec sched_rr_get_interval01.c:55: PASS: sched_rr_get_interval() passed sched_rr_get_interval01.c:62: PASS: Time quantum 0s 100000000ns sched_rr_get_interval01.c:67: FAIL: /proc/sys/kernel/sched_rr_timeslice_ms != 100 got 25 HINT: You _MAY_ be missing kernel fixes, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=975e155ed873
Hi! > Validate the timespec returned by sched_rr_get_interval() against the > value read from /proc/sys/kernel/sched_rr_timeslice_ms. Looking at centos 6, the older distribution we support, the kernel there is based on 4.15 so we do not have to bother with check if the file is present. But we should really add a tag for the kernel commit that fixed the issue. > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > .../syscalls/sched_rr_get_interval/sched_rr_get_interval01.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > index 31d7b5d56a52..f358c91ac505 100644 > --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c > @@ -62,6 +62,7 @@ static void run(void) > tst_ts_get_sec(tp), tst_ts_get_nsec(tp)); > } > > + TST_ASSERT_INT("/proc/sys/kernel/sched_rr_timeslice_ms", tst_ts_to_ms(tp)); > } > > static struct tst_test test = { > -- > 2.25.0.rc1.19.g042ed3e048af >
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c index 31d7b5d56a52..f358c91ac505 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c @@ -62,6 +62,7 @@ static void run(void) tst_ts_get_sec(tp), tst_ts_get_nsec(tp)); } + TST_ASSERT_INT("/proc/sys/kernel/sched_rr_timeslice_ms", tst_ts_to_ms(tp)); } static struct tst_test test = {
Validate the timespec returned by sched_rr_get_interval() against the value read from /proc/sys/kernel/sched_rr_timeslice_ms. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- .../syscalls/sched_rr_get_interval/sched_rr_get_interval01.c | 1 + 1 file changed, 1 insertion(+)