From: Manfred Spraul <manfred@colorfullife.com>
To: TeJun Huh <tejun@aratech.co.kr>
Cc: linux-kernel@vger.kernel.org, Zwane Mwaikambo <zwane@linuxpower.ca>
Subject: Re: Possible race condition in i386 global_irq_lock handling.
Date: Thu, 21 Aug 2003 19:01:39 +0200 [thread overview]
Message-ID: <3F44FAF3.8020707@colorfullife.com> (raw)
TeJun wrote:
> static inline void irq_enter(int cpu, int irq)
> {
> ++local_irq_count(cpu);
>
> while (test_bit(0,&global_irq_lock)) {
> cpu_relax();
> }
> }
>
> Is it a race condition or am I getting it horribly wrong? Thx in
> advance.
Yes, it's a race. Actually a variant of the race that lead to the introduction of set_current_state():
test_bit is a simple read instruction. i386 cpus are free to execute it early, i.e. they can execute it before the write part of "++local_irq_count(cpu)".
I think smp_rmb() is the right barrier - could you write a patch and send it to Marcelo?
--
Manfred
next reply other threads:[~2003-08-21 17:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-21 17:01 Manfred Spraul [this message]
2003-08-21 17:27 ` Possible race condition in i386 global_irq_lock handling Andrea Arcangeli
2003-08-21 21:48 ` Stephan von Krawczynski
2003-08-21 22:44 ` Andrea Arcangeli
2003-08-22 1:18 ` TeJun Huh
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=3F44FAF3.8020707@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tejun@aratech.co.kr \
--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;
as well as URLs for NNTP newsgroup(s).