The Interrupt context guidelines – what to do and what not to do section made this clear: when you're in any kind of interrupt (or atomic) context, do not invoke any possibly blocking APIs (that end up calling schedule()); this really boils down to a few key points (as we saw). One is that you should not make any kernel to user space (or vice versa) data transfers; another, if you must allocate memory, do so with the GFP_ATOMIC flag.
This, of course, begs the question: how do I know if my driver (or module) code is currently running in process or interrupt (atomic) context? Furthermore, if it's running in interrupt context, is it in a top or bottom half? The short answer to all this is that the kernel provides several macros that you can use to figure this out. These macros are defined in the linux/preempt.h header. Instead of unnecessarily duplicating information, we...