From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ross Zwisler Subject: Re: [PATCH] nd_blk: add support for "read flush" DSM flag Date: Fri, 14 Aug 2015 15:07:21 -0600 Message-ID: <1439586441.16263.6.camel@linux.intel.com> References: <1439585008-30192-1-git-send-email-ross.zwisler@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com ([192.55.52.93]:18119 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbbHNVHZ (ORCPT ); Fri, 14 Aug 2015 17:07:25 -0400 In-Reply-To: Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Dan Williams Cc: "linux-kernel@vger.kernel.org" , Christoph Jaeger , Juergen Gross , X86 ML , Yalin Wang , "linux-nvdimm@lists.01.org" , Will Deacon , Rusty Russell , "Rafael J. Wysocki" , Linux ACPI , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Russell King , Borislav Petkov , Andrew Morton , Dan Streetman , Len Brown On Fri, 2015-08-14 at 14:05 -0700, Dan Williams wrote: > On Fri, Aug 14, 2015 at 1:43 PM, Ross Zwisler > wrote: > > Add support for the "read flush" _DSM flag, as outlined in the DSM spec: > > > > http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf > > > > This flag tells the ND BLK driver that it needs to flush the cache lines > > associated with the aperture after the aperture is moved but before any > > new data is read. This ensures that any stale cache lines from the > > previous contents of the aperture will be discarded from the processor > > cache, and the new data will be read properly from the DIMM. We know > > that the cache lines are clean and will be discarded without any > > writeback because either a) the previous aperture operation was a read, > > and we never modified the contents of the aperture, or b) the previous > > aperture operation was a write and we must have written back the dirtied > > contents of the aperture to the DIMM before the I/O was completed. > > > > By supporting the "read flush" flag we can also change the ND BLK > > aperture mapping from write-combining to write-back via memremap(). > > > > In order to add support for the "read flush" flag I needed to add a > > generic routine to invalidate cache lines, mmio_flush_range(). This is > > protected by the ARCH_HAS_MMIO_FLUSH Kconfig variable, and is currently > > only supported on x86. > > > > Signed-off-by: Ross Zwisler > > --- > > arch/x86/Kconfig | 1 + > > arch/x86/include/asm/cacheflush.h | 2 ++ > > drivers/acpi/Kconfig | 1 + > > drivers/acpi/nfit.c | 55 ++++++++++++++++++++++----------------- > > drivers/acpi/nfit.h | 16 ++++++++---- > > lib/Kconfig | 3 +++ > > 6 files changed, 49 insertions(+), 29 deletions(-) > > > [..] > > diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c > > index 628a42c..816c778 100644 > > --- a/drivers/acpi/nfit.c > > +++ b/drivers/acpi/nfit.c > [..] > > @@ -1206,20 +1214,19 @@ static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, > > if (!res) > > goto err_mem; > > > > - if (type == SPA_MAP_APERTURE) { > > - /* > > - * TODO: memremap_pmem() support, but that requires cache > > - * flushing when the aperture is moved. > > - */ > > - spa_map->iomem = ioremap_wc(start, n); > > - } else > > - spa_map->iomem = ioremap_nocache(start, n); > > + spa_map->type = type; > > + if (type == SPA_MAP_APERTURE) > > + spa_map->addr.aperture = (void __pmem *)memremap(start, n, > > + MEMREMAP_WB); > > This should be s/MEMREMAP_WB/ARCH_MEMREMAP_PMEM/, but other than that > looks good to me. > > I also should go move ARCH_MEMREMAP_PMEM over to > arch/x86/include/asm/pmem.h and fold it in to your other pending > pmem-api cleanups. Sounds good. Would you like a v2 with those changes, or would you rather fix it as you apply it to the nvdimm tree?