On 25-02-2025 04:32 am, Chris Hyser wrote:
From: Sinadin Shan <sinadin.s...@oracle.com>
Sent: Monday, February 24, 2025 7:10 AM
To: Shrikanth Hegde; sh...@kernel.org
Cc: linux-kselft...@vger.kernel.org; linux-kernel@vger.kernel.org; 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");
}


Thanks for the suggestion Chris, this indeed would be a better method and also fit in well with the development workflow. I'll give this a try and send out the updated patch soon.

Regards,
Shan

-chrish


Reply via email to