All of lore.kernel.org
 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>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Matthew Wilcox <willy@linux.intel.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH v2 6/7] dax: update I/O path to do proper PMEM flushing
Date: Fri, 14 Aug 2015 10:48:57 -0600	[thread overview]
Message-ID: <1439570937.16263.2.camel@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4gPHTczq6HjK3dPmL0oSjkJmSnAX_gx7x04XtgtrzYZ+A@mail.gmail.com>

On Thu, 2015-08-13 at 14:11 -0700, Dan Williams wrote:
> On Thu, Aug 13, 2015 at 9:51 AM, Ross Zwisler
> <ross.zwisler@linux.intel.com> wrote:
> > Update the DAX I/O path so that all operations that store data (I/O
> > writes, zeroing blocks, punching holes, etc.) properly synchronize the
> > stores to media using the PMEM API.  This ensures that the data DAX is
> > writing is durable on media before the operation completes.
> >
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> [..]
> > @@ -145,18 +147,27 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
> >                                 retval = dax_get_addr(bh, &addr, blkbits);
> >                                 if (retval < 0)
> >                                         break;
> > -                               if (buffer_unwritten(bh) || buffer_new(bh))
> > +                               if (buffer_unwritten(bh) || buffer_new(bh)) {
> >                                         dax_new_buf(addr, retval, first, pos,
> >                                                                         end);
> > +                                       need_wmb = true;
> > +                               }
> >                                 addr += first;
> >                                 size = retval - first;
> >                         }
> >                         max = min(pos + size, end);
> >                 }
> >
> > -               if (iov_iter_rw(iter) == WRITE)
> > +               if (iov_iter_rw(iter) == WRITE) {
> >                         len = copy_from_iter_nocache(addr, max - pos, iter);
> > -               else if (!hole)
> > +                       /*
> > +                        * copy_from_iter_nocache() uses non-temporal stores
> > +                        * for iovec iterators so we can skip the write back.
> > +                        */
> > +                       if (!iter_is_iovec(iter))
> > +                               wb_cache_pmem((void __pmem *)addr, max - pos);
> > +                       need_wmb = true;
> 
> I think this should become copy_from_iter_pmem() and hide the
> wb_cache_pmem() as an internal arch detail.  I.e. wb_cache_pmem()
> should not be a global api when its usage is architecture specific.
> Otherwise are you asserting that all architecture implementations of
> copy_from_iter_nocache() are pmem safe?

Great point.  Nope, copy_from_iter_nocache() uses __copy_from_user_nocache(),
which just defaults to __copy_from_user() on non-x86.  Dang, the PMEM API just
keeps growing...  :(



WARNING: multiple messages have this Message-ID (diff)
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>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>,
	Matthew Wilcox <willy@linux.intel.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH v2 6/7] dax: update I/O path to do proper PMEM flushing
Date: Fri, 14 Aug 2015 10:48:57 -0600	[thread overview]
Message-ID: <1439570937.16263.2.camel@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4gPHTczq6HjK3dPmL0oSjkJmSnAX_gx7x04XtgtrzYZ+A@mail.gmail.com>

On Thu, 2015-08-13 at 14:11 -0700, Dan Williams wrote:
> On Thu, Aug 13, 2015 at 9:51 AM, Ross Zwisler
> <ross.zwisler@linux.intel.com> wrote:
> > Update the DAX I/O path so that all operations that store data (I/O
> > writes, zeroing blocks, punching holes, etc.) properly synchronize the
> > stores to media using the PMEM API.  This ensures that the data DAX is
> > writing is durable on media before the operation completes.
> >
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> [..]
> > @@ -145,18 +147,27 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
> >                                 retval = dax_get_addr(bh, &addr, blkbits);
> >                                 if (retval < 0)
> >                                         break;
> > -                               if (buffer_unwritten(bh) || buffer_new(bh))
> > +                               if (buffer_unwritten(bh) || buffer_new(bh)) {
> >                                         dax_new_buf(addr, retval, first, pos,
> >                                                                         end);
> > +                                       need_wmb = true;
> > +                               }
> >                                 addr += first;
> >                                 size = retval - first;
> >                         }
> >                         max = min(pos + size, end);
> >                 }
> >
> > -               if (iov_iter_rw(iter) == WRITE)
> > +               if (iov_iter_rw(iter) == WRITE) {
> >                         len = copy_from_iter_nocache(addr, max - pos, iter);
> > -               else if (!hole)
> > +                       /*
> > +                        * copy_from_iter_nocache() uses non-temporal stores
> > +                        * for iovec iterators so we can skip the write back.
> > +                        */
> > +                       if (!iter_is_iovec(iter))
> > +                               wb_cache_pmem((void __pmem *)addr, max - pos);
> > +                       need_wmb = true;
> 
> I think this should become copy_from_iter_pmem() and hide the
> wb_cache_pmem() as an internal arch detail.  I.e. wb_cache_pmem()
> should not be a global api when its usage is architecture specific.
> Otherwise are you asserting that all architecture implementations of
> copy_from_iter_nocache() are pmem safe?

Great point.  Nope, copy_from_iter_nocache() uses __copy_from_user_nocache(),
which just defaults to __copy_from_user() on non-x86.  Dang, the PMEM API just
keeps growing...  :(



  reply	other threads:[~2015-08-14 16:48 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 16:51 [PATCH v2 0/7] dax: I/O path enhancements Ross Zwisler
2015-08-13 16:51 ` Ross Zwisler
2015-08-13 16:51 ` Ross Zwisler
2015-08-13 16:51 ` [PATCH v2 1/7] brd: make rd_size static Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 16:51 ` [PATCH v2 2/7] pmem, x86: move x86 PMEM API to new pmem.h header Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-15  8:58   ` Christoph Hellwig
2015-08-15  8:58     ` Christoph Hellwig
2015-08-13 16:51 ` [PATCH v2 3/7] pmem: remove layer when calling arch_has_wmb_pmem() Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 16:51 ` [PATCH v2 4/7] pmem, x86: clean up conditional pmem includes Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 16:51 ` [PATCH v2 5/7] pmem: add wb_cache_pmem() and clear_pmem() Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 16:51 ` [PATCH v2 6/7] dax: update I/O path to do proper PMEM flushing Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 21:11   ` Dan Williams
2015-08-13 21:11     ` Dan Williams
2015-08-14 16:48     ` Ross Zwisler [this message]
2015-08-14 16:48       ` Ross Zwisler
2015-08-13 16:51 ` [PATCH v2 7/7] pmem, dax: have direct_access use __pmem annotation Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 16:51   ` Ross Zwisler
2015-08-13 21:20   ` Dan Williams
2015-08-13 21:20     ` Dan Williams
2015-08-13 21:20     ` Dan Williams
2015-08-14 16:55     ` Ross Zwisler
2015-08-14 16:55       ` Ross Zwisler
2015-08-14 16:55       ` Ross Zwisler
2015-08-14 16:58       ` Dan Williams
2015-08-14 16:58         ` Dan Williams
2015-08-14 16:58         ` Dan Williams
2015-08-15  9:11         ` Christoph Hellwig
2015-08-15  9:11           ` Christoph Hellwig
2015-08-15  9:11           ` Christoph Hellwig
2015-08-15 15:49           ` Dan Williams
2015-08-15 15:49             ` Dan Williams
2015-08-15 15:49             ` Dan Williams
2015-08-15  9:19   ` Christoph Hellwig
2015-08-15  9:19     ` Christoph Hellwig
2015-08-15  9:19     ` Christoph Hellwig
2015-08-15 15:44     ` Dan Williams
2015-08-15 15:44       ` Dan Williams
2015-08-15 15:44       ` Dan Williams
2015-08-15 16:00       ` Christoph Hellwig
2015-08-15 16:00         ` Christoph Hellwig
2015-08-15 16:00         ` Christoph Hellwig
2015-08-15 18:05         ` Dan Williams
2015-08-15 18:05           ` Dan Williams
2015-08-15 18:05           ` Dan Williams
2015-08-17 20:07       ` Ross Zwisler
2015-08-17 20:07         ` Ross Zwisler
2015-08-17 20:07         ` Ross Zwisler

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=1439570937.16263.2.camel@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.