Subject: Interrupts, exceptions and modules

From: Rani Assaf <[email-masked]>
Date: Wed, 24 Apr 2002 01:42:17 +0200

Hi,

I  run into  the following  problem when  loading a  module that  uses
interrupts (net driver):

1) Module loads and request_irq()

2) We take an interrupt before doing anything else in the module.
   Our low level IRQ handler (for the RC32300) disables interrupts
   by clearing the IE bit in CP0_STATUS (code based on the various
   implementations of other boards)

3) in handle_IRQ_event() the module handler is called through:
     action->handler(irq, action->dev_id, regs);

4) The processor does an exception (tlb miss/refill) to get the
   page pointed by action->handler.
   At the end of the tlb exception handler, we have an "eret"
   => interrupts are enabled again (IE bit goes to 1)

5) We take another interrupt (because we didn't get into
   the handler to clear the cause yet), in do_IRQ() we see that
   one is already pending => eret

6) goto 5

I had  to disable  interrupts through  CP0_STATUS IM  bits in  the low
level interrupt handler to handle this.  I looked at the code of other
boards and none seemed to do this.

So did  I miss something? Couldn't  this happen to anyone  who loads a
module  and get  the modules's  intialization code  and the  interrupt
handler go into different pages?

Regards,
Rani