From: linas@austin.ibm.com
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: PATCH: Race in 2.6.0-test2 timer code
Date: Wed, 30 Jul 2003 15:05:39 -0500 [thread overview]
Message-ID: <20030730150539.A28284@forte.austin.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0307300733200.25010-100000@localhost.localdomain>; from mingo@elte.hu on Wed, Jul 30, 2003 at 07:57:32AM +0200
On Wed, Jul 30, 2003 at 07:57:32AM +0200, Ingo Molnar wrote:
>
> and i dont think Linas' patch is correct either - how can the timer base
> change under us? We are holding the timer spinlock.
I deduced the need for the patch by looking at the locking code immediately
above it, which takes pains to get old_base and new_base correctly locked.
My patch was to handle the case of old_base being NULL, which seemed to be
unhandled.
Comments & disclaimers:
-- I don't quite have the 'big picture' for the timer code yet,
so please excuse any thinko's below.
-- I don't know under what cases timer->base can be NULL, but clearly
there are checks for it being NULL, ergo...
-- I then see a race where timer->base is NULL, and so old_base is NULL,
then some other CPU sets timer->base, then we get the lock
on new_base, and blandly assume timer->base is NULL, which it no longer
is.
A bit more graphically ...
timer->base = NULL; /* starting condition */
cpu 1 cpu 2
-------- ---------
mod_timer() {
old_base = timer->base;
if (old_base && ) { /* not taken */
}
else
. spin_lock(&cpu2_base->lock);
. timer->base = cpu2_base;
. spin_unlock(&cpu2_base->lock);
.
spin_lock(&new_base->lock);
/* Uhh oh, timer->base is not null,
in fact its cpu2 base, and we aren't
checking for this before we clobber it.
*/
I don't see what prevents the above from happening. And if the
above really can't happen, then I also don't understand why the fancy
old_base, new-base locking code is required at all.
> What i'd propose is the attached (tested, against 2.6.0-test2) patch
Due to technical difficulties at this end, I'm having trouble testing
any patches. The guy who knows how to run the test case to reproduce
this is out sick, its a big hairy testcase with all sorts of stuff
going on, and I can't make it go. It can take 8+ hours to hit it.
I'll need a few days ...
The other machine that hits it is a 6-way smp powerpc running nothing
but 6 copies of setiathome, but it takes 48+ hours to reproduce there,
so testing is even slower there ...
--linas
next prev parent reply other threads:[~2003-07-30 20:06 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-29 15:41 PATCH: Race in 2.6.0-test2 timer code linas
2003-07-29 20:56 ` Andrew Morton
2003-07-30 5:57 ` Ingo Molnar
2003-07-30 6:36 ` Andrew Morton
2003-07-30 7:07 ` Ingo Molnar
2003-07-30 7:34 ` Andrea Arcangeli
2003-07-30 7:34 ` Ingo Molnar
2003-07-30 8:28 ` Andrea Arcangeli
2003-07-30 10:31 ` Ingo Molnar
2003-07-30 11:16 ` Andrea Arcangeli
2003-07-30 11:49 ` Ingo Molnar
2003-07-30 12:34 ` Andrea Arcangeli
2003-07-30 21:18 ` linas
2003-07-30 22:06 ` Andrea Arcangeli
2003-07-30 22:17 ` Andrea Arcangeli
2003-07-31 7:04 ` Ingo Molnar
2003-07-30 21:19 ` Andrea Arcangeli
2003-07-30 23:43 ` linas
2003-07-30 23:56 ` Andrea Arcangeli
2003-07-30 23:54 ` Andrew Morton
2003-07-31 0:16 ` Andrea Arcangeli
2003-07-31 17:23 ` linas
2003-08-01 6:27 ` Ingo Molnar
2003-07-30 7:40 ` Ingo Molnar
2003-07-30 8:37 ` Andrea Arcangeli
2003-07-30 10:34 ` Ingo Molnar
2003-07-30 10:51 ` Andrew Morton
2003-07-30 11:28 ` Andrea Arcangeli
2003-07-30 11:22 ` Andrea Arcangeli
2003-07-30 20:05 ` linas [this message]
2003-07-31 6:50 ` Ingo Molnar
2003-07-31 22:56 ` linas
2003-08-01 6:23 ` Ingo Molnar
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=20030730150539.A28284@forte.austin.ibm.com \
--to=linas@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.