qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mitsyanko <i.mitsyanko@gmail.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, d.solodkiy@samsung.com
Subject: Re: [Qemu-devel] [PATCH 14/36] vmstate: introduce VMSTATE_VARRAY_MULTIPLY
Date: Wed, 21 Mar 2012 23:54:45 +0300	[thread overview]
Message-ID: <4F6A4015.1060808@gmail.com> (raw)
In-Reply-To: <d7a4f2cfdd369effee024d1555bb777ad302d2ac.1332197811.git.quintela@redhat.com>

On 20.03.2012 1:57 AM, Juan Quintela wrote:
> This allows to sent a partial array where the size is another
> structure field multiplied by a constant.
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>
> ---
>   savevm.c  |    6 ++++++
>   vmstate.h |   35 +++++++++++++++++++++++------------
>   2 files changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index 4c42076..17927f1 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1519,6 +1519,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>               } else if (field->flags&  VMS_VARRAY_UINT8) {
>                   n_elems = *(uint8_t *)(opaque+field->num_offset);
>               }
> +            if (field->flags&  VMS_MULTIPLY_ELEMENTS) {
> +                    n_elems *= field->num;
> +            }
>               if (field->flags&  VMS_POINTER) {
>                   base_addr = *(void **)base_addr + field->start;
>               }
> @@ -1583,6 +1586,9 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
>               } else if (field->flags&  VMS_VARRAY_UINT8) {
>                   n_elems = *(uint8_t *)(opaque+field->num_offset);
>               }
> +            if (field->flags&  VMS_MULTIPLY_ELEMENTS) {
> +                    n_elems *= field->num;
> +            }
>               if (field->flags&  VMS_POINTER) {
>                   base_addr = *(void **)base_addr + field->start;
>               }



> diff --git a/vmstate.h b/vmstate.h
> index b8ac2d0..b0225e9 100644
> --- a/vmstate.h
> +++ b/vmstate.h
> @@ -64,18 +64,19 @@ struct VMStateInfo {
>   };
>
>   enum VMStateFlags {
> -    VMS_SINGLE           = 0x001,
> -    VMS_POINTER          = 0x002,
> -    VMS_ARRAY            = 0x004,
> -    VMS_STRUCT           = 0x008,
> -    VMS_VARRAY_INT32     = 0x010,  /* Array with size in int32_t field*/
> -    VMS_BUFFER           = 0x020,  /* static sized buffer */
> -    VMS_ARRAY_OF_POINTER = 0x040,
> -    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*/
> -    VMS_VARRAY_UINT32    = 0x800,  /* Array with size in uint32_t field*/
> +    VMS_SINGLE            = 0x001,
> +    VMS_POINTER           = 0x002,
> +    VMS_ARRAY             = 0x004,
> +    VMS_STRUCT            = 0x008,
> +    VMS_VARRAY_INT32      = 0x010,  /* Array with size in int32_t field*/
> +    VMS_BUFFER            = 0x020,  /* static sized buffer */
> +    VMS_ARRAY_OF_POINTER  = 0x040,
> +    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*/
> +    VMS_VARRAY_UINT32     = 0x800,  /* Array with size in uint32_t field*/
> +    VMS_MULTIPLY_ELEMENTS = 0x1000,  /* multiply "size" field by field_size */
>   };
>

You forgot to change a comment here.

>   typedef struct {
> @@ -200,6 +201,16 @@ extern const VMStateDescription vmstate_cpu;
>       .offset     = vmstate_offset_array(_state, _field, _type, _num), \
>   }
>
> +#define VMSTATE_VARRAY_MULTIPLY(_field, _state, _field_num, _multiply, _info, _type) { \
> +    .name       = (stringify(_field)),                               \
> +    .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
> +    .num        = (_multiply),                                       \
> +    .info       =&(_info),                                          \
> +    .size       = sizeof(_type),                                     \
> +    .flags      = VMS_VARRAY_UINT32|VMS_MULTIPLY_ELEMENTS,           \
> +    .offset     = offsetof(_state, _field),                          \
> +}
> +

Why just "VMSTATE_VARRAY_MULTIPLY" when you use VMS_VARRAY_UINT32 flag? 
Probably should be VMSTATE_VARRAY_UINT32_MULTIPLY


>   #define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
>       .name         = (stringify(_field)),                              \
>       .field_exists = (_test),                                          \

  reply	other threads:[~2012-03-21 19:54 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 22:57 [Qemu-devel] [PATCH v4 00/36] VMState port of all cpus Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 01/36] vmstate: Simplify test for CPU_SAVE_VERSION Juan Quintela
