* Re: [patch] mm: fix anon_vma races
[not found] ` <Pine.LNX.4.64.0810180045370.8995@blonde.site>
@ 2008-10-18 1:53 ` Nick Piggin
2008-10-18 2:50 ` Paul Mackerras
0 siblings, 1 reply; 12+ messages in thread
From: Nick Piggin @ 2008-10-18 1:53 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Linus Torvalds, linux-kernel, linux-mm, linux-arch
On Sat, Oct 18, 2008 at 01:13:16AM +0100, Hugh Dickins wrote:
> On Fri, 17 Oct 2008, Linus Torvalds wrote:
> > would be more obvious in the place where we actually fetch that "anon_vma"
> > pointer again and actually derefernce it.
> >
> > HOWEVER:
> >
> > - there are potentially multiple places that do that, and putting it in
> > the anon_vma_prepare() thing not only matches things with the
> > smp_wmb(), making that whole pairing much more obvious, but it also
> > means that we're guaranteed that any anon_vma user will have done the
> > smp_read_barrier_depends(), since they all have to do that prepare
> > thing anyway.
>
> No, it's not so that any anon_vma user would have done the
> smp_read_barrier_depends() placed in anon_vma_prepare().
>
> Anyone faulting in a page would have done it (swapoff? that
> assumes it's been done, let's not worry about it right now).
>
> But they're doing it to make the page's ptes accessible to
> memory reclaim, and the CPU doing memory reclaim will not
> (unless by coincidence) have done that anon_vma_prepare() -
> it's just reading the links which the faulters are providing.
Yes, that's a very important flaw you point out with the fix. Good
spotting.
Actually another thing I was staying awake thinking about was the
pairwise consistency problem. "Apparently" Linux is supposed to
support arbitrary pairwise consistency.
This means.
CPU0
anon_vma.initialized = 1;
smp_wmb()
vma->anon_vma = anon_vma;
CPU1
if (vma->anon_vma)
page->anon_vma = vma->anon_vma;
CPU2
if (page->anon_vma) {
smp_read_barrier_depends();
assert(page->anon_vma.initialized);
}
The assertion may trigger because the store from CPU0 may not have
propograted to CPU2 before the stores from CPU1.
But after thinking about this a bit more, I think Linux would be
broken all over the map under such ordering schemes. I think we'd
have to mandate causal consistency. Are there any architectures we
run on where this is not guaranteed? (I think recent clarifications
to x86 ordering give us CC on that architecture).
powerpc, ia64, alpha, sparc, arm, mips? (cced linux-arch)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 1:53 ` [patch] mm: fix anon_vma races Nick Piggin
@ 2008-10-18 2:50 ` Paul Mackerras
2008-10-18 2:57 ` Linus Torvalds
2008-10-18 5:49 ` Nick Piggin
0 siblings, 2 replies; 12+ messages in thread
From: Paul Mackerras @ 2008-10-18 2:50 UTC (permalink / raw)
To: Nick Piggin
Cc: Hugh Dickins, Linus Torvalds, linux-kernel, linux-mm, linux-arch
Nick Piggin writes:
> But after thinking about this a bit more, I think Linux would be
> broken all over the map under such ordering schemes. I think we'd
> have to mandate causal consistency. Are there any architectures we
> run on where this is not guaranteed? (I think recent clarifications
> to x86 ordering give us CC on that architecture).
>
> powerpc, ia64, alpha, sparc, arm, mips? (cced linux-arch)
Not sure what you mean by causal consistency, but I assume it's the
same as saying that barriers give cumulative ordering, as described on
page 413 of the Power Architecture V2.05 document at:
http://www.power.org/resources/reading/PowerISA_V2.05.pdf
The ordering provided by sync, lwsync and eieio is cumulative (see
pages 446 and 448), so we should be OK on powerpc AFAICS. (The
cumulative property of eieio only applies to accesses to normal system
memory, but that should be OK since we use sync when we want barriers
that affect non-cacheable accesses as well as cacheable.)
Paul.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 2:50 ` Paul Mackerras
@ 2008-10-18 2:57 ` Linus Torvalds
2008-10-18 2:57 ` Linus Torvalds
2008-10-18 5:49 ` Nick Piggin
1 sibling, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2008-10-18 2:57 UTC (permalink / raw)
To: Paul Mackerras
Cc: Nick Piggin, Hugh Dickins, linux-kernel, linux-mm, linux-arch
On Sat, 18 Oct 2008, Paul Mackerras wrote:
>
> Not sure what you mean by causal consistency, but I assume it's the
> same as saying that barriers give cumulative ordering, as described on
> page 413 of the Power Architecture V2.05 document at:
I'm pretty sure that everybody but alpha is ok.
And alpha needs the smp_read_barrier_depends() not because it doesn't
really support causality, but because each CPU internally doesn't
guarantee that they handle the cache invalidates in-order without a
barrier.
So without the smp_read_barrier_depends(), alpha will actually have the
proper causal relationships (cachelines will move to exclusive state on
CPU0 in the right order and others will see the causality), but because
CPU2 may see the stale data from not even having invalidated the
"anon_vma.initialized" because the cache invalidation queue hadn't been
flushed in order.
Alpha is insane. And the odd man out.
Linus
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 2:57 ` Linus Torvalds
@ 2008-10-18 2:57 ` Linus Torvalds
0 siblings, 0 replies; 12+ messages in thread
From: Linus Torvalds @ 2008-10-18 2:57 UTC (permalink / raw)
To: Paul Mackerras
Cc: Nick Piggin, Hugh Dickins, linux-kernel, linux-mm, linux-arch
On Sat, 18 Oct 2008, Paul Mackerras wrote:
>
> Not sure what you mean by causal consistency, but I assume it's the
> same as saying that barriers give cumulative ordering, as described on
> page 413 of the Power Architecture V2.05 document at:
I'm pretty sure that everybody but alpha is ok.
And alpha needs the smp_read_barrier_depends() not because it doesn't
really support causality, but because each CPU internally doesn't
guarantee that they handle the cache invalidates in-order without a
barrier.
So without the smp_read_barrier_depends(), alpha will actually have the
proper causal relationships (cachelines will move to exclusive state on
CPU0 in the right order and others will see the causality), but because
CPU2 may see the stale data from not even having invalidated the
"anon_vma.initialized" because the cache invalidation queue hadn't been
flushed in order.
Alpha is insane. And the odd man out.
Linus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 2:50 ` Paul Mackerras
2008-10-18 2:57 ` Linus Torvalds
@ 2008-10-18 5:49 ` Nick Piggin
2008-10-18 5:49 ` Nick Piggin
` (2 more replies)
1 sibling, 3 replies; 12+ messages in thread
From: Nick Piggin @ 2008-10-18 5:49 UTC (permalink / raw)
To: Paul Mackerras
Cc: Hugh Dickins, Linus Torvalds, linux-kernel, linux-mm, linux-arch
On Sat, Oct 18, 2008 at 01:50:57PM +1100, Paul Mackerras wrote:
> Nick Piggin writes:
>
> > But after thinking about this a bit more, I think Linux would be
> > broken all over the map under such ordering schemes. I think we'd
> > have to mandate causal consistency. Are there any architectures we
> > run on where this is not guaranteed? (I think recent clarifications
> > to x86 ordering give us CC on that architecture).
> >
> > powerpc, ia64, alpha, sparc, arm, mips? (cced linux-arch)
>
> Not sure what you mean by causal consistency, but I assume it's the
I think it can be called transitive. Basically (assumememory starts off zeroed)
CPU0
x := 1
CPU1
if (x == 1) {
fence
y := 1
}
CPU2
if (y == 1) {
fence
assert(x == 1)
}
As opposed to pairwise, which only provides an ordering of visibility between
any given two CPUs (so the store to y might be propogated to CPU2 after the
store to x, regardless of the fences).
Apparently pairwise ordering is more interesting than just a theoretical
thing, and not just restricted to Alpha's funny caches. It can allow for
arbitrary network propogating stores / cache coherency between CPUs. x86's
publically documented memory model supposedly could allow for such ordering
up until a year or so ago (when they clarified and strengthened it).
> same as saying that barriers give cumulative ordering, as described on
> page 413 of the Power Architecture V2.05 document at:
>
> http://www.power.org/resources/reading/PowerISA_V2.05.pdf
>
> The ordering provided by sync, lwsync and eieio is cumulative (see
> pages 446 and 448), so we should be OK on powerpc AFAICS. (The
> cumulative property of eieio only applies to accesses to normal system
> memory, but that should be OK since we use sync when we want barriers
> that affect non-cacheable accesses as well as cacheable.)
The section on cumulative ordering sounds like it might do the trick. But
I haven't really worked through exactly what it is saying ;)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 5:49 ` Nick Piggin
@ 2008-10-18 5:49 ` Nick Piggin
2008-10-18 10:49 ` Paul Mackerras
2008-10-18 17:00 ` Linus Torvalds
2 siblings, 0 replies; 12+ messages in thread
From: Nick Piggin @ 2008-10-18 5:49 UTC (permalink / raw)
To: Paul Mackerras
Cc: Hugh Dickins, Linus Torvalds, linux-kernel, linux-mm, linux-arch
On Sat, Oct 18, 2008 at 01:50:57PM +1100, Paul Mackerras wrote:
> Nick Piggin writes:
>
> > But after thinking about this a bit more, I think Linux would be
> > broken all over the map under such ordering schemes. I think we'd
> > have to mandate causal consistency. Are there any architectures we
> > run on where this is not guaranteed? (I think recent clarifications
> > to x86 ordering give us CC on that architecture).
> >
> > powerpc, ia64, alpha, sparc, arm, mips? (cced linux-arch)
>
> Not sure what you mean by causal consistency, but I assume it's the
I think it can be called transitive. Basically (assumememory starts off zeroed)
CPU0
x := 1
CPU1
if (x == 1) {
fence
y := 1
}
CPU2
if (y == 1) {
fence
assert(x == 1)
}
As opposed to pairwise, which only provides an ordering of visibility between
any given two CPUs (so the store to y might be propogated to CPU2 after the
store to x, regardless of the fences).
Apparently pairwise ordering is more interesting than just a theoretical
thing, and not just restricted to Alpha's funny caches. It can allow for
arbitrary network propogating stores / cache coherency between CPUs. x86's
publically documented memory model supposedly could allow for such ordering
up until a year or so ago (when they clarified and strengthened it).
> same as saying that barriers give cumulative ordering, as described on
> page 413 of the Power Architecture V2.05 document at:
>
> http://www.power.org/resources/reading/PowerISA_V2.05.pdf
>
> The ordering provided by sync, lwsync and eieio is cumulative (see
> pages 446 and 448), so we should be OK on powerpc AFAICS. (The
> cumulative property of eieio only applies to accesses to normal system
> memory, but that should be OK since we use sync when we want barriers
> that affect non-cacheable accesses as well as cacheable.)
The section on cumulative ordering sounds like it might do the trick. But
I haven't really worked through exactly what it is saying ;)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 5:49 ` Nick Piggin
2008-10-18 5:49 ` Nick Piggin
@ 2008-10-18 10:49 ` Paul Mackerras
2008-10-18 10:49 ` Paul Mackerras
2008-10-18 17:00 ` Linus Torvalds
2 siblings, 1 reply; 12+ messages in thread
From: Paul Mackerras @ 2008-10-18 10:49 UTC (permalink / raw)
To: Nick Piggin
Cc: Hugh Dickins, Linus Torvalds, linux-kernel, linux-mm, linux-arch
Nick Piggin writes:
> > Not sure what you mean by causal consistency, but I assume it's the
>
> I think it can be called transitive. Basically (assumememory starts off zeroed)
> CPU0
> x := 1
>
> CPU1
> if (x == 1) {
> fence
> y := 1
> }
>
> CPU2
> if (y == 1) {
> fence
> assert(x == 1)
> }
That's essentially the same as example 1 on page 415, so yes we are
talking about the same thing.
Paul.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 10:49 ` Paul Mackerras
@ 2008-10-18 10:49 ` Paul Mackerras
0 siblings, 0 replies; 12+ messages in thread
From: Paul Mackerras @ 2008-10-18 10:49 UTC (permalink / raw)
To: Nick Piggin
Cc: Hugh Dickins, Linus Torvalds, linux-kernel, linux-mm, linux-arch
Nick Piggin writes:
> > Not sure what you mean by causal consistency, but I assume it's the
>
> I think it can be called transitive. Basically (assumememory starts off zeroed)
> CPU0
> x := 1
>
> CPU1
> if (x == 1) {
> fence
> y := 1
> }
>
> CPU2
> if (y == 1) {
> fence
> assert(x == 1)
> }
That's essentially the same as example 1 on page 415, so yes we are
talking about the same thing.
Paul.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 5:49 ` Nick Piggin
2008-10-18 5:49 ` Nick Piggin
2008-10-18 10:49 ` Paul Mackerras
@ 2008-10-18 17:00 ` Linus Torvalds
2008-10-18 18:44 ` Matthew Wilcox
2008-10-19 2:53 ` Nick Piggin
2 siblings, 2 replies; 12+ messages in thread
From: Linus Torvalds @ 2008-10-18 17:00 UTC (permalink / raw)
To: Nick Piggin
Cc: Paul Mackerras, Hugh Dickins, linux-kernel, linux-mm, linux-arch
On Sat, 18 Oct 2008, Nick Piggin wrote:
>
> I think it can be called transitive. Basically (assumememory starts off zeroed)
Alpha is transitive. It has a notion of "processor issue order" and
"location access order", and the ordering those two creates is a
transitive "before" and "after" ordering.
The issue with alpha is not that it wouldn't be transitive - the issue is
that *local* read dependencies do not cause a "processor issue order"!
So the real issue with alpha is not about any big pair-wise ordering vs
transitive thing, the big issue is that alpha's totally _local_ and
per-core orderings are so totally screwed up, and are defined to be very
loose - because back when alpha was designed, loose memory ordering was
thought to be a good thing for performance.
They were wrong, but that was mainly because the alpha designers lived in
a time when threading wasn't really even an issue. They were optimizing
purely for the case where memory ordering doesn't matter, and considered
locking etc to be one of those non-RISCy rare operations that can be
basically ignored.
> CPU0
> x := 1
So this creates a "location access" event on 'x' on alpha, call it "event
A".
> CPU1
> if (x == 1) {
> fence
> y := 1
> }
This has two events: let's call the read of 'x' "B", and "C" is the write
to 'y'.
And according to the alpha rules, we now have:
- A << B
Because we saw a '1' in B, we now have a "location access ordering"
on the _same_ variable between A and B.
- B < C
Because we have the fence in between the read and the write, we now
have a "processor issue order" between B and C (despite the fact that
they are different variables).
And now, the alpha definition of "before" means that we can declare that A
is before C.
But on alpha, we really do need that fence, even if the address of 'y' was
somehow directly data-dependent on 'x'. THAT is what makes alpha special,
not any odd ordering rules.
> CPU2
> if (y == 1) {
> fence
> assert(x == 1)
> }
So again, we now have two events: the access of 'y' is "D", and the access
of x is "E". And again, according to the alpha rules, we have two
orderings:
- C << D
Because we saw a '1' in D, we have another "location access ordering"
on the variably 'y' between C and D.
- D < E
Because of the fence, we have a "processor issue ordering" between D
and E.
And for the same reason as above, we now get that C is "before" E
according to the alpha ordering rules. And because the definition of
"before" is transitive, then A is before E.
And that, in turn, means that that assert() can never trigger, because if
it triggered, then by the access ordering rules that would imply that E <<
A, which would mean that E is "before" A, which in turn would violate the
whole chain we just got to.
So while the alpha architecture manual doesn't have the exact sequence
mentioned above (it only has nine so-called "Litmus tests"), it's fairly
close to Litmus test 3, and the ordering on alpha is very clear: it's all
transitive and causal (ie "before" can never be "after").
> Apparently pairwise ordering is more interesting than just a theoretical
> thing, and not just restricted to Alpha's funny caches.
Nobody does just pairwise ordering, afaik. It's an insane model. Everybody
does some form of transitive ordering.
The real (and only really odd) issue with alpha is that for everybody
else, if you have
read x -> data dependency -> read y
(ie you read a pointer and dereference it, or you read an index and
dereference an array through it), then on all other architectures that
will imply a local processor ordering, which in turn will be part of the
whole transitive order of operations.
On alpha, it doesn't. You can think of it as alpha doing value speculation
(ie allowing speculative reads even across data dependencies), so on
alpha, you could imagine a CPU doing address speculation, and turning the
two reads into a sequence of
(a) read off speculative pointer '*p'
(b) read x
(c) verify that that x == p
and THAT is what "smp_read_barrier_depends()" will basically stop on
alpha. Nothing else. Other CPU's will always basically do
(a) read x
(b) read *x
so they have an implied read barrier between those two events thanks to
simply the causal relationship.
Some more notes:
- The reason that alpha has this odd thing is not actually that any alpha
implementation does value speculation, but the way the caches are
invalidated, the invalidates can be delayed and re-ordered almost
arbitrarily on the local CPU, and in the absense of a memory barrier
the second read (that does happen "after" the first read in some local
internal CPU sense and wasn't really speculative in that way) can get
stale data because one cacheline has been updated before another one
has.
So while you can think of it a value speculation, the underlying cause
is actually not some fancy speculation infrastructure, just an internal
implementation issue.
- The _data_ dependency is important, because other architectures _will_
still speculatively move memory operations around across other "causal"
relationships, notably across control dependencies. IOW, if you have
if (read(x))
read(y)
then there is NOT necessarily any real orderign between the reads,
because the conditional ends up being speculated, and you may well see
"y" being read before "x", and you really need a smp_rmb() on other
architectures than alpha too. So in this sense, alpha is very
"consistent" - for alpha, _no_ amount of local causality matters, and
only accesses to the *same* variable are implicitly locally ordered.
- On x86, the new memory ordering semantics means that _all_ local causal
relationships are honored, so x86, like alpha, is very consistent. It
will consider both the data-dependency and the control dependency to be
100% the same. It just does it differently than alpha: for alpha,
neither matters for ordering, for x86, both matter.
Of course, even on x86, the local causal relationships still do allow
loads to pass stores, so x86 isn't _totally_ ordered. x86 obviously still
does need the smp_mb().
So alpha is "more consistent" in the respect of really having very clear
rules. The fact that those "clear rules" are totally insane and very
inconvenient for threading (and weren't the big performance advantage that
people used to think they would be) is a separate matter.
Linus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 17:00 ` Linus Torvalds
@ 2008-10-18 18:44 ` Matthew Wilcox
2008-10-19 2:54 ` Nick Piggin
2008-10-19 2:53 ` Nick Piggin
1 sibling, 1 reply; 12+ messages in thread
From: Matthew Wilcox @ 2008-10-18 18:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Nick Piggin, Paul Mackerras, Hugh Dickins, linux-kernel, linux-mm,
linux-arch
On Sat, Oct 18, 2008 at 10:00:30AM -0700, Linus Torvalds wrote:
> > Apparently pairwise ordering is more interesting than just a theoretical
> > thing, and not just restricted to Alpha's funny caches.
>
> Nobody does just pairwise ordering, afaik. It's an insane model. Everybody
> does some form of transitive ordering.
I assume you're talking about CPUs in particular here, and I don't know
of any counterexamples.
If you're talking about PCI devices, the model is not transitive.
Here's the exact text from Appendix E of PCI 3.0:
A system may have multiple Producer-Consumer pairs operating
simultaneously, with different data - flag-status sets located all
around the system. But since only one Producer can write to a single
data-flag set, there are no ordering requirements between different
masters. Writes from one master on one bus may occur in one order on
one bus, with respect to another master's writes, and occur in another
order on another bus. In this case, the rules allow for some writes
to be rearranged; for example, an agent on Bus 1 may see Transaction
A from a master on Bus 1 complete first, followed by Transaction B
from another master on Bus 0. An agent on Bus 0 may see Transaction
B complete first followed by Transaction A. Even though the actual
transactions complete in a different order, this causes no problem
since the different masters must be addressing different data-flag sets.
I seem to remember earlier versions of the spec having more clear
language about A happening before B and B happening before C didn't
mean that A happened before C from the perspective of a third device,
but I can't find it right now.
Anyway, as the spec says, you're not supposed to use PCI like that,
so it doesn't matter.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 17:00 ` Linus Torvalds
2008-10-18 18:44 ` Matthew Wilcox
@ 2008-10-19 2:53 ` Nick Piggin
1 sibling, 0 replies; 12+ messages in thread
From: Nick Piggin @ 2008-10-19 2:53 UTC (permalink / raw)
To: Linus Torvalds
Cc: Paul Mackerras, Hugh Dickins, linux-kernel, linux-mm, linux-arch
On Sat, Oct 18, 2008 at 10:00:30AM -0700, Linus Torvalds wrote:
>
>
> On Sat, 18 Oct 2008, Nick Piggin wrote:
> >
> > I think it can be called transitive. Basically (assumememory starts off zeroed)
>
> Alpha is transitive. It has a notion of "processor issue order" and
> "location access order", and the ordering those two creates is a
> transitive "before" and "after" ordering.
>
> The issue with alpha is not that it wouldn't be transitive - the issue is
> that *local* read dependencies do not cause a "processor issue order"!
That's fine. That's not so different to most other weakly ordered processor
having control dependencies not appearing in-order. So long as stores
propogate according to causality.
> So this creates a "location access" event on 'x' on alpha, call it "event
> A".
>
> > CPU1
> > if (x == 1) {
> > fence
> > y := 1
> > }
>
> This has two events: let's call the read of 'x' "B", and "C" is the write
> to 'y'.
>
> And according to the alpha rules, we now have:
>
> - A << B
>
> Because we saw a '1' in B, we now have a "location access ordering"
> on the _same_ variable between A and B.
>
> - B < C
>
> Because we have the fence in between the read and the write, we now
> have a "processor issue order" between B and C (despite the fact that
> they are different variables).
>
> And now, the alpha definition of "before" means that we can declare that A
> is before C.
>
> But on alpha, we really do need that fence, even if the address of 'y' was
> somehow directly data-dependent on 'x'. THAT is what makes alpha special,
> not any odd ordering rules.
>
> > CPU2
> > if (y == 1) {
> > fence
> > assert(x == 1)
> > }
>
> So again, we now have two events: the access of 'y' is "D", and the access
> of x is "E". And again, according to the alpha rules, we have two
> orderings:
>
> - C << D
>
> Because we saw a '1' in D, we have another "location access ordering"
> on the variably 'y' between C and D.
>
> - D < E
>
> Because of the fence, we have a "processor issue ordering" between D
> and E.
>
> And for the same reason as above, we now get that C is "before" E
> according to the alpha ordering rules. And because the definition of
> "before" is transitive, then A is before E.
>
> And that, in turn, means that that assert() can never trigger, because if
> it triggered, then by the access ordering rules that would imply that E <<
> A, which would mean that E is "before" A, which in turn would violate the
> whole chain we just got to.
>
> So while the alpha architecture manual doesn't have the exact sequence
> mentioned above (it only has nine so-called "Litmus tests"), it's fairly
> close to Litmus test 3, and the ordering on alpha is very clear: it's all
> transitive and causal (ie "before" can never be "after").
OK, good.
> > Apparently pairwise ordering is more interesting than just a theoretical
> > thing, and not just restricted to Alpha's funny caches.
>
> Nobody does just pairwise ordering, afaik. It's an insane model. Everybody
> does some form of transitive ordering.
We were chatting with Andy Glew a while back, and he said it actually can
be quite beneficial for HW designers (but I imagine that is the same as a
lot of "insane" things) ;)
I remember though that you said Linux should be pairwise-safe. I think
that's wrong (for more reasons than this anon-vma race), which is why
I got concerned and started off this subthread.
I think Linux probably has a lot of problems in a pairwise consistency
model, so I'd just like to check if we acutally attempt to supportany
architecture where that is the case.
x86, powerpc, alpha are good ;) That gives me hope.
Thanks,
Nick
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] mm: fix anon_vma races
2008-10-18 18:44 ` Matthew Wilcox
@ 2008-10-19 2:54 ` Nick Piggin
0 siblings, 0 replies; 12+ messages in thread
From: Nick Piggin @ 2008-10-19 2:54 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Linus Torvalds, Paul Mackerras, Hugh Dickins, linux-kernel,
linux-mm, linux-arch
On Sat, Oct 18, 2008 at 12:44:05PM -0600, Matthew Wilcox wrote:
> On Sat, Oct 18, 2008 at 10:00:30AM -0700, Linus Torvalds wrote:
> > > Apparently pairwise ordering is more interesting than just a theoretical
> > > thing, and not just restricted to Alpha's funny caches.
> >
> > Nobody does just pairwise ordering, afaik. It's an insane model. Everybody
> > does some form of transitive ordering.
>
> I assume you're talking about CPUs in particular here, and I don't know
> of any counterexamples.
Yes, just CPUs.
> If you're talking about PCI devices, the model is not transitive.
> Here's the exact text from Appendix E of PCI 3.0:
>
> A system may have multiple Producer-Consumer pairs operating
> simultaneously, with different data - flag-status sets located all
> around the system. But since only one Producer can write to a single
> data-flag set, there are no ordering requirements between different
> masters. Writes from one master on one bus may occur in one order on
> one bus, with respect to another master's writes, and occur in another
> order on another bus. In this case, the rules allow for some writes
> to be rearranged; for example, an agent on Bus 1 may see Transaction
> A from a master on Bus 1 complete first, followed by Transaction B
> from another master on Bus 0. An agent on Bus 0 may see Transaction
> B complete first followed by Transaction A. Even though the actual
> transactions complete in a different order, this causes no problem
> since the different masters must be addressing different data-flag sets.
>
> I seem to remember earlier versions of the spec having more clear
> language about A happening before B and B happening before C didn't
> mean that A happened before C from the perspective of a third device,
> but I can't find it right now.
>
> Anyway, as the spec says, you're not supposed to use PCI like that,
> so it doesn't matter.
Interesting. Hopefully as you say it won't matter.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-10-19 2:54 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20081016041033.GB10371@wotan.suse.de>
[not found] ` <Pine.LNX.4.64.0810172300280.30871@blonde.site>
[not found] ` <alpine.LFD.2.00.0810171549310.3438@nehalem.linux-foundation.org>
[not found] ` <Pine.LNX.4.64.0810180045370.8995@blonde.site>
2008-10-18 1:53 ` [patch] mm: fix anon_vma races Nick Piggin
2008-10-18 2:50 ` Paul Mackerras
2008-10-18 2:57 ` Linus Torvalds
2008-10-18 2:57 ` Linus Torvalds
2008-10-18 5:49 ` Nick Piggin
2008-10-18 5:49 ` Nick Piggin
2008-10-18 10:49 ` Paul Mackerras
2008-10-18 10:49 ` Paul Mackerras
2008-10-18 17:00 ` Linus Torvalds
2008-10-18 18:44 ` Matthew Wilcox
2008-10-19 2:54 ` Nick Piggin
2008-10-19 2:53 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox