From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: <linux-kernel@vger.kernel.org>, <linuxppc-dev@ozlabs.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Rusty Russell <rusty@rustcorp.com.au>
Subject: [PATCH 2/3] Add hard_irq_disable()
Date: Thu, 10 May 2007 15:25:58 +1000 [thread overview]
Message-ID: <20070510052622.3E8D5DDF4B@ozlabs.org> (raw)
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>
include/linux/interrupt.h | 10 ++++++++++
1 file changed, 10 insertions(+)
Index: linux-cell/include/linux/interrupt.h
===================================================================
--- linux-cell.orig/include/linux/interrupt.h 2007-05-10 14:51:22.000000000 +1000
+++ linux-cell/include/linux/interrupt.h 2007-05-10 15:18:04.000000000 +1000
@@ -241,6 +241,16 @@ static inline void __deprecated save_and
#define save_and_cli(x) save_and_cli(&x)
#endif /* CONFIG_SMP */
+/* Some architectures might implement lazy enabling/disabling of
+ * interrupts. In some cases, such as stop_machine, we might want
+ * to ensure that after a local_irq_disable(), interrupts have
+ * really been disabled in hardware. Such architectures need to
+ * implement the following hook.
+ */
+#ifndef hard_irq_disable
+#define hard_irq_disable() do { } while(0)
+#endif
+
/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
frequency threaded job scheduling. For almost all the purposes
tasklets are more than enough. F.e. all serial device BHs et
next reply other threads:[~2007-05-10 5:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-10 5:25 Benjamin Herrenschmidt [this message]
2007-05-10 5:41 ` [PATCH 2/3] Add hard_irq_disable() Andrew Morton
2007-05-10 6:35 ` Benjamin Herrenschmidt
2007-05-10 7:35 ` Andrew Morton
2007-05-10 8:41 ` Benjamin Herrenschmidt
2007-05-10 8:49 ` David Miller
2007-05-10 8:50 ` Andrew Morton
2007-05-10 8:53 ` David Miller
2007-05-10 9:29 ` Benjamin Herrenschmidt
2007-05-10 11:01 ` Josh Boyer
2007-05-10 6:45 ` Satyam Sharma
2007-05-10 7:21 ` Benjamin Herrenschmidt
2007-05-10 7:54 ` Satyam Sharma
2007-05-10 8:46 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070510052622.3E8D5DDF4B@ozlabs.org \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).