qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] balloon: Do not save VM state wrt asynchronous virtio operations
@ 2010-03-09 18:54 Adam Litke
  2010-03-09 19:20 ` [Qemu-devel] " Juan Quintela
  2010-03-17 16:00 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Litke @ 2010-03-09 18:54 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Avi Kivity, Luiz Capitulino, qemu-devel, Juan Quintela

When working with the VM state (for loadvm/savevm and migration), it is not
valid to load and store pointers since the validity of those pointers cannot be
assured in the new qemu address space.  Therefore, virtio_balloon_save() and
virtio_balloon_load() must not handle the stats-related fields in struct
VirtIOBalloon.

If a memory stats request is in-flight at the time of a migration or savevm,
the request will not complete and should be resubmitted once migration or
loadvm completes.  Note that this extremely small race window can only be
triggered using QMP so it is not possible to hang the user monitor.
    
Signed-off-by: Adam Litke <agl@us.ibm.com>

diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index 086d9d1..6d12024 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -261,10 +261,6 @@ static void virtio_balloon_save(QEMUFile *f, void *opaque)
 
     qemu_put_be32(f, s->num_pages);
     qemu_put_be32(f, s->actual);
-    qemu_put_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));
-    qemu_put_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));
-    qemu_put_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));
-    qemu_put_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));
 }
 
 static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
@@ -278,11 +274,6 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
 
     s->num_pages = qemu_get_be32(f);
     s->actual = qemu_get_be32(f);
-    qemu_get_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));
-    qemu_get_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));
-    qemu_get_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));
-    qemu_get_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));
-
     return 0;
 }
 


-- 
Thanks,
Adam

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH] balloon: Do not save VM state wrt asynchronous virtio operations
  2010-03-09 18:54 [Qemu-devel] [PATCH] balloon: Do not save VM state wrt asynchronous virtio operations Adam Litke
@ 2010-03-09 19:20 ` Juan Quintela
  2010-03-17 16:00 ` [Qemu-devel] " Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2010-03-09 19:20 UTC (permalink / raw)
  To: Adam Litke; +Cc: Anthony Liguori, Avi Kivity, qemu-devel, Luiz Capitulino

Adam Litke <agl@us.ibm.com> wrote:
> When working with the VM state (for loadvm/savevm and migration), it is not
> valid to load and store pointers since the validity of those pointers cannot be
> assured in the new qemu address space.  Therefore, virtio_balloon_save() and
> virtio_balloon_load() must not handle the stats-related fields in struct
> VirtIOBalloon.
>
> If a memory stats request is in-flight at the time of a migration or savevm,
> the request will not complete and should be resubmitted once migration or
> loadvm completes.  Note that this extremely small race window can only be
> triggered using QMP so it is not possible to hang the user monitor.
>     
> Signed-off-by: Adam Litke <agl@us.ibm.com>

Acked-by: Juan Quintela <quintela@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] balloon: Do not save VM state wrt asynchronous virtio operations
  2010-03-09 18:54 [Qemu-devel] [PATCH] balloon: Do not save VM state wrt asynchronous virtio operations Adam Litke
  2010-03-09 19:20 ` [Qemu-devel] " Juan Quintela
@ 2010-03-17 16:00 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-03-17 16:00 UTC (permalink / raw)
  To: Adam Litke
  Cc: qemu-devel, Anthony Liguori, Juan Quintela, Avi Kivity,
	Luiz Capitulino

On 03/09/2010 12:54 PM, Adam Litke wrote:
> When working with the VM state (for loadvm/savevm and migration), it is not
> valid to load and store pointers since the validity of those pointers cannot be
> assured in the new qemu address space.  Therefore, virtio_balloon_save() and
> virtio_balloon_load() must not handle the stats-related fields in struct
> VirtIOBalloon.
>
> If a memory stats request is in-flight at the time of a migration or savevm,
> the request will not complete and should be resubmitted once migration or
> loadvm completes.  Note that this extremely small race window can only be
> triggered using QMP so it is not possible to hang the user monitor.
>
> Signed-off-by: Adam Litke<agl@us.ibm.com>
>    
Applied.  Thanks.

Regards,

Anthony Liguori
> diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
> index 086d9d1..6d12024 100644
> --- a/hw/virtio-balloon.c
> +++ b/hw/virtio-balloon.c
> @@ -261,10 +261,6 @@ static void virtio_balloon_save(QEMUFile *f, void *opaque)
>
>       qemu_put_be32(f, s->num_pages);
>       qemu_put_be32(f, s->actual);
> -    qemu_put_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));
> -    qemu_put_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));
> -    qemu_put_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));
> -    qemu_put_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));
>   }
>
>   static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
> @@ -278,11 +274,6 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
>
>       s->num_pages = qemu_get_be32(f);
>       s->actual = qemu_get_be32(f);
> -    qemu_get_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));
> -    qemu_get_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));
> -    qemu_get_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));
> -    qemu_get_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));
> -
>       return 0;
>   }
>
>
>
>    

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-17 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 18:54 [Qemu-devel] [PATCH] balloon: Do not save VM state wrt asynchronous virtio operations Adam Litke
2010-03-09 19:20 ` [Qemu-devel] " Juan Quintela
2010-03-17 16:00 ` [Qemu-devel] " Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).