blocking w/ spinlock or interrupt's disabled
Quoted 9 lines
Quoted 3 lines
enclosed are 163 potential bugs in 2.4.1 where blocking functions are called with either interrupts disabled or a spin lock held. The checker works by:
Here's the file manifest. Apologies.
drivers/atm/idt77105.c
[...]drivers/char/cyclades.c
Unortunately schedule() with disabled interrupts is a feature, it's needed for the old (deprecated and waiting for termination in 2.5) sleep_on() functions.
Is it difficult to split it into "interrupts disabled" and "spin lock held"?
--
Manfred
Quoted 2 lines
Is it difficult to split it into "interrupts disabled" and "spin lock held"?
Nope, since it's already done ;-) The suffix of each error message should say whether it's because you have a spinlock, ints disabled, or both:
2.4.1/drivers/atm/idt77105.c:153:fetch_stats: ERROR:BLOCK:151:153:
calling blocking fn '__constant_copy_to_user' w/ int's disabled
2.4.1/drivers/atm/iphase.c:2426:ia_led_timer: ERROR:BLOCK:2423:2426:
calling blocking fn 'ia_tx_poll' w/ spin lock held
Dawson
In article <001801c0af8e$bda30c10$5517fea9@local>,
Quoted 4 lines · Manfred Spraul
Unortunately
schedule()with disabled interrupts is a feature, it's needed for the old (deprecated and waiting for termination in 2.5)sleep_on()functions.
Yes. But that should only cover "sleep_on()" and it's interruptible cousing "sleep_on_interruptible()". No other blocking call should have interrupts disabled, I would hope.
The special-case is a fairly specific "some old-style drivers avoid race conditions by having interrupts disabled over explicit conditional sleeps", not a generic "you may have interrupts disabled before blocking".
Linus
Quoted 4 lines · Dawson Engler
Quoted 3 lines
Is it difficult to split it into "interrupts disabled" and "spin lock held"?
Is it difficult to test for matching spinlock pairs such as spin_lock_irq/spin_unlock_irq. Sometimes a spin_lock_irq is followed by a spin_unlock and a separate interrupt re-enable. This sort of usage, while not strictly wrong, does make it hard to use the spin_lock/unlock macros to do preemption. This said, pairing information would be very helpful. Note, there are several flavors here, not just the one I cited.
George