linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Christoph Jaeger <cj@linux.com>, Juergen Gross <jgross@suse.com>,
	X86 ML <x86@kernel.org>, Yalin Wang <Yalin.Wang@sonymobile.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Will Deacon <will.deacon@arm.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Borislav Petkov <bp@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Streetman <ddstreet@ieee.org>, Len Brown <lenb@kernel.org>
Subject: Re: [PATCH] nd_blk: add support for "read flush" DSM flag
Date: Fri, 14 Aug 2015 15:07:21 -0600	[thread overview]
Message-ID: <1439586441.16263.6.camel@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4jxw5rP2UoBF5gKW4tWtcKCj6Z0iXqwbWSCNv9TpjRGEQ@mail.gmail.com>

On Fri, 2015-08-14 at 14:05 -0700, Dan Williams wrote:
> On Fri, Aug 14, 2015 at 1:43 PM, Ross Zwisler
> <ross.zwisler@linux.intel.com> 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 <ross.zwisler@linux.intel.com>
> > ---
> >  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?



  reply	other threads:[~2015-08-14 21:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 20:43 [PATCH] nd_blk: add support for "read flush" DSM flag Ross Zwisler
2015-08-14 21:05 ` Dan Williams
2015-08-14 21:07   ` Ross Zwisler [this message]
2015-08-14 21:28     ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439586441.16263.6.camel@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=Yalin.Wang@sonymobile.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=cj@linux.com \
    --cc=dan.j.williams@intel.com \
    --cc=ddstreet@ieee.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mingo@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).