Skip to contentSkip to conversation

selftests: sched: add sched as a default selftest target

PATCH Superseded Sinadin Shan 3 participants 9 messages Feb 19, 2025 – Feb 21, 2025 Kselftest

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: sched: add sched as a default selftest target

The sched tests are missing a target entry and hence out-of-tree build support.

For instance:
make -C tools/testing/selftests install INSTALL_LOCATION=/foo/bar

is expected to build the sched tests and place them at /foo/bar. But this is not observed since a TARGET entry is not present for sched.

This was suggested by Shuah in this conversation

Add support for sched selftests by adding sched as a default TARGET

---
 tools/testing/selftests/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
index 8daac70c2f9d2..e2d0d389ad912 100644
@@ -91,6 +91,7 @@ TARGETS += rlimits
 TARGETS += rseq
 TARGETS += rtc
 TARGETS += rust
+TARGETS += sched
 TARGETS += sched_ext
 TARGETS += seccomp
 TARGETS += sgx
Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines

From: Sinadin Shan <[email protected]>
Sent: Wednesday, February 19, 2025 1:46 AM
To: [email protected]
Cc: [email protected]; [email protected]; Chris Hyser; Sinadin Shan
Subject: [PATCH] selftests: sched: add sched as a default selftest target

The sched tests are missing a target entry and hence out-of-tree build support.

For instance:
make -C tools/testing/selftests install INSTALL_LOCATION=/foo/bar

is expected to build the sched tests and place them at /foo/bar. But this is not observed since a TARGET entry is not present for sched.

Quoted 6 lines

This was suggested by Shuah in this conversation

Add support for sched selftests by adding sched as a default TARGET

#2 lore raw
In reply to Sinadin Shan
Quoted 24 lines · Sinadin Shan

The sched tests are missing a target entry and hence out-of-tree build support.

For instance:
make -C tools/testing/selftests install INSTALL_LOCATION=/foo/bar

is expected to build the sched tests and place them at /foo/bar. But this is not observed since a TARGET entry is not present for sched.

This was suggested by Shuah in this conversation

Add support for sched selftests by adding sched as a default TARGET

---
  tools/testing/selftests/Makefile | 1 +
  1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +0 -0
index 8daac70c2f9d2..e2d0d389ad912 100644

tools/testing/selftests/Makefile TARGETS += rlimits · line 97

Quoted 7 lines
tools/testing/selftests/Makefile +1 -0
@@ -91,6 +91,7 @@ TARGETS += rlimits
  TARGETS += rseq
  TARGETS += rtc
  TARGETS += rust
+TARGETS += sched
  TARGETS += sched_ext
  TARGETS += seccomp
  TARGETS += sgx

There is only one test currently in sched: i.e cs_prctl_test.c. to see the cookies validation when core scheduling is in effect.

If CONFIG_SCHED_CORE=n, the test fails. So you might end up seeing default selftests failing on such systems? or this is only compiling?

Likely the selftests/sched needs to modified for CONFIG_SCHED_CORE=n

When CONFIG_SCHED_CORE=n
./cs_prctl_test

## Create a thread/process/process group hierarchy Not a core sched system
...
Not a core sched system
(283) FAILED: get_cs_cookie(0) == 0

author
#3 lore raw
Quoted 37 lines · Shrikanth Hegde
Quoted 24 lines · Sinadin Shan

The sched tests are missing a target entry and hence out-of-tree build support.

For instance:
make -C tools/testing/selftests install INSTALL_LOCATION=/foo/bar

is expected to build the sched tests and place them at /foo/bar. But this is not observed since a TARGET entry is not present for sched.

This was suggested by Shuah in this conversation

Add support for sched selftests by adding sched as a default TARGET

---
  tools/testing/selftests/Makefile | 1 +

  1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +0 -0
index 8daac70c2f9d2..e2d0d389ad912 100644
@@ -91,6 +91,7 @@ TARGETS += rlimits
Quoted 7 lines

  TARGETS += rseq
  TARGETS += rtc
  TARGETS += rust
+TARGETS += sched
  TARGETS += sched_ext
  TARGETS += seccomp
  TARGETS += sgx

There is only one test currently in sched: i.e cs_prctl_test.c. to see the cookies validation when core scheduling is in effect.

Quoted 1 line

If CONFIG_SCHED_CORE=n, the test fails. So you might end up seeing default selftests failing on such systems? or this is only compiling?>

Yes, this patch would enable the test to be compiled and run by default.

Quoted 1 line

Likely the selftests/sched needs to modified for CONFIG_SCHED_CORE=n

Agree. Chris, I suppose then a graceful skip would be a more right option for kernels with core scheduling disabled?

Regards,
Shan

Quoted 9 lines

When CONFIG_SCHED_CORE=n
./cs_prctl_test

## Create a thread/process/process group hierarchy Not a core sched system
...
Not a core sched system
(283) FAILED: get_cs_cookie(0) == 0

#4 lore raw

From: Sinadin Shan <[email protected]>
Sent: Thursday, February 20, 2025 9:52 AM
To: Shrikanth Hegde; Chris Hyser
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 11 lines · Shrikanth Hegde
Quoted 3 lines

If CONFIG_SCHED_CORE=n, the test fails. So you might end up seeing default selftests failing on such systems? or this is only compiling?>

Yes, this patch would enable the test to be compiled and run by default.

Quoted 1 line

Likely the selftests/sched needs to modified for CONFIG_SCHED_CORE=n

Agree. Chris, I suppose then a graceful skip would be a more right option for kernels with core scheduling disabled?

