login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
October
»
2
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Oleg Nesterov
Subject:
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
Date: Tuesday, October 2, 2007 - 11:02 am
On 09/30, Paul E. McKenney wrote:
quoted text
> > On Sun, Sep 30, 2007 at 04:02:09PM -0700, Davide Libenzi wrote: > > On Sun, 30 Sep 2007, Oleg Nesterov wrote: > > > > > Ah, but I asked the different question. We must see CPU 1's stores by > > > definition, but what about CPU 0's stores (which could be seen by CPU 1)? > > > > > > Let's take a "real life" example, > > > > > > A = B = X = 0; > > > P = Q = &A; > > > > > > CPU_0 CPU_1 CPU_2 > > > > > > P = &B; *P = 1; if (X) { > > > wmb(); rmb(); > > > X = 1; BUG_ON(*P != 1 && *Q != 1); > > > } > > > > > > So, is it possible that CPU_1 sees P == &B, but CPU_2 sees P == &A ? > > > > That can't be. CPU_2 sees X=1, that happened after (or same time at most - > > from a cache inv. POV) to *P=1, that must have happened after P=&B (in > > order for *P to assign B). So P=&B happened, from a pure time POV, before > > the rmb(), and the rmb() should guarantee that CPU_2 sees P=&B too. > > Actually, CPU designers have to go quite a ways out of their way to > prevent this BUG_ON from happening. One way that it would happen > naturally would be if the cache line containing P were owned by CPU 2, > and if CPUs 0 and 1 shared a store buffer that they both snooped. So, > here is what could happen given careless or sadistic CPU designers: > > o CPU 0 stores &B to P, but misses the cache, so puts the > result in the store buffer. This means that only CPUs 0 and 1 > can see it. > > o CPU 1 fetches P, and sees &B, so stores a 1 to B. Again, > this value for P is visible only to CPUs 0 and 1. > > o CPU 1 executes a wmb(), which forces CPU 1's stores to happen > in order. But it does nothing about CPU 0's stores, nor about CPU > 1's loads, for that matter (and the only reason that POWER ends > up working the way you would like is because wmb() turns into > "sync" rather than the "eieio" instruction that would have been > used for smp_wmb() -- which is maybe what Oleg was thinking of, > but happened to abbreviate. If my analysis is buggy, Anton and > Paulus will no doubt correct me...) > > o CPU 1 stores to X. > > o CPU 2 loads X, and sees that the value is 1. > > o CPU 2 does an rmb(), which orders its loads, but does nothing > about anyone else's loads or stores. > > o CPU 2 fetches P from its cached copy, which still points to A, > which is still zero. So the BUG_ON fires. > > o Some time later, CPU 0 gets the cache line containing P from > CPU 2, and updates it from the value in the store buffer, but > too late... > > Unfortunately, cache-coherence protocols don't care much about pure > time... It is possible to make a 16-CPU machine believe that a single > variable has more than ten different values -at- -the- -same- -time-.
Davide, Paul, thank you very much! I've been wondering about this for the long time, now I know the answer. Great. Oleg. -
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH RFC 0/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Mon Sep 10, 11:30 am)
[PATCH RFC 1/9] RCU: Split API to permit multiple RCU impl ...
, Paul E. McKenney
, (Mon Sep 10, 11:32 am)
[PATCH RFC 2/9] RCU: Fix barriers
, Paul E. McKenney
, (Mon Sep 10, 11:33 am)
[PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Mon Sep 10, 11:34 am)
[PATCH RFC 4/9] RCU: synchronize_sched() workaround for CP ...
, Paul E. McKenney
, (Mon Sep 10, 11:35 am)
[PATCH RFC 5/9] RCU: CPU hotplug support for preemptible RCU
, Paul E. McKenney
, (Mon Sep 10, 11:36 am)
[PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Paul E. McKenney
, (Mon Sep 10, 11:39 am)
[PATCH RFC 7/9] RCU: rcutorture testing for RCU priority b ...
, Paul E. McKenney
, (Mon Sep 10, 11:39 am)
[PATCH RFC 8/9] RCU: Make RCU priority boosting consume le ...
, Paul E. McKenney
, (Mon Sep 10, 11:41 am)
[PATCH RFC 9/9] RCU: preemptible documentation and comment ...
, Paul E. McKenney
, (Mon Sep 10, 11:42 am)
Re: [PATCH RFC 0/9] RCU: Preemptible RCU
, Ingo Molnar
, (Mon Sep 10, 11:44 am)
Re: [PATCH RFC 1/9] RCU: Split API to permit multiple RCU ...
, Steven Rostedt
, (Thu Sep 20, 9:14 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Thu Sep 20, 9:17 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Thu Sep 20, 10:50 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Dipankar Sarma
, (Thu Sep 20, 10:56 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 7:40 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 8:20 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Peter Zijlstra
, (Fri Sep 21, 8:46 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 3:06 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 3:31 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 3:44 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 4:03 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 4:23 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 4:44 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 5:26 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 5:32 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 6:15 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 6:19 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 6:43 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 6:53 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 7:56 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Steven Rostedt
, (Fri Sep 21, 8:15 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 9:07 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 21, 9:10 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Oleg Nesterov
, (Sun Sep 23, 10:38 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Sun Sep 23, 5:15 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Oleg Nesterov
, (Wed Sep 26, 8:13 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Thu Sep 27, 8:46 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Oleg Nesterov
, (Fri Sep 28, 7:47 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Fri Sep 28, 11:57 am)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Gautham R Shenoy
, (Fri Sep 28, 3:56 pm)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Steven Rostedt
, (Fri Sep 28, 4:05 pm)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Paul E. McKenney
, (Sat Sep 29, 8:11 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Oleg Nesterov
, (Sun Sep 30, 9:31 am)
Re: [PATCH RFC 5/9] RCU: CPU hotplug support for preemptib ...
, Oleg Nesterov
, (Sun Sep 30, 9:38 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Davide Libenzi
, (Sun Sep 30, 4:02 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Sun Sep 30, 6:20 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Sun Sep 30, 6:37 pm)
Re: [PATCH RFC 5/9] RCU: CPU hotplug support for preemptib ...
, Paul E. McKenney
, (Sun Sep 30, 6:41 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Davide Libenzi
, (Mon Oct 1, 11:44 am)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Mon Oct 1, 12:21 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Davide Libenzi
, (Mon Oct 1, 3:09 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Paul E. McKenney
, (Mon Oct 1, 3:24 pm)
Re: [PATCH RFC 3/9] RCU: Preemptible RCU
, Oleg Nesterov
, (Tue Oct 2, 11:02 am)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Gautham R Shenoy
, (Fri Oct 5, 4:46 am)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Steven Rostedt
, (Fri Oct 5, 5:24 am)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Gautham R Shenoy
, (Fri Oct 5, 6:21 am)
Re: [PATCH RFC 6/9] RCU priority boosting for preemptible RCU
, Paul E. McKenney
, (Fri Oct 5, 7:07 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Mel Gorman
Re: [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node
Guenter Roeck
Re: [lm-sensors] Location for thermal drivers
David Woodhouse
Re: RFC: Moving firmware blobs out of the kernel.
Siddha, Suresh B
Re: [PATCH 2.6.21 review I] [11/25] x86: default to physical mode on hotplug CPU k...
Peter Zijlstra
Re: [patch 4/6] mm: merge populate and nopage into fault (fixes nonlinear)
git-commits-head
:
Linux Kernel Mailing List
[MIPS] Fix potential latency problem due to non-atomic cpu_wait.
Linux Kernel Mailing List
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Linux Kernel Mailing List
lib/vsprintf.c: fix bug omitting minus sign of numbers (module_param)
Linux Kernel Mailing List
[Bluetooth] Initiate authentication during connection establishment
Linux Kernel Mailing List
[POWERPC] 4xx: Add ppc40x_defconfig
linux-netdev
:
MERCEDES
Your mail id has won 950,000.00 in the MERCEDES Benz Online Promo.for claims send:
David Miller
Re: [PATCH] xen/netfront: do not mark packets of length < MSS as GSO
David Miller
Re: skb_segment() questions
Shan Wei
[RFC PATCH net-next 2/5]IPv6:netfilter: Send an ICMPv6 "Fragment Reassembly Timeou...
Stanislaw Gruszka
[PATCH 1/4] bnx2x: use smp_mb() to keep ordering of read write operations
git
:
Nicolas Sebrecht
git-svn died of signal 11 (was "3 failures on test t9100 (svn)")
Junio C Hamano
Re: [PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
Martin Langhoff
Re: [PATCH] GIT commit statistics.
Alexandre Julliard
[PATCH] gitweb: Put back shortlog instead of graphiclog in the project list.
Josh Triplett
[PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
openbsd-misc
:
Taisto Qvist XX
Re: AMD GEODE LX-800 just works with kernel from install42.iso and kernelpanics wi...
Nico Meijer
Re: gOS Develop Kit with VIA pc-1 Processor Platform VIA C7-D
Andreas Bihlmaier
Re: jetway board sensors (Fintek F71805F)
admin
Drive a 2009 car from R799p/m
Antti Harri
Re: how to create a sha256 hash
Colocation donated by:
Syndicate