From: Andrea Arcangeli <andrea@suse.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>,
linas@austin.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: PATCH: Race in 2.6.0-test2 timer code
Date: Wed, 30 Jul 2003 14:34:58 +0200 [thread overview]
Message-ID: <20030730123458.GM23835@dualathlon.random> (raw)
In-Reply-To: <Pine.LNX.4.44.0307301342260.17411-100000@localhost.localdomain>
On Wed, Jul 30, 2003 at 01:49:52PM +0200, Ingo Molnar wrote:
>
> On Wed, 30 Jul 2003, Andrea Arcangeli wrote:
>
> > in del_timer, list_del can be reordered after the timer->base = NULL,
> > the C compiler can do that. so list_del will run at the same time of
> > internal_add_timer(base, timer) that does the list_add_tail.
>
> no, it cannot run at the same time. The add_timer() will first lock the
> current CPU's base, before touching the list. Any parallel del_timer() can
> only do the list_del() if it first has locked timer->base. timer->base can
> only have the base of the CPU where it_real_fn is running, or be NULL. In
> the NULL case del_timer() wont do a thing but return. In the other case
> the timer->base value observed by the del_timer()-executing CPU will be
> the same base as where it_real_fn is running, so both the add_timer() and
> the del_timer() will serialize on the same base => no parallel list
> handling possible. How the compiler (or even the CPU, on non-x86) orders
> the writes within the locked section is irrelevant in this scenario.
so if it was really the itimer, it had to be on ppc s390 or ia64, not on
x86. I never reproduced this myself. I will ask more info on bugzilla,
because I thought it was x86 but maybe it wasn't. As said in the
previous email, only non x86 archs can run the timer irq on a cpu
different than the one where it was inserted.
As Andrew, noted the same race could happen in 2.6 with add_timer_on.
But apparently you're right that the setitimer couldn't trigger on 2.6
or 2.4-aa x86.
Still it could be something else that broke related to
add_timer/del_timer_sync in drivers reproducible in x86 too. As said I
didn't debug or reproduce it myself. It simply looked correct to allow
add_timer to run in parallel of del_timer_sync (no matter which cpu
they're running on, if add_timer runs from inside the timer itself, of
course it can't trigger because the base won't change in add_timer and
del_timer will be a reader falling in the same base, but that's a kind
of special case, and it fails too if you use add_timer_on).
Andrea
next prev parent reply other threads:[~2003-07-30 12:34 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 [this message]
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
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=20030730123458.GM23835@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=linas@austin.ibm.com \
--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.