diff mbox

[2/9] vmstate: Fix varrays with uint8 indexes

Message ID 186196e777b1723ef1e41679b1b27a064e065e66.1299756608.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela March 10, 2011, 11:33 a.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/hw.h  |    5 +++--
 savevm.c |    2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Yoshiaki Tamura March 18, 2011, 10:34 a.m. UTC | #1
Juan, Anthony,

It seems this patch broke live migration in my environment.  The guest
hangs after switching to remote.  The following is parameters of the
guest.

-L /usr/local/seabios --enable-kvm -M pc -m 512 -smp 1 -monitor stdio
-localtime -boot c -drive file=/vm/fedora13.img,if=virtio -net
nic,macaddr=54:52:00:47:a5:a8,model=virtio -net tap -parallel none
-usb  -vnc :0

Have you seen similar issues?

Thanks,

Yoshi

2011/3/10 Juan Quintela <quintela@redhat.com>:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/hw.h  |    5 +++--
>  savevm.c |    2 ++
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/hw.h b/hw/hw.h
> index 0299207..40c6396 100644
> --- a/hw/hw.h
> +++ b/hw/hw.h
> @@ -298,6 +298,7 @@ enum VMStateFlags {
>     VMS_VARRAY_UINT16    = 0x080,  /* Array with size in uint16_t field */
>     VMS_VBUFFER          = 0x100,  /* Buffer with size in int32_t field */
>     VMS_MULTIPLY         = 0x200,  /* multiply "size" field by field_size */
> +    VMS_VARRAY_UINT8     = 0x400,  /* Array with size in uint8_t field*/
>  };
>
>  typedef struct {
> @@ -489,11 +490,11 @@ extern const VMStateInfo vmstate_info_unused_buffer;
>
>  #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
>     .name       = (stringify(_field)),                               \
> -    .num_offset = vmstate_offset_value(_state, _field_num, uint8_t),  \
> +    .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
>     .version_id = (_version),                                        \
>     .vmsd       = &(_vmsd),                                          \
>     .size       = sizeof(_type),                                     \
> -    .flags      = VMS_STRUCT|VMS_VARRAY_INT32,                       \
> +    .flags      = VMS_STRUCT|VMS_VARRAY_UINT8,                       \
>     .offset     = offsetof(_state, _field),                          \
>  }
>
> diff --git a/savevm.c b/savevm.c
> index ce063d1..4db036b 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1331,6 +1331,8 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>                 n_elems = *(int32_t *)(opaque+field->num_offset);
>             } else if (field->flags & VMS_VARRAY_UINT16) {
>                 n_elems = *(uint16_t *)(opaque+field->num_offset);
> +            } else if (field->flags & VMS_VARRAY_UINT8) {
> +                n_elems = *(uint8_t *)(opaque+field->num_offset);
>             }
>             if (field->flags & VMS_POINTER) {
>                 base_addr = *(void **)base_addr + field->start;
> --
> 1.7.4
>
>
>
Juan Quintela March 18, 2011, 12:04 p.m. UTC | #2
Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> wrote:
> Juan, Anthony,
>
> It seems this patch broke live migration in my environment.  The guest
> hangs after switching to remote.  The following is parameters of the
> guest.
>
> -L /usr/local/seabios --enable-kvm -M pc -m 512 -smp 1 -monitor stdio
> -localtime -boot c -drive file=/vm/fedora13.img,if=virtio -net
> nic,macaddr=54:52:00:47:a5:a8,model=virtio -net tap -parallel none
> -usb  -vnc :0
>
> Have you seen similar issues?

Fix sent to the list, waiting for Anthony to apply it.

Subject: [PATCH] Fix migration uint8 arrys handled

Anthony, please apply that one.

Later, Juan.
Yoshiaki Tamura March 18, 2011, 12:37 p.m. UTC | #3
Ah, now I see what the problem was.

Yoshi

2011/3/18 Juan Quintela <quintela@redhat.com>:
> Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> wrote:
>> Juan, Anthony,
>>
>> It seems this patch broke live migration in my environment.  The guest
>> hangs after switching to remote.  The following is parameters of the
>> guest.
>>
>> -L /usr/local/seabios --enable-kvm -M pc -m 512 -smp 1 -monitor stdio
>> -localtime -boot c -drive file=/vm/fedora13.img,if=virtio -net
>> nic,macaddr=54:52:00:47:a5:a8,model=virtio -net tap -parallel none
>> -usb  -vnc :0
>>
>> Have you seen similar issues?
>
> Fix sent to the list, waiting for Anthony to apply it.
>
> Subject: [PATCH] Fix migration uint8 arrys handled
>
> Anthony, please apply that one.
>
> Later, Juan.
>
>
Yoshiaki Tamura March 22, 2011, 6:23 a.m. UTC | #4
2011/3/18 Juan Quintela <quintela@redhat.com>:
> Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> wrote:
>> Juan, Anthony,
>>
>> It seems this patch broke live migration in my environment.  The guest
>> hangs after switching to remote.  The following is parameters of the
>> guest.
>>
>> -L /usr/local/seabios --enable-kvm -M pc -m 512 -smp 1 -monitor stdio
>> -localtime -boot c -drive file=/vm/fedora13.img,if=virtio -net
>> nic,macaddr=54:52:00:47:a5:a8,model=virtio -net tap -parallel none
>> -usb  -vnc :0
>>
>> Have you seen similar issues?
>
> Fix sent to the list, waiting for Anthony to apply it.
>
> Subject: [PATCH] Fix migration uint8 arrys handled
>
> Anthony, please apply that one.

This patch (commit:b784421ce4cc860315f4ec31bbc3d67e91984074)
actually fixed the problem, but it got broken again by the merge
after the commit...

Yoshi

>
> Later, Juan.
>
>
diff mbox

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 0299207..40c6396 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -298,6 +298,7 @@  enum VMStateFlags {
     VMS_VARRAY_UINT16    = 0x080,  /* Array with size in uint16_t field */
     VMS_VBUFFER          = 0x100,  /* Buffer with size in int32_t field */
     VMS_MULTIPLY         = 0x200,  /* multiply "size" field by field_size */
+    VMS_VARRAY_UINT8     = 0x400,  /* Array with size in uint8_t field*/
 };

 typedef struct {
@@ -489,11 +490,11 @@  extern const VMStateInfo vmstate_info_unused_buffer;

 #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
-    .num_offset = vmstate_offset_value(_state, _field_num, uint8_t),  \
+    .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
     .version_id = (_version),                                        \
     .vmsd       = &(_vmsd),                                          \
     .size       = sizeof(_type),                                     \
-    .flags      = VMS_STRUCT|VMS_VARRAY_INT32,                       \
+    .flags      = VMS_STRUCT|VMS_VARRAY_UINT8,                       \
     .offset     = offsetof(_state, _field),                          \
 }

diff --git a/savevm.c b/savevm.c
index ce063d1..4db036b 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1331,6 +1331,8 @@  int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                 n_elems = *(int32_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT16) {
                 n_elems = *(uint16_t *)(opaque+field->num_offset);
+            } else if (field->flags & VMS_VARRAY_UINT8) {
+                n_elems = *(uint8_t *)(opaque+field->num_offset);
             }
             if (field->flags & VMS_POINTER) {
                 base_addr = *(void **)base_addr + field->start;