From: Jan Kiszka Subject: [PATCH] cobalt/init: Fail if CPU 0 is missing from real-time CPU mask Message-ID: Date: Mon, 5 Jul 2021 12:31:54 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xenomai From: Jan Kiszka The core assumes in some places that CPU 0 is available for real-time. Therefore fail if the mask is excluding it. Signed-off-by: Jan Kiszka --- kernel/cobalt/init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c index f94943f2d0..5168b56035 100644 --- a/kernel/cobalt/init.c +++ b/kernel/cobalt/init.c @@ -202,6 +202,11 @@ static int __init xenomai_init(void) set_realtime_core_state(COBALT_STATE_DISABLED); return 0; } + if (!cpumask_test_cpu(0, &xnsched_realtime_cpus)) { + printk(XENO_ERR "CPU 0 is missing in real-time CPU mask\n"); + set_realtime_core_state(COBALT_STATE_DISABLED); + return -EINVAL; + } cobalt_cpu_affinity = xnsched_realtime_cpus; #endif /* CONFIG_SMP */ -- 2.26.2