realtime-tests/rt-numa-ignore-runtime-cpumask-if-a-CPULIST-is-speci.patch
John Kacur c9b4cf7736 rt-tests: cyclictest: Ignore inherited affinity when applying new affinity
cyclictest: Ignore inherited affinity when applying new affinity

- Fix parsing of affinity
- Ignore the runtime cpumask if a new cpumask is requested

Resolves: rhbz#2050244

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-02-03 11:09:26 -05:00

49 lines
1.3 KiB
Diff

From 795433f50f20ef7598db5cfe991b5386e4080d41 Mon Sep 17 00:00:00 2001
From: Marcelo Tosatti <mtosatti@redhat.com>
Date: Fri, 28 Jan 2022 15:39:59 -0300
Subject: [PATCH 2/2] rt-numa: ignore runtime cpumask if -a CPULIST is
specified
When using isolcpus kernel command line option, the CPUs
specified at isolcpus= are not part of the run time environment
cpumask.
This causes "cyclictest -a isolatedcpus" to fail with:
WARN: Couldn't setaffinity in main thread: Invalid argument
FATAL: No allowable cpus to run on
# /dev/cpu_dma_latency set to 0us
To fix this, ignore the runtime cpumask if neither "+", "!"
are specified in the cpu list string.
Suggested by Sebastian Andrzej Siewior.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
v2: fix changelog typo
v3: simplified version (John Kacur)
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/lib/rt-numa.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index ee5ab99684d8..3eead80c3b2b 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -131,7 +131,8 @@ int parse_cpumask(char *str, int max_cpus, struct bitmask **cpumask)
return 0;
}
- use_current_cpuset(max_cpus, mask);
+ if (strchr(str, '!') != NULL || strchr(str, '+') != NULL)
+ use_current_cpuset(max_cpus, mask);
*cpumask = mask;
return 0;
--
2.34.1