Commit 7d2d5b81 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

cobalt/timer: allow binding core timers to passive CPUs

Some timers initialized by the Cobalt core may have a valid reason to
live on CPUs excluded from the real-time set. A typical example would
be the host timer from the scheduler slot, which relays ticks to the
regular kernel. Other core timers are just better dealt with when
created and left passive on those CPUs.

Mark all core timers specifically, and exclude them from the LART
detection code in __xntimer_init(). This fixes a spurious Cobalt debug
assertion seen on SMP at boot, when the real-time CPU set is
restricted to a subset of the online CPU set.
parent 5902ea95
......@@ -51,11 +51,13 @@ typedef enum xntmode {
#define XNTIMER_RUNNING 0x00000040
#define XNTIMER_KGRAVITY 0x00000080
#define XNTIMER_UGRAVITY 0x00000100
#define XNTIMER_IGRAVITY 0 /* most conservative */
#define XNTIMER_IGRAVITY 0 /* most conservative */
#define XNTIMER_GRAVITY_MASK (XNTIMER_KGRAVITY|XNTIMER_UGRAVITY)
#define XNTIMER_INIT_MASK (XNTIMER_GRAVITY_MASK|XNTIMER_NOBLCK)
#define __XNTIMER_CORE 0x10000000
/* These flags are available to the real-time interfaces */
#define XNTIMER_SPARE0 0x01000000
#define XNTIMER_SPARE1 0x02000000
......
......@@ -193,11 +193,11 @@ void xnsched_init(struct xnsched *sched, int cpu)
* exit code.
*/
xntimer_init(&sched->htimer, &nkclock, NULL,
sched, XNTIMER_IGRAVITY);
sched, XNTIMER_IGRAVITY|__XNTIMER_CORE);
xntimer_set_priority(&sched->htimer, XNTIMER_LOPRIO);
xntimer_set_name(&sched->htimer, htimer_name);
xntimer_init(&sched->rrbtimer, &nkclock, roundrobin_handler,
sched, XNTIMER_IGRAVITY);
sched, XNTIMER_IGRAVITY|__XNTIMER_CORE);
xntimer_set_name(&sched->rrbtimer, rrbtimer_name);
xntimer_set_priority(&sched->rrbtimer, XNTIMER_LOPRIO);
......@@ -212,7 +212,7 @@ void xnsched_init(struct xnsched *sched, int cpu)
#ifdef CONFIG_XENO_OPT_WATCHDOG
xntimer_init(&sched->wdtimer, &nkclock, watchdog_handler,
sched, XNTIMER_NOBLCK|XNTIMER_IGRAVITY);
sched, XNTIMER_NOBLCK|XNTIMER_IGRAVITY|__XNTIMER_CORE);
xntimer_set_name(&sched->wdtimer, "[watchdog]");
xntimer_set_priority(&sched->wdtimer, XNTIMER_LOPRIO);
#endif /* CONFIG_XENO_OPT_WATCHDOG */
......
......@@ -202,6 +202,8 @@ int __xnthread_init(struct xnthread *thread,
init_completion(&thread->exited);
gravity = flags & XNUSER ? XNTIMER_UGRAVITY : XNTIMER_KGRAVITY;
if (flags & XNROOT)
gravity |= __XNTIMER_CORE;
xntimer_init(&thread->rtimer, &nkclock, timeout_handler,
sched, gravity);
xntimer_set_name(&thread->rtimer, thread->name);
......
......@@ -363,10 +363,13 @@ void __xntimer_init(struct xntimer *timer,
* clock device on the CPU served by the specified
* scheduler slot. This reveals a CPU affinity
* mismatch between the clock hardware and the client
* code initializing the timer.
* code initializing the timer. This check excludes
* core timers which may have their own reason to bind
* to a passive CPU (e.g. host timer).
*/
XENO_WARN_ON_SMP(COBALT, !cpumask_test_cpu(xnsched_cpu(sched),
&clock->affinity));
XENO_WARN_ON_SMP(COBALT, !(flags & __XNTIMER_CORE) &&
!cpumask_test_cpu(xnsched_cpu(sched),
&clock->affinity));
timer->sched = sched;
} else {
cpu = xnclock_get_default_cpu(clock, 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