[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1266554822.23475618.1524912521209.JavaMail.zimbra@redhat.com>
Date: Sat, 28 Apr 2018 06:48:41 -0400 (EDT)
From: Pankaj Gupta <pagupta@...hat.com>
To: Stefan Hajnoczi <stefanha@...hat.com>
Cc: jack@...e.cz, kvm@...r.kernel.org, david@...hat.com,
linux-nvdimm@...1.01.org, ross zwisler <ross.zwisler@...el.com>,
qemu-devel@...gnu.org, lcapitulino@...hat.com, linux-mm@...ck.org,
niteshnarayanlal@...mail.com, mst@...hat.com, hch@...radead.org,
Stefan Hajnoczi <stefanha@...il.com>, marcel@...hat.com,
nilal@...hat.com, haozhong zhang <haozhong.zhang@...el.com>,
riel@...riel.com, pbonzini@...hat.com,
dan j williams <dan.j.williams@...el.com>, kwolf@...hat.com,
xiaoguangrong eric <xiaoguangrong.eric@...il.com>,
linux-kernel@...r.kernel.org, imammedo@...hat.com
Subject: Re: [Qemu-devel] [RFC v2 1/2] virtio: add pmem driver
> > > > + 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?
It will be required with other changes.
>
> 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).
Yes, I also saw it. But thought if can avoid it with current functionality. :)
Thanks,
Pankaj
Powered by blists - more mailing lists