2012-03-21 20:35   ` Michael Roth
2012-03-19 22:57 ` [Qemu-devel] [PATCH 02/36] vmstate: make all architectures export a way to migrate cpu's Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 03/36] vmstate: unicore32 don't support cpu migration Juan Quintela
2012-03-21 20:49   ` Michael Roth
2012-03-19 22:57 ` [Qemu-devel] [PATCH 04/36] vmstate: use new cpu style for x86 Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 05/36] vmstate: use new style for lm32 cpus Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 06/36] vmstate: make microblaze cpus not migrateable Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 07/36] vmstate: port cris cpu to vmstate Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 08/36] vmstate: machine.c is only compiled for !CONFIG_USER_ONLY Juan Quintela
2012-03-21 18:09   ` Andreas Färber
2012-03-21 19:20   ` Peter Maydell
2012-03-19 22:57 ` [Qemu-devel] [PATCH 09/36] vmstate: introduce float32 arrays Juan Quintela
2012-03-20 14:11   ` Peter Maydell
2012-03-20 15:20     ` Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 10/36] vmstate: introduce float64 arrays Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 11/36] vmstate: introduce CPU_DoubleU arrays Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 12/36] vmstate: Introduce VMSTATE_STRUCT_VARRAY_INT32_TEST Juan Quintela
2012-03-21 20:16   ` Igor Mitsyanko
2012-03-19 22:57 ` [Qemu-devel] [PATCH 13/36] vmstate: port ppc cpu Juan Quintela
2012-03-21 21:52   ` Michael Roth
2012-03-21 21:56   ` Peter Maydell
2012-03-19 22:57 ` [Qemu-devel] [PATCH 14/36] vmstate: introduce VMSTATE_VARRAY_MULTIPLY Juan Quintela
2012-03-21 20:54   ` Igor Mitsyanko [this message]
2012-03-19 22:57 ` [Qemu-devel] [PATCH 15/36] vmstate: define vmstate_info_uinttls Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 16/36] vmstate: port sparc cpu Juan Quintela
2012-03-21 22:46   ` Michael Roth
2012-03-24 12:32     ` Blue Swirl
2012-03-19 22:57 ` [Qemu-devel] [PATCH 17/36] vmstate: make incompatible change for sparc Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 18/36] mips_fulong2e: cpu vmstate already registered in cpu_exec_init Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 19/36] mips: make mvp an embedded struct instead of a pointer Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 20/36] mips: make tlb " Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 21/36] mips: bump migration version to 4 Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 22/36] vmstate: port mips cpu Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 23/36] arm: save always 32 fpu registers Juan Quintela
2012-03-20 11:54   ` Peter Maydell
2012-03-20 12:27     ` Juan Quintela
2012-03-20 13:48       ` Peter Maydell
2012-03-19 22:57 ` [Qemu-devel] [PATCH 24/36] vmstate: port arm cpu Juan Quintela
2012-03-21 16:29   ` Andreas Färber
2012-03-21 16:42     ` Peter Maydell
2012-03-21 17:16     ` Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 25/36] vmstate: all cpus converted Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 26/36] vmstate: fix vmstate formating for i386 Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 27/36] vmstate: remove unneeded includes from target-*/machine.c Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 28/36] vmstate: rename machine.c to vmstate-cpu.c Juan Quintela
2012-03-22 12:42   ` Andreas Färber
2012-03-22 13:13     ` Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 29/36] vmstate: Add copyright info for alpha processor Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 30/36] vmstate: Add copyright info for lm32 processor Juan Quintela
2012-03-19 22:57 ` [Qemu-devel] [PATCH 31/36] vmstate: Add copyright info for cris processor Juan Quintela
2012-03-19 22:58 ` [Qemu-devel] [PATCH 32/36] vmstate: Add copyright info for arm processor Juan Quintela
2012-03-19 22:58 ` [Qemu-devel] [PATCH 33/36] vmstate: Add copyright info for i386 processor Juan Quintela
2012-03-19 22:58 ` [Qemu-devel] [PATCH 34/36] vmstate: Add copyright info for mips processor Juan Quintela
2012-03-19 22:58 ` [Qemu-devel] [PATCH 35/36] vmstate: Add copyright info for ppc processor Juan Quintela
2012-03-19 22:58 ` [Qemu-devel] [PATCH 36/36] vmstate: Add copyright info for sparc processor Juan Quintela
2012-03-21 17:13 ` [Qemu-devel] [PATCH v4 00/36] VMState port of all cpus Andreas Färber
2012-03-21 17:24   ` Juan Quintela
2012-03-21 18:43     ` Andreas Färber

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=4F6A4015.1060808@gmail.com \
    --to=i.mitsyanko@gmail.com \
    --cc=d.solodkiy@samsung.com \
    --cc=i.mitsyanko@samsung.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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;
as well as URLs for NNTP newsgroup(s).