User: Password:
|
|
Subscribe / Log in / New account

Interrupts, threads, and lockdep

Interrupts, threads, and lockdep

Posted Mar 5, 2009 3:08 UTC (Thu) by abatters (✭ supporter ✭, #6932)
Parent article: Interrupts, threads, and lockdep

> Unless a driver passes the IRQF_DISABLED flag when requesting its interrupt line, its interrupt handler will be called with interrupts enabled.

A minor clarification:

According to the Unreliable Guide To Locking, "it is architecture-specific whether all interrupts are disabled inside irq handlers themselves."

http://www.kernel.org/pub/linux/kernel/people/rusty/kerne...

If you use IRQF_DISABLED, then your interrupt handler is guaranteed to be called with interrupts disabled. If you don't use IRQF_DISABLED, then officially it is implementation-specific whether your interrupt handler is called with interrupts enabled or disabled. It is apparent from the rest of the article that the current implementation-specific behavior depends on CONFIG_LOCKDEP.

The important thing to remember when writing interrupt handlers is to use e.g. spin_lock_irqsave() instead of spin_lock_irq() (assuming you need a irq-disabling variant; see the Unreliable Guide To Locking for more details). Then it will work with CONFIG_LOCKDEP=y and CONFIG_LOCKDEP=n and on a wide variety of kernel versions.


(Log in to post comments)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds