]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
run-make-check.sh: build ctest cpu resource pool from sched_getaffinity 69517/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Tue, 16 Jun 2026 06:13:22 +0000 (14:13 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Tue, 16 Jun 2026 10:35:04 +0000 (18:35 +0800)
gen_ctest_resource_file assumed online CPUs are a contiguous 0..nproc-1 range.
When a middle core is hot-offlined (e.g. for a hardware fault), that both hands
out the offline cpu id and drops an online one; crimson seastar unittests feed
the ctest resource id straight to seastar --cpuset, so hitting the offline id
aborts with "Bad value for --cpuset: N not allowed".

Use the CPUs actually schedulable by the process via sched_getaffinity().

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
run-make-check.sh

index 264cac65c18d229f25af36838ff8b1c0157816cf..2c420f3dad12f2aa50f9cd0138c9a6b5d4bb2d4f 100755 (executable)
@@ -24,9 +24,12 @@ set -e
 
 function gen_ctest_resource_file() {
     local file_name=$(mktemp /tmp/ctest-resource-XXXXXX)
-    local max_cpuid=$(($(nproc) - 1))
+    # Usable CPU ids for this process: excludes offline cores and honors cgroup/
+    # taskset limits. Not necessarily contiguous 0..nproc-1, so a crimson seastar
+    # unittest could otherwise get an offline id in --cpuset and abort.
+    local ids=$(python3 -c 'import os; print(*sorted(os.sched_getaffinity(0)))')
     jq -n '$ARGS.positional | map({id:., slots:1}) | {cpus:.} | {version: {major:1, minor:0}, local:[.]}' \
-        --args $(seq 0 $max_cpuid) > $file_name
+        --args $ids > $file_name
     echo "$file_name"
 }