Re: Why can't we sleep in an ISR?



On 5/14/07, Learning Linux <learninglinux4@xxxxxxxxx> wrote:
Ok, but how about an ISR, that does not take any locks? Why can't we
sleep in SUCH an ISR?
LL
-

The killer reason why you can't sleep in an interrupt is because an
interrupt is not associated with any context in the first place. What
is a context, then? It is the state information for a process. This
includes the kernel and userspace stack pointers, the register set,
and the page tables for that process. The scheduler has access to all
this information, to preempt one process and run another. Contrary to
this, an interrupt, depending on the version of your kernel and arch,
uses a separate irq stack or the kernel stack of the interrupted
process. An irq is not a context but merely a temporary execution to
be concluded asap.

Hope this helps,
Bahadir
-
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/



Relevant Pages

  • Re: Interrupt context...
    ... > gone through most of the posts on interrupt in usenet. ... > kernel stack and ISR is executed. ... More may be saved depending on the architecture. ... Here the kernel have assembler code to save all general ...
    (comp.os.linux.development.system)
  • Re: interrupt routine and application pages
    ... application stack in the interrupt context. ... are still in the context of interrupted thread. ... your code runs at raised IRQL, Memory Manager just had no chance to ...
    (microsoft.public.development.device.drivers)
  • Re: VxWorks Interrupts
    ... Where could find the memory map when VxWorks is running or booting... ... That's where the ISR_STACK_SIZE is set for the kernel. ... Some of this gets changed for cpu's that don't have interrupt stacks, ... and gets permuted for cpu's where the stack grows upwards toward higher ...
    (comp.os.vxworks)
  • Re: Questions regarding Synchronisation in Windows (Spinlocks)
    ... Vista/Longhorn now only ship multiprocessor kernel. ... Interrupts are handled in context of ISR. ... Since Spinlocks execute at DPC/Dispatch level, there is no way for the ... But an interrupt occurs which has an IRQL> DPC Dispatch level OR the ...
    (microsoft.public.win32.programmer.kernel)
  • x86_64 kernel stack organization
    ... I could not find a document that described the x86_64 kernel stack ... Interrupt stack. ... Used for external hardware interrupts. ...
    (Linux-Kernel)