pmem_drain an empty function on Intel platforms?

39 views
Skip to first unread message

KP

unread,
Feb 20, 2020, 6:24:43 AM2/20/20
to pmem
Hello,

In the "Programming persistent memory" book by Steve Scargall, is the following paragraph:

"These steps are performed together when pmem_persist() is called, or they can be called individually by calling pmem_flush() for the first step and pmem_drain() for the second. Note that either of these steps may be unnecessary on a given platform, and the library knows how to check for that and do what is correct. For example, on Intel platforms, pmem_drain is an empty function."

Just wanted to check if this is accurate.

Thanks,
-Keshav

Andy Rudoff

unread,
Feb 20, 2020, 8:58:13 AM2/20/20
to pmem
Hi,

On platforms with CLFUSHOPT and CLWB, we put just an SFENCE instruction in pmem_drain().  This way you can flush multiple, discontiguous ranges using pmem_flush() and then follow it by a final pmem_drain() and avoid extra fences.  On platforms without those instrructions, CLFLUSH is used and it performs its own fence as part of the instruction, so pmem_drain() is empty.  I think the text in the book was pointing out that on x86 there isn't a specific "drain" instruction since we decided to require ADR on all platforms supporting persistent memory (and as a result got rid of the PCOMMIT instruction).  But on other architectures, there may be a required instruction to drain queues that lead up to the persistent domain.

-andy
Reply all
Reply to author
Forward
0 new messages