Commit 64f207dc authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/sched: fix mismatches between supported CPUs and affinity set

xnsched_realtime_cpus is a misnomer defining the set of CPUs which may
handle timer events.

cobalt_cpu_affinity is a subset of xnsched_realtime_cpus which defines
which CPU(s) may run Cobalt threads.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 92862858
......@@ -235,6 +235,11 @@ static inline int xnsched_supported_cpu(int cpu)
return cpumask_test_cpu(cpu, &xnsched_realtime_cpus);
}
static inline int xnsched_threading_cpu(int cpu)
{
return cpumask_test_cpu(cpu, &cobalt_cpu_affinity);
}
#else /* !CONFIG_SMP */
static inline void xnsched_set_resched(struct xnsched *sched)
......@@ -249,6 +254,11 @@ static inline int xnsched_supported_cpu(int cpu)
return 1;
}
static inline int xnsched_threading_cpu(int cpu)
{
return 1;
}
#endif /* !CONFIG_SMP */
#define for_each_realtime_cpu(cpu) \
......
......@@ -892,7 +892,7 @@ static inline bool affinity_ok(struct task_struct *p) /* nklocked, IRQs off */
* in secondary mode. If so, do the fixups to reflect the
* change.
*/
if (!xnsched_supported_cpu(cpu)) {
if (!xnsched_threading_cpu(cpu)) {
/*
* The thread is about to switch to primary mode on a
* non-rt CPU, which is damn wrong and hopeless.
......
......@@ -622,7 +622,7 @@ int __cobalt_sched_setconfig_np(int cpu, int policy,
trace_cobalt_sched_setconfig(cpu, policy, len);
if (cpu < 0 || cpu >= NR_CPUS || !xnsched_supported_cpu(cpu))
if (cpu < 0 || cpu >= NR_CPUS || !xnsched_threading_cpu(cpu))
return -EINVAL;
if (len == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment