sched_football: isolcpus handling
v2 cover sched_football: isolcpus handling
sched_football expects each player thread is scheduleable to all of the physical CPU threads, however for example when you are using isolcpus by default you threads are not scheduled to some CPU. It leads to the test hangs. 591c56b045b2d44a0f4ba1a13545420b23e909b5 solved was a similar issue in realtime/prio-preempt .
Attila Fazekas (2):
lib: move get_numcpus to librttest.[ch]
sched_football: use get_numcpus()
testcases/realtime/func/prio-preempt/prio-preempt.c | 13 ------------- .../realtime/func/sched_football/sched_football.c | 2 +- testcases/realtime/include/librttest.h | 4 ++++ testcases/realtime/lib/librttest.c | 13 +++++++++++++ 4 files changed, 18 insertions(+), 14 deletions(-)
Signature · 5 lines
2.47.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/2 lib: move get_numcpus to librttest.[ch]
get_numcpus() can be used by other tests therefore it is better to move it to a shared place.
--- testcases/realtime/func/prio-preempt/prio-preempt.c | 13 ------------- testcases/realtime/include/librttest.h | 4 ++++ testcases/realtime/lib/librttest.c | 13 +++++++++++++ 3 files changed, 17 insertions(+), 13 deletions(-)
testcases/realtime/func/prio-preempt/prio-preempt.c +0 -13
@@ -288,19 +288,6 @@ void *master_thread(void *arg)return NULL ; } -int get_numcpus (void ) -{ -long numcpus_conf =sysconf (_SC_NPROCESSORS_CONF); -size_t size =CPU_ALLOC_SIZE (numcpus_conf); -cpu_set_t *cpuset =CPU_ALLOC (numcpus_conf); - -CPU_ZERO_S (size, cpuset); -/* Get the number of cpus accessible to the current process */ -sched_getaffinity (0 , size, cpuset); - -return CPU_COUNT_S (size, cpuset); -} -int main (int argc,char *argv[]) {int pri_boost, numcpus;
testcases/realtime/include/librttest.h +4 -0
@@ -355,4 +355,8 @@ int trace_marker_write(char *buf, int len);*/ int atrace_marker_write (char *tag,char *msg); +/* get_numcpus: get the number of cpus accessible to the current process +*/ +int get_numcpus (void ); +#endif /* LIBRTTEST_H */
testcases/realtime/lib/librttest.c +13 -0
@@ -763,3 +763,16 @@ int atrace_marker_write(char *tag, char *msg)return trace_marker_write (trace_buf,strnlen (trace_buf,TRACE_BUF_LEN )); } + +int get_numcpus (void ) +{ +long numcpus_conf =sysconf (_SC_NPROCESSORS_CONF); +size_t size =CPU_ALLOC_SIZE (numcpus_conf); +cpu_set_t *cpuset =CPU_ALLOC (numcpus_conf); + +CPU_ZERO_S (size, cpuset); +/* Get the number of cpus accessible to the current process */ +sched_getaffinity (0 , size, cpuset); + +return CPU_COUNT_S (size, cpuset); +}
Signature · 5 lines
2.47.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: move get_numcpus to librttest.[ch]
Hi!
testcases/realtime/lib/librttest.c int atrace_marker_write(char *tag, char *msg) · line 778
Quoted 12 lines
testcases/realtime/lib/librttest.c +12
-0+int get_numcpus (void ) +{ +long numcpus_conf =sysconf (_SC_NPROCESSORS_CONF); +size_t size =CPU_ALLOC_SIZE (numcpus_conf); +cpu_set_t *cpuset =CPU_ALLOC (numcpus_conf); + +CPU_ZERO_S (size, cpuset); +/* Get the number of cpus accessible to the current process */ +sched_getaffinity (0 , size, cpuset); + +return CPU_COUNT_S (size, cpuset); +}
Can we please add another patch on the top that adds CPU_FREE() to this function?
For this patch:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/2 sched_football: use get_numcpus()
In reply to Attila Fazekassched_football can hang in systems where not all CPU cores are available, using get_numcpus() to account
for things like isolated cores.
--- testcases/realtime/func/sched_football/sched_football.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/realtime/func/sched_football/sched_football.c +1 -1
@@ -140,7 +140,7 @@ static void do_test(void)int i;if (players_per_team ==0 ) - players_per_team =sysconf (_SC_NPROCESSORS_ONLN); + players_per_team =get_numcpus ();tst_atomic_store (0 , &players_ready);
Signature · 5 lines
2.47.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 2/2] sched_football: use get_numcpus()
Hi!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 2/2] sched_football: use get_numcpus()
Hi Attila, Cyril,
patchset merged, thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 2/2] sched_football: use get_numcpus()
Hi Petr, Cyril,
Thanks!
I have sent a follow up to the CPU_FREE()
https://lists.linux.it/pipermail/ltp/2025-January/041869.html
Best regards,
Attila
Quoted 8 lines · Petr Vorel
Hi Attila, Cyril,
patchset merged, thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp