Re: [PATCH 1/4] Blackfin: arch patch for 2.6.18

Aubrey
2006-09-24T03:35:33Z

On 9/23/06, Arnd Bergmann <arnd@arndb.de> wrote:
> > +static uint32_t reloc_stack_operate(unsigned int oper, struct module *mod)
> > +{
> > + uint32_t value;
> > + switch (oper) {
> > + case R_add:
> > + {
> > + value =
> > + reloc_stack[reloc_stack_tos - 2] +
> > + reloc_stack[reloc_stack_tos - 1];
> > + reloc_stack_tos -= 2;
> > + break;
> > + }
>
> no need for the curly braces here and below

Hmm, but we need one line < 80 columns, don't we?

>
> static inline void default_idle(void)
>
> > +{
> > + while (!need_resched()) {
> > + leds_switch(LED_OFF);
> > + __asm__("nop;\n\t \
> > + nop;\n\t \
> > + nop;\n\t \
> > + idle;\n\t": : :"cc");
> > + leds_switch(LED_ON);
> > + }
> > +}
> > +
>
> This looks racy. What if you get an interrupt after testing need_resched()
> but before the idle instruction?
>
> Normally, this should look like
>
> while(!need_resched()) {
> local_irq_disable();
> if (!need_resched())
> asm volatile("idle");
> local_irq_enable();
> }
>
> Of course that only works if your idle instruction wakes up on pending
> interrupts.

No, that doesn't work on blackfin. Blackfin need interrupt(here is
timer interrupt) to wake up the core from IDLE mode. Once you disable
the interrupt, the core will sleep forever.

-Aubrey