[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180427133146.GB11150@stefanha-x1.localdomain>
Date: Fri, 27 Apr 2018 14:31:46 +0100
From: Stefan Hajnoczi <stefanha@...hat.com>
To: Pankaj Gupta <pagupta@...hat.com>
Cc: Stefan Hajnoczi <stefanha@...il.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, qemu-devel@...gnu.org,
linux-nvdimm@...1.01.org, linux-mm@...ck.org, kwolf@...hat.com,
haozhong zhang <haozhong.zhang@...el.com>, jack@...e.cz,
xiaoguangrong eric <xiaoguangrong.eric@...il.com>,
riel@...riel.com, niteshnarayanlal@...mail.com, david@...hat.com,
ross zwisler <ross.zwisler@...el.com>, lcapitulino@...hat.com,
hch@...radead.org, mst@...hat.com, imammedo@...hat.com,
marcel@...hat.com, pbonzini@...hat.com,
dan j williams <dan.j.williams@...el.com>, nilal@...hat.com
Subject: Re: [Qemu-devel] [RFC v2 1/2] virtio: add pmem driver
On Thu, Apr 26, 2018 at 11:44:59AM -0400, Pankaj Gupta wrote:
> > > + int err;
> > > +
> > > + sg_init_one(&sg, buf, sizeof(buf));
> > > +
> > > + err = virtqueue_add_outbuf(vpmem->req_vq, &sg, 1, buf, GFP_KERNEL);
> > > +
> > > + if (err) {
> > > + dev_err(&vdev->dev, "failed to send command to virtio pmem device\n");
> > > + return;
> > > + }
> > > +
> > > + virtqueue_kick(vpmem->req_vq);
> >
> > Is any locking necessary? Two CPUs must not invoke virtio_pmem_flush()
> > at the same time. Not sure if anything guarantees this, maybe you're
> > relying on libnvdimm but I haven't checked.
>
> I thought about it to some extent, and wanted to go ahead with simple version first:
>
> - I think file 'inode -> locking' sill is there for request on single file.
> - For multiple files, our aim is to just flush the backend block image.
> - Even there is collision for virt queue read/write entry it should just trigger a Qemu fsync.
> We just want most recent flush to assure guest writes are synced properly.
>
> Important point here: We are doing entire block fsync for guest virtual disk.
I don't understand your answer. Is locking necessary or not?
From the virtqueue_add_outbuf() documentation:
* Caller must ensure we don't call this with other virtqueue operations
* at the same time (except where noted).
Stefan
Download attachment "signature.asc" of type "application/pgp-signature" (456 bytes)
Powered by blists - more mailing lists