From: TeJun Huh <tejun@aratech.co.kr>
To: Stephan von Krawczynski <skraw@ithnet.com>
Cc: Andrea Arcangeli <andrea@suse.de>,
manfred@colorfullife.com, linux-kernel@vger.kernel.org,
zwane@linuxpower.ca
Subject: Re: Possible race condition in i386 global_irq_lock handling.
Date: Fri, 22 Aug 2003 10:18:40 +0900 [thread overview]
Message-ID: <20030822011840.GA14540@atj.dyndns.org> (raw)
In-Reply-To: <20030821234824.37497c08.skraw@ithnet.com>
I'm attaching patch for i386. It makes three changes.
1. add smp_mb() between local_irq_count++ and global_irq_lock test
in irq_enter().
2. add smp_mb__after_clear_bit() before irqs_running() test in
wait_on_irq().
3. remove irqs_running() test from synchronize_irq()
Removing irqs_running() test from synchronize_irq() is needed for the
same reason. Other interrupts might be running on successful return
from synchronize_irq().
smp_mb__after_clear_bit() should be smp_mb__after_test_and_set_bit()
which doesn't exist. Should I add this?
After determining smp_mb__after_clear_bit(), I'll make a patch for
every affected architecture. Please comment.
# ------------ patch follows --------------
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c Fri Aug 22 10:07:50 2003
+++ b/arch/i386/kernel/irq.c Fri Aug 22 10:07:50 2003
@@ -271,6 +271,8 @@
* for bottom half handlers unless we're
* already executing in one..
*/
+ smp_mb__after_clear_bit(); /* Synchronize with irq_enter() */
+
if (!irqs_running())
if (local_bh_count(cpu) || !spin_is_locked(&global_bh_lock))
break;
@@ -307,11 +309,9 @@
*/
void synchronize_irq(void)
{
- if (irqs_running()) {
- /* Stupid approach */
- cli();
- sti();
- }
+ /* Stupid approach */
+ cli();
+ sti();
}
static inline void get_irqlock(int cpu)
diff -Nru a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h
--- a/include/asm-i386/hardirq.h Fri Aug 22 10:07:50 2003
+++ b/include/asm-i386/hardirq.h Fri Aug 22 10:07:50 2003
@@ -67,6 +67,8 @@
{
++local_irq_count(cpu);
+ smp_mb(); /* Synchronize with wait_on_irq() */
+
while (test_bit(0,&global_irq_lock)) {
cpu_relax();
}
next prev parent reply other threads:[~2003-08-22 1:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-21 17:01 Manfred Spraul
2003-08-21 17:27 ` Andrea Arcangeli
2003-08-21 21:48 ` Stephan von Krawczynski
2003-08-21 22:44 ` Andrea Arcangeli
2003-08-22 1:18 ` TeJun Huh [this message]
2003-08-22 10:07 ` Stephan von Krawczynski
2003-08-22 16:25 ` Andrea Arcangeli
2003-08-24 3:06 ` TeJun Huh
2003-08-24 22:03 ` Andrea Arcangeli
-- strict thread matches above, loose matches on Subject: below --
2003-08-21 8:48 TeJun Huh
2003-08-21 10:07 ` Zwane Mwaikambo
2003-08-21 16:15 ` TeJun Huh
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=20030822011840.GA14540@atj.dyndns.org \
--to=tejun@aratech.co.kr \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=skraw@ithnet.com \
--cc=zwane@linuxpower.ca \
/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
Powered by JetHome