On Thu, 23 Nov 2017, Dan Williams wrote: > On Thu, Nov 23, 2017 at 12:29 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > >> +/* > >> + * The clflushopt instruction is very slow on Broadwell, so we use non-temporal > >> + * stores instead. > >> + */ > >> +#ifdef CONFIG_X86_64 > >> +#define NT_STORE(dest, src) asm ("movnti %1, %0" : "=m"(dest) : "r"(src)) > >> +#define FLUSH_RANGE(dax, ptr, size) do { } while (0) > >> +#define COMMIT_FLUSHED() wmb() > >> +#else > >> +#define NT_STORE(dest, src) ACCESS_ONCE(dest) = (src) > >> +#define FLUSH_RANGE dax_flush > >> +#define COMMIT_FLUSHED() do { } while (0) > >> +#endif > > > > Please go through the proper pmem APIs. > > Yes, see _copy_from_iter_flushcache() and all its related apis. > Drivers shouldn't be doing anything different than what fs/dax.c is > using. There is not any arch-independent API that abstracts over a single movnti instruction. Do you want to add it? memcpy_flushcache is overkill for one or two 8-byte stores. And - on non-x86 architectures memcpy_flushcache doesn't flush cache at all. Mikulas -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel