diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-05-11 01:22:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 11:29:34 -0400 |
commit | 2d3fbbb391e280724f7f7804ab00ff61cf1b6a4c (patch) | |
tree | 218b942ae24cd22c7b8309a650d3e7273db3796c | |
parent | e1fa2e136ff64a3814a98c03d46320b9e80d29c8 (diff) |
Add hard_irq_disable()
Some architectures, like powerpc, implement lazy disabling of interrupts.
That means that on those, local_irq_disable() doesn't actually disable
interrupts on the CPU, but only sets some per CPU flag which cause them to be
disabled only if an interrupt actually occurs.
However, in some cases, such as stop_machine, we really want interrupts to be
fully disabled. For example, I have code using stop machine to do ECC error
injection, used to verify operations of the ECC hardware, that sort of thing.
It really needs to make sure that nothing is actually writing to memory while
the injection happens. Similar examples can be found in other low level bits
and pieces.
This patch implements a generic hard_irq_disable() function which is meant to
be called -after- local_irq_disable() and ensures that interrupts are fully
disabled on that CPU. The default implementation is a nop, though powerpc
does already provide an appropriate one.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/interrupt.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index f7b01b9a35b3..5323f6275854 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -241,6 +241,16 @@ static inline void __deprecated save_and_cli(unsigned long *x) | |||
241 | #define save_and_cli(x) save_and_cli(&x) | 241 | #define save_and_cli(x) save_and_cli(&x) |
242 | #endif /* CONFIG_SMP */ | 242 | #endif /* CONFIG_SMP */ |
243 | 243 | ||
244 | /* Some architectures might implement lazy enabling/disabling of | ||
245 | * interrupts. In some cases, such as stop_machine, we might want | ||
246 | * to ensure that after a local_irq_disable(), interrupts have | ||
247 | * really been disabled in hardware. Such architectures need to | ||
248 | * implement the following hook. | ||
249 | */ | ||
250 | #ifndef hard_irq_disable | ||
251 | #define hard_irq_disable() do { } while(0) | ||
252 | #endif | ||
253 | |||
244 | /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high | 254 | /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high |
245 | frequency threaded job scheduling. For almost all the purposes | 255 | frequency threaded job scheduling. For almost all the purposes |
246 | tasklets are more than enough. F.e. all serial device BHs et | 256 | tasklets are more than enough. F.e. all serial device BHs et |