By graceful skip, do you mean a 0 return code and not printing failure? I confess, I originally wrote the test as stand-alone for me to get the prctl code right and it got shoved in here.

I guess my question is what if SCHED_CORE was supposed to be configed into the test kernel? Silently burying the error might be bad. I'm not strongly tied to that, just looking for opinions. At the same time, if you put the orig change in, people w/o SCHED_CORE on will start seeing "failures" they didn't see before, yes? and that seems bad.

I'm happy to make this better behaved. I'm the reason it is the way it is.

-chrish

author
#5 lore raw
Quoted 13 lines · Chris Hyser

From: Sinadin Shan <[email protected]>
Sent: Thursday, February 20, 2025 9:52 AM
To: Shrikanth Hegde; Chris Hyser
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 7 lines · Shrikanth Hegde
Quoted 3 lines

If CONFIG_SCHED_CORE=n, the test fails. So you might end up seeing default selftests failing on such systems? or this is only compiling?>

Yes, this patch would enable the test to be compiled and run by default.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Likely the selftests/sched needs to modified for CONFIG_SCHED_CORE=n

Agree. Chris, I suppose then a graceful skip would be a more right option for kernels with core scheduling disabled?

By graceful skip, do you mean a 0 return code and not printing failure? I confess, I originally wrote the test as stand-alone for me to get the prctl code right and it got shoved in here.

By graceful skip, I meant printing that SCHED_CORE is disabled for the kernel and exiting with a return code 4 on such kernels. This would also make the kselftest framework pick up the skip, say when compiled tests are run through run_kselftest.sh

Quoted 6 lines

I guess my question is what if SCHED_CORE was supposed to be configed into the test kernel? Silently burying the error might be bad. I'm not strongly tied to that, just looking for opinions. At the same time, if you put the orig change in, people w/o SCHED_CORE on will start seeing "failures" they didn't see before, yes? and that seems bad.

Yes, that seems bad as rightly pointed out by Shrikant. I have a patch that does the above mentioned skip, and if skipping is a right option to take here I can send it in the next version.

Regards,
Shan

Quoted 6 lines

I'm happy to make this better behaved. I'm the reason it is the way it is.

-chrish

#6 lore raw

From: Sinadin Shan <[email protected]>
Sent: Thursday, February 20, 2025 11:23 AM
To: Chris Hyser; Shrikanth Hegde
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 9 lines
Quoted 5 lines

I guess my question is what if SCHED_CORE was supposed to be configed into the test kernel? Silently burying the error might be bad. I'm not strongly tied to that, just looking for opinions. At the same time, if you put the orig change in, people w/o SCHED_CORE on will start seeing "failures" they didn't see before, yes? and that seems bad.

Yes, that seems bad as rightly pointed out by Shrikant. I have a patch that does the above mentioned skip, and if skipping is a right option to take here I can send it in the next version.

If that is the plan, I prefer to fix it myself.

-chrish

#7 lore raw

From: Chris Hyser <[email protected]>
Sent: Thursday, February 20, 2025 11:21 PM
To: Sinadin Shan; Shrikanth Hegde
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 13 lines

From: Sinadin Shan <[email protected]>
Sent: Thursday, February 20, 2025 11:23 AM
To: Chris Hyser; Shrikanth Hegde
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 6 lines
Quoted 5 lines

I guess my question is what if SCHED_CORE was supposed to be configed into the test kernel? Silently burying the error might be bad. I'm not strongly tied to that, just looking for opinions. At the same time, if you put the orig change in, people w/o SCHED_CORE on will start seeing "failures" they didn't see before, yes? and that seems bad.

Quoted 5 lines
Quoted 3 lines

Yes, that seems bad as rightly pointed out by Shrikant. I have a patch that does the above mentioned skip, and if skipping is a right option to take here I can send it in the next version.

If that is the plan, I prefer to fix it myself.

Ok. Here is a better plan. I suspected there must be some convention for all these tests (that you are obviously familiar with), I just feel bad for how this test originally got jammed in here. If you already have a patch, we should just go with that and yes adding that code seems like the exact right thing to do.

-chrish

author
#8 lore raw
Quoted 22 lines · Chris Hyser

From: Chris Hyser <[email protected]>
Sent: Thursday, February 20, 2025 11:21 PM
To: Sinadin Shan; Shrikanth Hegde
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 17 lines

From: Sinadin Shan <[email protected]>
Sent: Thursday, February 20, 2025 11:23 AM
To: Chris Hyser; Shrikanth Hegde
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] selftests: sched: add sched as a default selftest target

Quoted 9 lines
Quoted 5 lines

I guess my question is what if SCHED_CORE was supposed to be configed into the test kernel? Silently burying the error might be bad. I'm not strongly tied to that, just looking for opinions. At the same time, if you put the orig change in, people w/o SCHED_CORE on will start seeing "failures" they didn't see before, yes? and that seems bad.

Yes, that seems bad as rightly pointed out by Shrikant. I have a patch that does the above mentioned skip, and if skipping is a right option to take here I can send it in the next version.

Quoted 7 lines
Quoted 1 line

If that is the plan, I prefer to fix it myself.

Ok. Here is a better plan. I suspected there must be some convention for all these tests (that you are obviously familiar with), I just feel bad for how this test originally got jammed in here. If you already have a patch, we should just go with that and yes adding that code seems like the exact right thing to do.

Thanks Chris, I shall send the new patch.

-Shan

Quoted 2 lines

-chrish