Re: Interrupts in modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 21 Jul 2001 23:02:53 +0100, 
Steve Papacharalambous <stevep@lineo.com> wrote:
>Are there any limitations or precautions needed with interrupt handlers
>in loadable modules?

There is a potential race condition when removing the module.  rmmod
will remove a module when its use count is zero.  If the interrupt
handler is invoked after the use count is tested but before the module
cleanup routine is entered then the code can be removed while the
interrupt handler is running.  The 2.5 module load/unload system will
remove this race.

In 2.4, your best option is to set a can_unload() function in the
module.  Unregister the interrupt handler in can_unload(), wait until
the interrupt count goes to zero (might be running on another cpu) then
return 0.  See drivers/char/ftape/compressor/zftape-compress.c for an
example.

Alternatively keep a use count for opens on the device.  This assumes
that the device does not generate interrupts while it is not open, not
always true.



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux