Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

assembly - What does "store-buffer forwarding" mean in the Intel developer's manual?

The Intel 64 and IA-32 Architectures Software Developer's Manual says the following about re-ordering of actions by a single processor (Section 8.2.2, "Memory Ordering in P6 and More Recent Processor Families"):

Reads may be reordered with older writes to different locations but not with older writes to the same location.

Then below when discussing points where this is relaxed compared to earlier processors, it says:

Store-buffer forwarding, when a read passes a write to the same memory location.

As far as I can tell, "store-buffer forwarding" isn't precisely defined anywhere (and neither is "pass"). What does it mean for a read to pass a write to the same location here, given that above it says that reads can't be reordered with writes to the same location?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The naming is a bit awkward. The "forwarding" happens inside a core/logical processor, as follows. If you first do a STORE, it will go to the store buffer to be flushed to memory asynchronously. If you do a subsequent LOAD to the same location ON THE SAME PROCESSOR before the value is flushed to the cache/memory, the value from the store buffer will be "forwarded" and you will get the value that was just stored. The read is "passing" the write in that it happens before the actual write from store-buffer to memory (which has yet to happen).

The statement isn't saying much actually if you just care about the ordering rules - this forwarding is a detail of what they do internally to guarantee that (on a processor) reads are not reordered with older writes to the same location (part of the rule you quoted).

Despite what some of the other answers here state, there is (at least as far as ordering guarantees go) NO store-buffer forwarding/snooping between processors/cores, as the 8.2.3.5 "Intra-Processor Forwarding Is Allowed" example in the manual shows.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...