Re: [PATCH v3] sched/core: Fix uclamp ABI bug, clean up and robustify sched_read_attr() ABI logic and code

From: Dietmar Eggemann
Date: Wed Sep 04 2019 - 05:31:35 EST


On 04/09/2019 10:55, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
>> + if (!access_ok(uattr, ksize)
>> return -EFAULT;
>
> How about we pretend that I never sent v2? ;-)
>
> -v3 attached. Build and minimally boot tested.
>
> Thanks,
>
> Ingo
>

This patch fixes the issue (almost).

LTP's sched_getattr01 passes again. But IMHO the prio 'chrt -p $$'
should be 0 instead of -65536.

- tip sched/core (w/ CONFIG_UCLAMP_TASK):

root@juno:/opt/ltp/results# chrt -p $$
chrt: failed to get pid 1635's policy: File too large

Test Start Time: Wed Sep 4 10:17:34 2019
-----------------------------------------
Testcase Result Exit Value
-------- ------ ----------
sched_get_priority_min01 PASS 0
sched_get_priority_min02 PASS 0
sched_getparam01 PASS 0
sched_getparam02 PASS 0
sched_getparam03 PASS 0
sched_rr_get_interval01 PASS 0
sched_rr_get_interval02 PASS 0
sched_rr_get_interval03 PASS 0
sched_setparam01 PASS 0
sched_setparam02 PASS 0
sched_setparam03 PASS 0
sched_setparam04 PASS 0
sched_setparam05 PASS 0
sched_getscheduler01 PASS 0
sched_getscheduler02 PASS 0
sched_setscheduler01 PASS 0
sched_setscheduler02 PASS 0
sched_setscheduler03 PASS 0
sched_yield01 PASS 0
sched_setaffinity01 PASS 0
sched_getaffinity01 PASS 0
sched_setattr01 PASS 0
sched_getattr01 FAIL 1 <---
sched_getattr02 PASS 0

-----------------------------------------------
Total Tests: 24
Total Skipped Tests: 0
Total Failures: 1
Kernel Version: 5.3.0-rc1-00101-g0413d7f33e60
Machine Architecture: aarch64
Hostname: juno

- tip sched/core (w/ CONFIG_UCLAMP_TASK) + patch:

root@juno:~# chrt -p $$
pid 1633's current scheduling policy: SCHED_OTHER
pid 1633's current scheduling priority: -65536 <--- should be 0

Test Start Time: Wed Sep 4 10:22:45 2019
-----------------------------------------
Testcase Result Exit Value
-------- ------ ----------
sched_get_priority_min01 PASS 0
sched_get_priority_min02 PASS 0
sched_getparam01 PASS 0
sched_getparam02 PASS 0
sched_getparam03 PASS 0
sched_rr_get_interval01 PASS 0
sched_rr_get_interval02 PASS 0
sched_rr_get_interval03 PASS 0
sched_setparam01 PASS 0
sched_setparam02 PASS 0
sched_setparam03 PASS 0
sched_setparam04 PASS 0
sched_setparam05 PASS 0
sched_getscheduler01 PASS 0
sched_getscheduler02 PASS 0
sched_setscheduler01 PASS 0
sched_setscheduler02 PASS 0
sched_setscheduler03 PASS 0
sched_yield01 PASS 0
sched_setaffinity01 PASS 0
sched_getaffinity01 PASS 0
sched_setattr01 PASS 0
sched_getattr01 PASS 0 <---
sched_getattr02 PASS 0

-----------------------------------------------
Total Tests: 24
Total Skipped Tests: 0
Total Failures: 0
Kernel Version: 5.3.0-rc1-00102-g80a776a6e3b7
Machine Architecture: aarch64
Hostname: juno