Hi Daniel,
I see we've been talking about "pinning" in two contexts on this list, so let me clarify the current Linux support. Common DMA operations to memory also work as expected to persistent memory. For example, if I open a traditional disk with O_DIRECT and then use the read() system call with pmem that was memory mapped from an FS DAX file as the buffer, the system will DMA directly to that pmem and the pages will be pinned during the operation so the file system won't try to relocate them during the DMA.
For RDMA, libraries like libfabric can issue "long-lived" memory registrations, where the pages are pinned and they stay that way between I/O operations and sometimes even across multiple processes. Those RDMA long-lived registrations are currently disallowed on FS DAX. The registration call returns an error, so there's no chance you'll think they are working and the file system moves a page during an I/O. There are two workarounds for people wanting to do RDMA directly to pmem. One is to use Device DAX instead of FS DAX, since it doesn't allow a file system so there's no issue granting the long-lived memory registrations. Another is to use FS DAX with a NIC that supports On Demand Paging (ODP), which is a way to avoid the long-live memory registrations. I'm only aware of one NIC (a Mellanox NIC) that supports ODP today, but the solution works well with FS DAX and I'm hoping to see it show up in other NICs in the future.
By the way, the work the PMDK team did around RDMA is document in four papers that describe what I said above and quite a bit more:
-andy