On Thu, May 4, 2017 at 11:54 PM, Ingo Molnar <mingo@xxxxxxxxxx> wrote: > > * Dan Williams <dan.j.williams@xxxxxxxxx> wrote: > >> The pmem driver has a need to transfer data with a persistent memory >> destination and be able to rely on the fact that the destination writes >> are not cached. It is sufficient for the writes to be flushed to a >> cpu-store-buffer (non-temporal / "movnt" in x86 terms), as we expect >> userspace to call fsync() to ensure data-writes have reached a >> power-fail-safe zone in the platform. The fsync() triggers a REQ_FUA or >> REQ_FLUSH to the pmem driver which will turn around and fence previous >> writes with an "sfence". >> >> Implement a __copy_from_user_inatomic_wt, memcpy_page_wt, and memcpy_wt, >> that guarantee that the destination buffer is not dirty in the cpu cache >> on completion. The new copy_from_iter_wt and sub-routines will be used >> to replace the "pmem api" (include/linux/pmem.h + >> arch/x86/include/asm/pmem.h). The availability of copy_from_iter_wt() >> and memcpy_wt() are gated by the CONFIG_ARCH_HAS_UACCESS_WT config >> symbol, and fallback to copy_from_iter_nocache() and plain memcpy() >> otherwise. >> >> This is meant to satisfy the concern from Linus that if a driver wants >> to do something beyond the normal nocache semantics it should be >> something private to that driver [1], and Al's concern that anything >> uaccess related belongs with the rest of the uaccess code [2]. >> >> [1]: https://lists.01.org/pipermail/linux-nvdimm/2017-January/008364.html >> [2]: https://lists.01.org/pipermail/linux-nvdimm/2017-April/009942.html >> >> Cc: <x86@xxxxxxxxxx> >> Cc: Jan Kara <jack@xxxxxxx> >> Cc: Jeff Moyer <jmoyer@xxxxxxxxxx> >> Cc: Ingo Molnar <mingo@xxxxxxxxxx> >> Cc: Christoph Hellwig <hch@xxxxxx> >> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> >> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> >> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> >> Cc: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx> >> Cc: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> >> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> >> --- >> Changes since the initial RFC: >> * s/writethru/wt/ since we already have ioremap_wt(), set_memory_wt(), >> etc. (Ingo) > > Looks good to me. I suspect you'd like to carry this in the nvdimm tree? > > Acked-by: Ingo Molnar <mingo@xxxxxxxxxx> Thanks, Ingo!. Yes, I'll carry it in nvdimm.git for 4.13.