linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	linux-nvdimm@lists.01.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Jan Kara <jack@suse.cz>, Alasdair Kergon <agk@redhat.com>,
	dm-devel@redhat.com, "Michael S. Tsirkin" <mst@redhat.com>,
	Yuval Shaia <yuval.shaia@oracle.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Jakub Staron <jstaron@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: dm writecache: reject asynchronous pmem.
Date: Tue, 30 Jun 2020 09:36:33 -0400	[thread overview]
Message-ID: <20200630133546.GA20439@redhat.com> (raw)
In-Reply-To: <20200630141022.GZ21462@kitsune.suse.cz>

On Tue, Jun 30 2020 at 10:10am -0400,
Michal Suchánek <msuchanek@suse.de> wrote:

> On Tue, Jun 30, 2020 at 09:32:01AM -0400, Mikulas Patocka wrote:
> > 
> > 
> > On Tue, 30 Jun 2020, Michal Suchanek wrote:
> > 
> > > The writecache driver does not handle asynchronous pmem. Reject it when
> > > supplied as cache.
> > > 
> > > Link: https://lore.kernel.org/linux-nvdimm/87lfk5hahc.fsf@linux.ibm.com/
> > > Fixes: 6e84200c0a29 ("virtio-pmem: Add virtio pmem driver")
> > > 
> > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > ---
> > >  drivers/md/dm-writecache.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
> > > index 30505d70f423..57b0a972f6fd 100644
> > > --- a/drivers/md/dm-writecache.c
> > > +++ b/drivers/md/dm-writecache.c
> > > @@ -2277,6 +2277,12 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
> > >  
> > >  		wc->memory_map_size -= (uint64_t)wc->start_sector << SECTOR_SHIFT;
> > >  
> > > +		if (!dax_synchronous(wc->ssd_dev->dax_dev)) {
> > > +			r = -EOPNOTSUPP;
> > > +			ti->error = "Asynchronous persistent memory not supported as pmem cache";
> > > +			goto bad;
> > > +		}
> > > +
> > >  		bio_list_init(&wc->flush_list);
> > >  		wc->flush_thread = kthread_create(writecache_flush_thread, wc, "dm_writecache_flush");
> > >  		if (IS_ERR(wc->flush_thread)) {
> > > -- 
> > 
> > Hi
> > 
> > Shouldn't this be in the "if (WC_MODE_PMEM(wc))" block?
> That should be always the case at this point.
> > 
> > WC_MODE_PMEM(wc) retrurns true if we are using persistent memory as a 
> > cache device, otherwise we are using generic block device as a cache 
> > device.
>
> This is to prevent the situation where we have WC_MODE_PMEM(wc) but
> cannot guarantee consistency because the async flush is not handled.

The writecache operates in 2 modes.  SSD or PMEM.  Mikulas is saying
your dax_synchronous() check should go within a WC_MODE_PMEM(wc) block
because it doesn't make sense to do the check when in SSD mode.

Mike


  reply	other threads:[~2020-06-30 14:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 12:35 [PATCH] dm writecache: reject asynchronous pmem Michal Suchanek
2020-06-30 13:32 ` Mikulas Patocka
2020-06-30 14:10   ` Michal Suchánek
2020-06-30 13:36     ` Mike Snitzer [this message]
2020-06-30 14:43       ` Michal Suchánek
2020-06-30 14:53       ` [PATCH v2] " Michal Suchanek
2020-06-30 15:02         ` Mikulas Patocka
2020-06-30 15:49           ` [PATCH v3] " Michal Suchanek
2020-06-30 16:11             ` Mikulas Patocka
2020-06-30 16:14               ` Mikulas Patocka

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=20200630133546.GA20439@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=jack@suse.cz \
    --cc=jstaron@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mpatocka@redhat.com \
    --cc=mst@redhat.com \
    --cc=msuchanek@suse.de \
    --cc=yuval.shaia@oracle.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 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).