Re: [PATCH 0/3] 64-bit futexes: Intro

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nick Piggin <npiggin@...>
Cc: Ingo Molnar <mingo@...>, David Howells <dhowells@...>, Ulrich Drepper <drepper@...>, Linux Kernel Mailing List <linux-kernel@...>, Andrew Morton <akpm@...>
Date: Wednesday, June 4, 2008 - 11:08 pm

On Thu, 5 Jun 2008, Nick Piggin wrote:

That's _one_ possible implementation. 

Quite frankly, I think it's the less likely one. It's much more likely 
that the cache read access and the store buffer probe happen in parallel 
(this is a really important hotpath for any CPU, but even more so x86 
where there are more of loads and stores that are spills). And then the 
store buffer logic would return the data and a bytemask mask (where the 
mask would be all zeroes for a miss), and the returned value is just the 
appropriate mix of the two.


You'd have to ask somebody very knowledgeable inside Intel and AMD, and it 
is quite likely that different microarchitectures have different 
approaches...


Oh, absolutely, the perfect algorithm would actually get the right answer 
and notice that the cacheline got evicted, and retried the whole sequence 
such that it is coherent. 

But we do know that Intel expressly documents loads and stores to pass 
each other and documents the fact that the store buffer is there. So I bet 
that this is visible in some micro-architecture, even if it's not 
necessarily visible in _all_ of them.

The recent Intel memory ordering whitepaper makes it very clear that loads 
can pass earlier stores and in particular that the store buffer allows 
intra-processor forwarding to subsequent loads (2.4 in their whitepaper). 
It _could_ be just a "for future CPU's", but quite frankly, I'm 100% sure 
it isn't. The store->load forwarding is such a critical performance issue 
that I can pretty much guarantee that it doesn't always hit the cacheline.

Of course, the partial store forwarding case is not nearly as important, 
and stalling is quite a reasonable implementation approach. I just 
personally suspect that doing the unconditional byte-masking is actually 
_simpler_ to implement than the stall, so..

			Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Fri May 30, 9:27 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Fri May 30, 10:13 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Fri May 30, 11:14 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Fri May 30, 11:44 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Sat May 31, 12:04 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 12:16 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 12:23 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Sat May 31, 12:38 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 6:25 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ingo Molnar, (Mon Jun 2, 2:54 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Mon Jun 2, 4:22 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Thu Jun 5, 9:27 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Thu Jun 5, 11:37 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Fri Jun 6, 7:53 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Fri Jun 6, 11:01 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ingo Molnar, (Mon Jun 2, 7:03 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Mon Jun 2, 11:24 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Wed Jun 4, 3:57 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Wed Jun 4, 9:45 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Wed Jun 4, 4:38 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Wed Jun 4, 9:56 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Wed Jun 4, 11:08 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Thu Jun 5, 12:29 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Wed Jun 4, 9:58 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 6:32 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 12:58 am)