clflush and store buffer

33 views
Skip to first unread message

Yifeng Xu

unread,
Apr 20, 2018, 1:56:55 AM4/20/18
to pmem
Hi,

I can not find any document in ISA which describes relationship between clflush and cpu local store buffer,
does cpu flush its local store buffer before executing clflush instruction ?

Regards,
Yifeng Xu

Andy Rudoff

unread,
Apr 20, 2018, 3:45:07 PM4/20/18
to pmem
Hi Yifeng,

The Software Developer's Manual (SDM) covers these areas somewhat in section 11.10 ("Store Buffer") and section 8.2 ("Memory Ordering") but they don't really answer the specific point you raised directly, so I'll try to do that.  Let's use the notation CL* to stand for either CLFLUSH, CLFLUSHOPT, or CLWB, since my answer applies to all three.

On the same logical CPU, a subsequent CL* would affect older stores in store buffers from the same CPU.

In other words, the memory model requires the CPU to be self-consistent such that two things to the same address cannot pass each other on the same logical CPU.  But this doesn't apply to things happen across different CPUs since stores in store buffers are not committed yet and are not going to be seen by CL* issues from other CPUs.

Hope that helps!

-andy
Reply all
Reply to author
Forward
0 new messages