On Monday 22 August 2011 16:09:29 Mark Salter wrote: > diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c > new file mode 100644 > index 0000000..d7bc66f > --- /dev/null > +++ b/arch/c6x/kernel/process.c > > +/* hooks for board specific support */ > +void (*c6x_restart)(void); > +void (*c6x_halt)(void); > +void (*c6x_power_off)(void); > + > +/* > + * power off function, if any > + */ > +void (*pm_power_off)(void); > +EXPORT_SYMBOL(pm_power_off); > + > +/* > + * power management idle function, if any.. > + */ > +void (*pm_idle)(void); > +EXPORT_SYMBOL(pm_idle); You probably don't want two levels of indirection for the power_off callback, so just reassign pm_power_off from a driver when needed. > +static void default_idle(void) > +{ > + asm volatile ("IDLE\n"); > +} > + > +/* > + * The idle loop for C64x > + */ > +void cpu_idle(void) > +{ > + /* endless idle loop with no priority at all */ > + while (1) { > + tick_nohz_stop_sched_tick(1); > + while (!need_resched()) { > + void (*idle)(void); > + > + smp_rmb(); > + idle = pm_idle; > + if (!idle) > + idle = default_idle; > + idle(); > + } > + tick_nohz_restart_sched_tick(); > + > + preempt_enable_no_resched(); > + schedule(); > + preempt_disable(); > + } > +} Hmm, I'm having a small deja-vue here. I think I just commented on the same bug in the hexagon architecture patches ;-) You need to disable all interrupts before checking need_resched() and keep them disabled until returning from the idle function. Otherwise you might not wake up (or wake up late) after an interrupt handler has set need_resched() and waits for interrupts to process while you have entered the idle call. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html