lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66d89eaeb0a4b_1e9158294e1@iweiny-mobl.notmuch>
Date: Wed, 4 Sep 2024 12:53:50 -0500
From: Ira Weiny <ira.weiny@...el.com>
To: Philip Chen <philipchen@...omium.org>, Pankaj Gupta
	<pankaj.gupta.linux@...il.com>, Dan Williams <dan.j.williams@...el.com>,
	Vishal Verma <vishal.l.verma@...el.com>, Dave Jiang <dave.jiang@...el.com>,
	Ira Weiny <ira.weiny@...el.com>
CC: <virtualization@...ts.linux.dev>, <nvdimm@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] virtio_pmem: Add freeze/restore callbacks

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@...omium.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@...omium.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
> >



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