[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211123132907.3138476-4-brauner@kernel.org>
Date: Tue, 23 Nov 2021 14:29:07 +0100
From: Christian Brauner <brauner@...nel.org>
To: Joel Fernandes <joel@...lfernandes.org>,
Chris Hyser <chris.hyser@...cle.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Cc: Peter Collingbourne <pcc@...gle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Mel Gorman <mgorman@...e.de>,
Vincent Guittot <vincent.guittot@...aro.org>,
Juri Lelli <juri.lelli@...hat.com>,
Catalin Marinas <catalin.marinas@....com>,
Ingo Molnar <mingo@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Balbir Singh <sblbir@...zon.com>,
Christian Brauner <christian.brauner@...ntu.com>,
Shuah Khan <shuah@...nel.org>, linux-kselftest@...r.kernel.org
Subject: [RFC PATCH 3/3] tests: add new PR_SCHED_CORE_SHARE test
From: Christian Brauner <christian.brauner@...ntu.com>
Add tests for the new PR_SCHED_CORE_SHARE command.
Cc: Peter Collingbourne <pcc@...gle.com>
Cc: Dietmar Eggemann <dietmar.eggemann@....com>
Cc: Joel Fernandes <joel@...lfernandes.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Mel Gorman <mgorman@...e.de>
Cc: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Chris Hyser <chris.hyser@...cle.com>
Cc: Shuah Khan <shuah@...nel.org>
Cc: Juri Lelli <juri.lelli@...hat.com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Daniel Bristot de Oliveira <bristot@...hat.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Ben Segall <bsegall@...gle.com>
Cc: Balbir Singh <sblbir@...zon.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Cc: linux-kselftest@...r.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
---
tools/testing/selftests/sched/cs_prctl_test.c | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tools/testing/selftests/sched/cs_prctl_test.c b/tools/testing/selftests/sched/cs_prctl_test.c
index 8109b17dc764..985b83fe7221 100644
--- a/tools/testing/selftests/sched/cs_prctl_test.c
+++ b/tools/testing/selftests/sched/cs_prctl_test.c
@@ -229,6 +229,7 @@ int main(int argc, char *argv[])
int pidx;
int pid;
int opt;
+ int i;
while ((opt = getopt(argc, argv, ":hkT:P:d:")) != -1) {
switch (opt) {
@@ -325,6 +326,28 @@ int main(int argc, char *argv[])
validate(get_cs_cookie(pid) != 0);
validate(get_cs_cookie(pid) == get_cs_cookie(procs[pidx].thr_tids[0]));
+ printf("\n## Set a new cookie on a single thread/PR_SCHED_CORE_SCOPE_THREAD [%d]\n", pid);
+ if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_CREATE, pid, PR_SCHED_CORE_SCOPE_THREAD, 0) < 0)
+ handle_error("core_sched create failed -- PR_SCHED_CORE_SCOPE_THREAD");
+ disp_processes(num_processes, procs);
+
+ validate(get_cs_cookie(pid) != get_cs_cookie(procs[pidx].thr_tids[0]));
+
+ printf("\n## Copy cookie from a thread [%d] to [%d] as PR_SCHED_CORE_SCOPE_THREAD\n", pid, procs[pidx].thr_tids[0]);
+ if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE, procs[pidx].thr_tids[0], PR_SCHED_CORE_SCOPE_THREAD, pid) < 0)
+ handle_error("core_sched share cookie from and to thread failed -- PR_SCHED_CORE_SCOPE_THREAD");
+ disp_processes(num_processes, procs);
+
+ validate(get_cs_cookie(pid) == get_cs_cookie(procs[pidx].thr_tids[0]));
+
+ printf("\n## Copy cookie from a thread [%d] to [%d] as PR_SCHED_CORE_SCOPE_THREAD_GROUP\n", pid, pid);
+ if (_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE, pid, PR_SCHED_CORE_SCOPE_THREAD_GROUP, pid) < 0)
+ handle_error("core_sched share cookie from and to thread-group failed -- PR_SCHED_CORE_SCOPE_THREAD_GROUP");
+ disp_processes(num_processes, procs);
+
+ for (i = 0; i < procs[pidx].num_threads; ++i)
+ validate(get_cs_cookie(pid) == get_cs_cookie(procs[pidx].thr_tids[i]));
+
if (errors) {
printf("TESTS FAILED. errors: %d\n", errors);
res = 10;
--
2.30.2
Powered by blists - more mailing lists