Module: xenomai-forge Branch: next Commit: 72ab52fb62f9a07d661a51089dec710968a03c0f URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=72ab52fb62f9a07d661a51089dec710968a03c0f
Author: Philippe Gerum <r...@xenomai.org> Date: Sat Feb 8 10:42:14 2014 +0100 cobalt/sched: instantiate scheduler slot for rt-enabled CPUs only 89c3ce894ef introduced a mechanism for preventing passive migrations to non-rt CPUs, so we should not need to instantiate scheduler slots on those. This fixes the panic situation at boot up reported here: http://www.xenomai.org/pipermail/xenomai/2014-February/030136.html --- kernel/cobalt/assert.c | 2 +- kernel/cobalt/init.c | 4 ++-- kernel/cobalt/intr.c | 12 ++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/kernel/cobalt/assert.c b/kernel/cobalt/assert.c index 8032c02..b346b8d 100644 --- a/kernel/cobalt/assert.c +++ b/kernel/cobalt/assert.c @@ -62,7 +62,7 @@ void __xnsys_fatal(const char *format, ...) * NOTE: &nkthreadq can't be empty, we have the root thread(s) * linked there at least. */ - for_each_online_cpu(cpu) { + for_each_realtime_cpu(cpu) { sched = xnsched_struct(cpu); list_for_each_entry(thread, &nkthreadq, glink) { if (thread->sched != sched) diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c index bda790e..9a9da63 100644 --- a/kernel/cobalt/init.c +++ b/kernel/cobalt/init.c @@ -120,7 +120,7 @@ static void sys_shutdown(void) xnsched_run(); - for_each_online_cpu(cpu) { + for_each_realtime_cpu(cpu) { sched = xnsched_struct(cpu); xnsched_destroy(sched); } @@ -318,7 +318,7 @@ static __init int sys_init(void) } xnheap_set_label(&kheap, "main heap"); - for_each_online_cpu(cpu) { + for_each_realtime_cpu(cpu) { sched = &per_cpu(nksched, cpu); xnsched_init(sched, cpu); } diff --git a/kernel/cobalt/intr.c b/kernel/cobalt/intr.c index b162d22..6d533ad 100644 --- a/kernel/cobalt/intr.c +++ b/kernel/cobalt/intr.c @@ -94,18 +94,26 @@ void xnintr_host_tick(struct xnsched *sched) /* Interrupts off. */ */ void xnintr_core_clock_handler(void) { - struct xnsched *sched = xnsched_current(); - int cpu __maybe_unused = xnsched_cpu(sched); + int cpu = ipipe_processor_id(); struct xnirqstat *statp; xnstat_exectime_t *prev; + struct xnsched *sched; +#ifdef CONFIG_SMP + /* + * CAUTION: we do not instantiate scheduler slots for + * unsupported CPUs, so we may NOT dereference + * xnsched_struct() for these. + */ if (!xnsched_supported_cpu(cpu)) { #ifdef XNARCH_HOST_TICK_IRQ ipipe_post_irq_root(XNARCH_HOST_TICK_IRQ); #endif return; } +#endif + sched = xnsched_struct(cpu); statp = __this_cpu_ptr(nktimer.stats); prev = xnstat_exectime_switch(sched, &statp->account); xnstat_counter_inc(&statp->hits); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git