On Wed, 2015-08-26 at 21:34 +0000, Williams, Dan J wrote:
> On Wed, 2015-08-26 at 14:41 +0200, Christoph Hellwig wrote:
> > I like the intent behind this, but not the implementation.
> > 
> > I think the right approach is to keep the defaults in linux/pmem.h
> > and simply not set CONFIG_ARCH_HAS_PMEM_API for x86-32.
> 
> Yes, that makes things much cleaner.  Revised patch and changelog below:
> 
> 8<----
> Subject: x86, pmem: clarify that ARCH_HAS_PMEM_API implies PMEM mapped WB
> 
> From: Dan Williams <dan.j.willi...@intel.com>
> 
> Given that a write-back (WB) mapping plus non-temporal stores is
> expected to be the most efficient way to access PMEM, update the
> definition of ARCH_HAS_PMEM_API to imply arch support for
> WB-mapped-PMEM.  This is needed as a pre-requisite for adding PMEM to
> the direct map and mapping it with struct page.
> 
> The above clarification for X86_64 means that memcpy_to_pmem() is
> permitted to use the non-temporal arch_memcpy_to_pmem() rather than
> needlessly fall back to default_memcpy_to_pmem() when the pcommit
> instruction is not available.  When arch_memcpy_to_pmem() is not
> guaranteed to flush writes out of cache, i.e. on older X86_32
> implementations where non-temporal stores may just dirty cache,
> ARCH_HAS_PMEM_API is simply disabled.
> 
> The default fall back for persistent memory handling remains.  Namely,
> map it with the WT (write-through) cache-type and hope for the best.
> 
> arch_has_pmem_api() is updated to only indicate whether the arch
> provides the proper helpers to meet the minimum "writes are visible
> outside the cache hierarchy after memcpy_to_pmem() + wmb_pmem()".  Code
> that cares whether wmb_pmem() actually flushes writes to pmem must now
> call arch_has_wmb_pmem() directly.
> 
> Cc: Thomas Gleixner <t...@linutronix.de>
> Cc: Ingo Molnar <mi...@redhat.com>
> Cc: "H. Peter Anvin" <h...@zytor.com>
> Cc: Toshi Kani <toshi.k...@hp.com>
> Cc: Ross Zwisler <ross.zwis...@linux.intel.com>
> Cc: Christoph Hellwig <h...@lst.de>
> [hch: set ARCH_HAS_PMEM_API=n on X86_32]
> Signed-off-by: Dan Williams <dan.j.willi...@intel.com>

Thanks for making this change!  It looks good.

Reviewed-by: Toshi Kani <toshi.k...@hp.com>

I have one minor comment below:

> ---
>  arch/x86/Kconfig            |    2 +-
>  arch/x86/include/asm/io.h   |    2 --
>  arch/x86/include/asm/pmem.h |    8 ++------
>  drivers/acpi/nfit.c         |    2 +-
>  drivers/nvdimm/pmem.c       |    2 +-
>  include/linux/pmem.h        |   28 +++++++++++++++++-----------
>  6 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 76c61154ed50..5912859df533 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -27,7 +27,7 @@ config X86
>       select ARCH_HAS_ELF_RANDOMIZE
>       select ARCH_HAS_FAST_MULTIPLIER
>       select ARCH_HAS_GCOV_PROFILE_ALL
> -     select ARCH_HAS_PMEM_API
> +     select ARCH_HAS_PMEM_API                if X86_64
>       select ARCH_HAS_SG_CHAIN
>       select ARCH_HAVE_NMI_SAFE_CMPXCHG
>       select ARCH_MIGHT_HAVE_ACPI_PDC         if ACPI
> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> index d241fbd5c87b..83ec9b1d77cc 100644
> --- a/arch/x86/include/asm/io.h
> +++ b/arch/x86/include/asm/io.h
> @@ -248,8 +248,6 @@ static inline void flush_write_buffers(void)
>  #endif
>  }
>  
> -#define ARCH_MEMREMAP_PMEM MEMREMAP_WB

Should it be better to do:

#else   /* !CONFIG_ARCH_HAS_PMEM_API */
#define ARCH_MEMREMAP_PMEM MEMREMAP_WT

so that you can remove all '#ifdef ARCH_MEMREMAP_PMEM' stuff?

Thanks,
-Toshi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to