[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0811081051190.3468@nehalem.linux-foundation.org>
Date: Sat, 8 Nov 2008 11:00:40 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Arjan van de Ven <arjan@...radead.org>
cc: Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Mike Galbraith <efault@....de>
Subject: Re: [git pull] scheduler updates
On Sat, 8 Nov 2008, Arjan van de Ven wrote:
>
> historically it was for early AMD cpus (K7, not sure if early K8 did
> this) where 2 consecutive rdtsc's in the same codestream would get
> reordered compared to eachother, so you could observe the tsc go
> backwards...
.. but this only happens with two _consecutive_ ones.
The thing is, nobody sane does that in generic code. The scheduler wants
to have cycles, yes, but two consecutive scheduler invocations will have
spinlocks etc in between. That's true of _all_ sane uses of a TSC.
I don't see that there is ever any reason to do the barriers for any
normal case. And the cases where it does matter would actually be worth
pointing out (ie making the barriers explicit in those cases, and those
cases only).
Doing it in get_cycles() and "forgetting about it" may sound like a simple
solution, but it's likely wrong. For example, one of the few cases where
we realy care about time going backwards is gettimeofday() - which uses
tsc, but which also has tons of serializing instructions on its own.
EXCEPT WHEN IT IS a vsyscall!
But in that case, we don't even have the barrier, because we put it in the
wrong function and 'forgot about it'. Of course, we may not need it
(rdtscp maybe always serializes, I didn't check), but the point is, an
explicit barrier is actually better than one that is hidden.
So who _really_ needs it? And why not just do it there?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists