simple synchronization questions (freeing on rmmod)

From: David Madore
Date: Thu Sep 15 2005 - 12:04:55 EST


Hi.

I'm trying to learn the rudiments of kernel programming by writing a
simple module (as it turns out, a driver for my motherboard's ECC RAM
controller). The module installs basically three things: an interrupt
handler, a timer (to make sure the controller is checked periodically,
even if it does not generate an interrupt) and a file entry in the
/proc filesystem.

My question is about synchronization when the module is being removed.
To remove the timer, I am told that I must use del_timer_sync()
(rather than just del_timer()) so as to make sure there is no instance
of the timer still running. Now what about the interrupt handler? Is
there a guarantee that after free_irq() there cannot be an instance of
the interrupt handler running on another process? If not, what is the
recommended way to make sure of that before exiting the module?
Lastly, what about the /proc entry? What is the recommended and
reliable way to make sure all open file descriptors pointing to it are
closed before exiting the module?

Thanks for your help,

--
David A. Madore
(david.madore@xxxxxx,
http://www.madore.org/~david/ )
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/