Commit 3c76f606 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 a1b47512
...@@ -259,6 +259,11 @@ static inline int xnsched_supported_cpu(int cpu) ...@@ -259,6 +259,11 @@ static inline int xnsched_supported_cpu(int cpu)
return cpumask_test_cpu(cpu, &xnsched_realtime_cpus); 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 */ #else /* !CONFIG_SMP */
static inline void xnsched_set_resched(struct xnsched *sched) static inline void xnsched_set_resched(struct xnsched *sched)
...@@ -273,6 +278,11 @@ static inline int xnsched_supported_cpu(int cpu) ...@@ -273,6 +278,11 @@ static inline int xnsched_supported_cpu(int cpu)
return 1; return 1;
} }
static inline int xnsched_threading_cpu(int cpu)
{
return 1;
}
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
#define for_each_realtime_cpu(cpu) \ #define for_each_realtime_cpu(cpu) \
......
...@@ -897,7 +897,7 @@ static inline bool affinity_ok(struct task_struct *p) /* nklocked, IRQs off */ ...@@ -897,7 +897,7 @@ static inline bool affinity_ok(struct task_struct *p) /* nklocked, IRQs off */
* in secondary mode. If so, do the fixups to reflect the * in secondary mode. If so, do the fixups to reflect the
* change. * change.
*/ */
if (!xnsched_supported_cpu(cpu)) { if (!xnsched_threading_cpu(cpu)) {
/* /*
* The thread is about to switch to primary mode on a * The thread is about to switch to primary mode on a
* non-rt CPU, which is damn wrong and hopeless. * non-rt CPU, which is damn wrong and hopeless.
......
...@@ -622,7 +622,7 @@ int __cobalt_sched_setconfig_np(int cpu, int policy, ...@@ -622,7 +622,7 @@ int __cobalt_sched_setconfig_np(int cpu, int policy,
trace_cobalt_sched_setconfig(cpu, policy, len); 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; return -EINVAL;
if (len == 0) 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