Messages in this thread | | | Date | Mon, 3 Oct 2011 11:24:44 +0200 | From | "Michael S. Tsirkin" <> | Subject | Re: [PATCH 06/11] virtio: blk: Add freeze, restore handlers to support S4 |
| |
On Mon, Oct 03, 2011 at 02:46:46PM +0530, Amit Shah wrote: > On (Sun) 02 Oct 2011 [11:37:33], Michael S. Tsirkin wrote: > > On Thu, Sep 29, 2011 at 08:56:02PM +0530, Amit Shah wrote: > > > Delete the vq on the freeze callback to prepare for hibernation. > > > Re-create the vq in the restore callback to resume normal function. > > > > > > Signed-off-by: Amit Shah <amit.shah@redhat.com> > > > --- > > > drivers/block/virtio_blk.c | 17 +++++++++++++++++ > > > 1 files changed, 17 insertions(+), 0 deletions(-) > > > > > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > > > index 509760b..9844d2c 100644 > > > --- a/drivers/block/virtio_blk.c > > > +++ b/drivers/block/virtio_blk.c > > > @@ -549,6 +549,19 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) > > > kfree(vblk); > > > } > > > > > > +#ifdef CONFIG_PM > > > +static int virtblk_freeze(struct virtio_device *vdev) > > > +{ > > > + vdev->config->del_vqs(vdev); > > > > What prevents the guest from trying to use the VQ while > > this is in progress? IF it does, what prevents a crash? > > An oversight: Sasha pointed this out, too, and I've now fixed this by > adding a call to vdev->config->reset() before deleting vqs. > > Amit
This stops the host from accessing the VQ, but does not stop the *guest*.
| |