From: Ira Weiny <ira.weiny@intel.com>
To: Philip Chen <philipchen@chromium.org>,
Pankaj Gupta <pankaj.gupta.linux@gmail.com>,
Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Ira Weiny <ira.weiny@intel.com>
Cc: <virtualization@lists.linux.dev>, <nvdimm@lists.linux.dev>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virtio_pmem: Add freeze/restore callbacks
Date: Wed, 4 Sep 2024 12:53:50 -0500 [thread overview]
Message-ID: <66d89eaeb0a4b_1e9158294e1@iweiny-mobl.notmuch> (raw)
In-Reply-To: <CA+cxXhneUKWr+VGOjmOtWERA53WGcubjWBuFbVBBuJhNhSoBcQ@mail.gmail.com>
Philip Chen wrote:
> Hi maintainers,
>
> Can anyone let me know if this patch makes sense?
> Any comment/feedback is appreciated.
> Thanks in advance!
I'm not an expert on virtio but the code looks ok on the surface. I've
discussed this with Dan a bit and virtio-pmem is not heavily tested.
Based on our discussion [1] I wonder if there is a way we can recreate this
with QEMU to incorporate into our testing?
Ira
[1] https://lore.kernel.org/lkml/CA+cxXhnb2i5O7_BiOfKLth5Zwp5T62d6F6c39vnuT53cUkU_uw@mail.gmail.com/
>
> On Wed, Aug 14, 2024 at 5:46 PM Philip Chen <philipchen@chromium.org> wrote:
> >
> > Add basic freeze/restore PM callbacks to support hibernation (S4):
> > - On freeze, delete vq and quiesce the device to prepare for
> > snapshotting.
> > - On restore, re-init vq and mark DRIVER_OK.
> >
> > Signed-off-by: Philip Chen <philipchen@chromium.org>
> > ---
> > drivers/nvdimm/virtio_pmem.c | 24 ++++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/nvdimm/virtio_pmem.c b/drivers/nvdimm/virtio_pmem.c
> > index c9b97aeabf85..2396d19ce549 100644
> > --- a/drivers/nvdimm/virtio_pmem.c
> > +++ b/drivers/nvdimm/virtio_pmem.c
> > @@ -143,6 +143,28 @@ static void virtio_pmem_remove(struct virtio_device *vdev)
> > virtio_reset_device(vdev);
> > }
> >
> > +static int virtio_pmem_freeze(struct virtio_device *vdev)
> > +{
> > + vdev->config->del_vqs(vdev);
> > + virtio_reset_device(vdev);
> > +
> > + return 0;
> > +}
> > +
> > +static int virtio_pmem_restore(struct virtio_device *vdev)
> > +{
> > + int ret;
> > +
> > + ret = init_vq(vdev->priv);
> > + if (ret) {
> > + dev_err(&vdev->dev, "failed to initialize virtio pmem's vq\n");
> > + return ret;
> > + }
> > + virtio_device_ready(vdev);
> > +
> > + return 0;
> > +}
> > +
> > static unsigned int features[] = {
> > VIRTIO_PMEM_F_SHMEM_REGION,
> > };
> > @@ -155,6 +177,8 @@ static struct virtio_driver virtio_pmem_driver = {
> > .validate = virtio_pmem_validate,
> > .probe = virtio_pmem_probe,
> > .remove = virtio_pmem_remove,
> > + .freeze = virtio_pmem_freeze,
> > + .restore = virtio_pmem_restore,
> > };
> >
> > module_virtio_driver(virtio_pmem_driver);
> > --
> > 2.46.0.76.ge559c4bf1a-goog
> >
next prev parent reply other threads:[~2024-09-04 17:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 0:46 [PATCH] virtio_pmem: Add freeze/restore callbacks Philip Chen
2024-08-24 2:06 ` Philip Chen
2024-09-04 17:53 ` Ira Weiny [this message]
2024-09-09 23:52 ` Philip Chen
2024-09-23 16:47 ` Philip Chen
2024-09-25 7:30 ` Pankaj Gupta
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=66d89eaeb0a4b_1e9158294e1@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=pankaj.gupta.linux@gmail.com \
--cc=philipchen@chromium.org \
--cc=virtualization@lists.linux.dev \
--cc=vishal.l.verma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox