lkml.org 
[lkml]   [2003]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PATCH: Race in 2.6.0-test2 timer code

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.

Ingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.116 / U:5.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site