Re: [PATCH v2 2/2] selftests: sched: skip cs_prctl_test for systems with core scheduling disabled
From: Chris Hyser
Date: Mon Feb 24 2025 - 18:03:45 EST
>From: Sinadin Shan <sinadin.shan@xxxxxxxxxx>
>Sent: Monday, February 24, 2025 7:10 AM
>To: Shrikanth Hegde; shuah@xxxxxxxxxx
>Cc: linux-kselftest@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Chris Hyser
>Subject: Re: [PATCH v2 2/2] selftests: sched: skip cs_prctl_test for systems with core scheduling disabled
>
>On 24-02-2025 01:49 pm, Shrikanth Hegde wrote:
...
>> If the self-tests are to be used in development flow, these checks may
>> not be sufficient.
>
>Right, this particular case was overlooked. To handle this, the test
>could take a path to the custom config as an argument. I shall work on
>getting this fixed.
I was thinking something along the lines of just calling the prctl.
If you call it and SCHED_CORE is not configured, you will get an EINVAL. Unfortunately,
passing other bad values in the other prctl args will also give an EINVAL, but if you call it with a
non-existent PID (say max_pid + 1) it will generate an ESRCH if the code is present.
So something like (and I'd look up the maxpid on the actual system):
int check_core_sched()
{
ret = prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 32769, PIDTYPE_PID,
(unsigned long)&cookie);
printf("ret = %d\n", ret);
perror("Error:\n");
}
-chrish