Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751634AbdFIXVS (ORCPT ); Fri, 9 Jun 2017 19:21:18 -0400 Received: from mail-ot0-f181.google.com ([74.125.82.181]:33305 "EHLO mail-ot0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbdFIXVR (ORCPT ); Fri, 9 Jun 2017 19:21:17 -0400 MIME-Version: 1.0 In-Reply-To: <149703990158.20620.16257541455791191783.stgit@dwillia2-desk3.amr.corp.intel.com> References: <149703982465.20620.14881139332926778446.stgit@dwillia2-desk3.amr.corp.intel.com> <149703990158.20620.16257541455791191783.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dan Williams Date: Fri, 9 Jun 2017 16:21:16 -0700 Message-ID: Subject: Re: [PATCH v3 14/14] libnvdimm, pmem: disable dax flushing when pmem is fronting a volatile region To: "linux-nvdimm@lists.01.org" Cc: Jan Kara , dm-devel@redhat.com, Matthew Wilcox , X86 ML , "linux-kernel@vger.kernel.org" , Jeff Moyer , Al Viro , linux-fsdevel , Ross Zwisler , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2288 Lines: 47 On Fri, Jun 9, 2017 at 1:25 PM, Dan Williams wrote: > The pmem driver attaches to both persistent and volatile memory ranges > advertised by the ACPI NFIT. When the region is volatile it is redundant > to spend cycles flushing caches at fsync(). Check if the hosting region > is volatile and do not set QUEUE_FLAG_WC if it is. > > Cc: Jan Kara > Cc: Jeff Moyer > Cc: Christoph Hellwig > Cc: Matthew Wilcox > Cc: Ross Zwisler > Signed-off-by: Dan Williams > --- > drivers/nvdimm/pmem.c | 13 ++++++++----- > drivers/nvdimm/region_devs.c | 6 ++++++ > include/linux/libnvdimm.h | 1 + > 3 files changed, 15 insertions(+), 5 deletions(-) > > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c > index 06f6c27ec1e9..5cac9fb39db8 100644 > --- a/drivers/nvdimm/pmem.c > +++ b/drivers/nvdimm/pmem.c > @@ -279,10 +279,10 @@ static int pmem_attach_disk(struct device *dev, > struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev); > struct nd_region *nd_region = to_nd_region(dev->parent); > struct vmem_altmap __altmap, *altmap = NULL; > + int nid = dev_to_node(dev), fua, wbc; > struct resource *res = &nsio->res; > struct nd_pfn *nd_pfn = NULL; > struct dax_device *dax_dev; > - int nid = dev_to_node(dev); > struct nd_pfn_sb *pfn_sb; > struct pmem_device *pmem; > struct resource pfn_res; > @@ -308,9 +308,12 @@ static int pmem_attach_disk(struct device *dev, > dev_set_drvdata(dev, pmem); > pmem->phys_addr = res->start; > pmem->size = resource_size(res); > - if (!IS_ENABLED(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) > - || nvdimm_has_flush(nd_region) < 0) > - dev_warn(dev, "unable to guarantee persistence of writes\n"); > + fua = nvdimm_has_flush(nd_region); > + if (!IS_ENABLED(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) || fua < 0) > + dev_warn(dev, "unable to guarantee persistence of writes\n"); { I sent this patch with local uncommitted changes. Will send a v2 shortly, and also update stg mail to abort if the tree is dirty.