]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rtla/tests: Add runtime tests for -C/--cgroup
authorTomas Glozar <tglozar@redhat.com>
Thu, 23 Apr 2026 13:05:58 +0000 (15:05 +0200)
committerTomas Glozar <tglozar@redhat.com>
Mon, 18 May 2026 09:00:52 +0000 (11:00 +0200)
Add a new script check-cgroup-match.sh that retrieves the cgroup of the
main rtla process and compares it to the cgroup of the rtla workload
threads.

Add a new test based on this script, for both osnoise and timerlat
tools, testing the variant of -C without argument (which sets the cgroup
of the workload to the cgroup of the rtla main process).

Note that this has to be tested in kernel mode to be significant for
timerlat tool, as user workloads inherit the parent rtla process cgroup
even without the option.

Reviewed-by: Wander Lairson Costa <wander@redhat.com>
Link: https://lore.kernel.org/r/20260423130558.882022-10-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
tools/tracing/rtla/tests/osnoise.t
tools/tracing/rtla/tests/scripts/check-cgroup-match.sh [new file with mode: 0755]
tools/tracing/rtla/tests/timerlat.t

index d0b623233db5f9339e01a2d0b9440ca9bd0aa953..06787471d0e8c7437c5f6eeee9628b9701362502 100644 (file)
@@ -18,6 +18,9 @@ check_top_q_hist "verify the --trace param" \
 check_top_q_hist "verify the --priority/-P param" \
        "osnoise TOOL -P F:1 -c 0 -r 900000 -d 10s -S 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh SCHED_FIFO 1\"" \
        2 "Priorities are set correctly"
+check_top_q_hist "verify the -C/--cgroup param" \
+       "osnoise TOOL -C -c 0 -r 900000 -d 10s -S 1 --on-threshold shell,command=\"tests/scripts/check-cgroup-match.sh\"" \
+       2 "cgroup matches for all workload PIDs"
 check_top_q_hist "verify the -c/--cpus param" \
        "osnoise TOOL -P F:1 -c 0 -r 900000 -d 10s -S 1 --on-threshold shell,command=tests/scripts/check-cpus.sh" 2 "^Affinity of threads: 0$"
 check_top_q_hist "verify the -H/--house-keeping param" \
diff --git a/tools/tracing/rtla/tests/scripts/check-cgroup-match.sh b/tools/tracing/rtla/tests/scripts/check-cgroup-match.sh
new file mode 100755 (executable)
index 0000000..fdc2c68
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+. "$(dirname $0)/lib/get_workload_pids.sh"
+rtla_pid=$(echo $(ps -o ppid= $$))
+rtla_cgroup=$(</proc/$rtla_pid/cgroup)
+echo "RTLA cgroup: $rtla_cgroup"
+for pid in $(get_workload_pids)
+do
+    pid_cgroup=$(</proc/$pid/cgroup)
+    echo "PID $pid cgroup: $pid_cgroup"
+    if ! [ "$pid_cgroup" = "$rtla_cgroup" ]
+    then
+        echo "Mismatch!"
+        exit 0
+    fi
+done
+echo "cgroup matches for all workload PIDs"
index 3557adbdebaeee05da2449f91ebe7767b72efe87..3ebfe316b39e9260966de94ff551dfdc25cea0e9 100644 (file)
@@ -43,6 +43,9 @@ check_top_hist "disable auto-analysis" \
 check_top_hist "verify -P/--priority" \
        "timerlat TOOL -P F:1 -c 0 -d 10s -T 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh SCHED_FIFO 1\"" \
        2 "Priorities are set correctly"
+check_top_hist "verify -C/--cgroup" \
+       "timerlat TOOL -k -C -c 0 -d 10s -T 1 --on-threshold shell,command=\"tests/scripts/check-cgroup-match.sh\"" \
+       2 "cgroup matches for all workload PIDs"
 check_top_q_hist "verify -c/--cpus" \
        "timerlat TOOL -c 0 -d 10s -T 1 --on-threshold shell,command=tests/scripts/check-cpus.sh" 2 "^Affinity of threads: 0$"
 check_top_q_hist "verify -H/--house-keeping" \