From: Attila Fazekas <afazekas@redhat.com>
To: ltp@lists.linux.it
Cc: Attila Fazekas <afazekas@redhat.com>
Subject: [LTP] [PATCH] sched_football: isolcpus handling
Date: Mon, 13 Jan 2025 17:00:40 +0100 [thread overview]
Message-ID: <20250113160040.670737-1-afazekas@redhat.com> (raw)
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.
591c56b045b2d44a0f4ba1a13545420b23e909b5solved was asimilar issue
in realtime/prio-preempt .
Signed-off-by: Attila Fazekas <afazekas@redhat.com>
---
| 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--git a/testcases/realtime/func/sched_football/sched_football.c b/testcases/realtime/func/sched_football/sched_football.c
index 763b41f23..e4ae6a027 100644
--- a/testcases/realtime/func/sched_football/sched_football.c
+++ b/testcases/realtime/func/sched_football/sched_football.c
@@ -133,6 +133,18 @@ void referee(int game_length)
TST_EXP_EXPR(final_ball == 0);
}
+static inline int get_numcpus(void)
+{
+ cpu_set_t mask;
+
+ CPU_ZERO(&mask);
+
+ /* Get the number of cpus accessible to the current process */
+ sched_getaffinity(getpid(), sizeof(mask), &mask);
+
+ return CPU_COUNT(&mask);
+}
+
static void do_test(void)
{
struct sched_param param;
@@ -140,7 +152,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);
--
2.47.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2025-01-13 16:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 16:00 Attila Fazekas [this message]
2025-01-13 22:08 ` [LTP] [PATCH] sched_football: isolcpus handling Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250113160040.670737-1-afazekas@redhat.com \
--to=afazekas@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.