All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mitsyanko Igor <i.mitsyanko@samsung.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] vmstate: introduce calc_size VMStateField
Date: Tue, 27 Dec 2011 12:11:38 +0400	[thread overview]
Message-ID: <4EF97DBA.9040604@samsung.com> (raw)
In-Reply-To: <CAFEAcA_f8CT3h8mOQ30OdmSFNepxYKmVHsw7dL_81wRwR0JpwA@mail.gmail.com>

On 12/26/2011 07:20 PM, Peter Maydell wrote:
> On 26 December 2011 10:03, Mitsyanko Igor<i.mitsyanko@samsung.com>  wrote:
>> New calc_size field in VMStateField is supposed to help us easily add save/restore
>> support of dynamically allocated buffers in device's states.
>> There are some cases when information on size of dynamically allocated buffer is
>> already presented in specific device's state structure, but in such a form, that
>> can not be used with existing VMStateField interface. Currently, we either can get size from
>> another variable in device's state as it is with VMSTATE_VBUFFER_* macros, or we can
>> also multiply value kept in a variable by a constant with VMSTATE_BUFFER_MULTIPLY
>> macro. If we need to perform any other action, we're forced to add additional
>> variable with size information to device state structure with the only intention
>> to use it in VMStateDescription structure. This approach is not very pretty. Adding extra
>> flags to VMStateFlags enum for every other possible operation with size field
>> seems redundant, and still it would't cover cases when we need to perform a set of
>> operations to get size value.
>> With this new .calc_size field we can calculate size of dynamic array in whichever
>> way we need.
>>
>> Signed-off-by: Mitsyanko Igor<i.mitsyanko@samsung.com>
>
> It seems a bit curious that this patch removes the existing (although admittedly
> unused) VMSTATE_BUFFER_MULTIPLY but doesn't actually say so in the
> commit message.
>
>> ---
>>   hw/hw.h  |   14 +++++++-------
>>   savevm.c |   14 ++++++++------
>>   2 files changed, 15 insertions(+), 13 deletions(-)
>>
>> diff --git a/hw/hw.h b/hw/hw.h
>> index efa04d1..8ce4475 100644
>> --- a/hw/hw.h
>> +++ b/hw/hw.h
>> @@ -303,9 +303,9 @@ enum VMStateFlags {
>>      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_CALC_SIZE        = 0x200,  /* calculate size of dynamic buffer */
>> +    VMS_VARRAY_UINT8     = 0x400,  /* Array with size in uint8_t field */
>> +    VMS_VARRAY_UINT32    = 0x800,  /* Array with size in uint32_t field */
>
> These unrelated whitespace fixes are confusing -- please drop them.
QEMU wiki here http://wiki.qemu.org/Contribute/SubmitAPatch states that 
it's ok :)
 > It's OK to fix coding style issues in the immediate area (few lines) 
 > of the lines you're changing.)

Given some thoughts to it, I didn't like that this patch increases 
memory consumed by VMStateField. Maybe we should drop existing 
.size_offset field and replace it with generic get_buffsize callback, 
like we did in second version of this patch. It seems reasonable to me, 
even though existing .size_offset usage is pretty neat.

-- 
Mitsyanko Igor
ASWG, Moscow R&D center, Samsung Electronics
email: i.mitsyanko@samsung.com

  reply	other threads:[~2011-12-27  8:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26 10:03 [Qemu-devel] [PATCH 0/3] Improve SD controllers emulation Mitsyanko Igor
2011-12-26 10:03 ` [Qemu-devel] [PATCH 1/3] vmstate: introduce calc_size VMStateField Mitsyanko Igor
2011-12-26 15:20   ` Peter Maydell
2011-12-27  8:11     ` Mitsyanko Igor [this message]
2011-12-27 13:10       ` Andreas Färber
2011-12-28  7:41         ` Mitsyanko Igor
2011-12-27  7:54   ` [Qemu-devel] [PATCH V2 1/3] vmstate: introduce get_bufsize entry in VMStateField Mitsyanko Igor
2011-12-26 10:03 ` [Qemu-devel] [PATCH 2/3] hw/sd.c: add SD card save/load support Mitsyanko Igor
2011-12-26 14:58   ` Peter Maydell
2011-12-27 11:27     ` Mitsyanko Igor
2011-12-27 13:27     ` Andreas Färber
2011-12-27 13:54       ` Mitsyanko Igor
2011-12-27 14:13     ` Avi Kivity
2011-12-27 21:30       ` Peter Maydell
2011-12-28  9:50         ` Avi Kivity
2011-12-26 10:03 ` [Qemu-devel] [PATCH 3/3] hw/: Introduce spec. ver. 2.00 compliant SD host controller Mitsyanko Igor
2011-12-26 11:35   ` malc
2011-12-28 12:08 ` [Qemu-devel] [PATCH V2 0/3] Improve SD controllers emulation Mitsyanko Igor
2011-12-28 12:08   ` [Qemu-devel] [PATCH V2 1/3] vmstate: introduce get_bufsize entry in VMStateField Mitsyanko Igor
2011-12-28 12:08   ` [Qemu-devel] [PATCH V2 2/3] hw/sd.c: add SD card save/load support Mitsyanko Igor
2011-12-28 13:26     ` Peter Maydell
2011-12-28 14:02       ` Mitsyanko Igor
2011-12-28 14:41         ` Peter Maydell
2011-12-28 12:08   ` [Qemu-devel] [PATCH V2 3/3] hw: Introduce spec. ver. 2.00 compliant SD host controller Mitsyanko Igor
2011-12-28 15:32 ` [Qemu-devel] [PATCH V3 0/5] Improve SD controllers emulation Mitsyanko Igor
2011-12-28 15:32   ` [Qemu-devel] [PATCH V3 1/5] vmstate: introduce get_bufsize entry in VMStateField Mitsyanko Igor
2012-01-19 13:40     ` Andreas Färber
2011-12-28 15:32   ` [Qemu-devel] [PATCH V3 2/5] hw/sd.c: add SD card save/load support Mitsyanko Igor
2011-12-28 15:32   ` [Qemu-devel] [PATCH V3 3/5] hw/sd.c: convert wp_groups, expecting_acmd and enable to bool Mitsyanko Igor
2011-12-28 15:32   ` [Qemu-devel] [PATCH V3 4/5] hw/sd.c: convert wp_switch and spi " Mitsyanko Igor
2011-12-28 15:32   ` [Qemu-devel] [PATCH V3 5/5] hw: Introduce spec. ver. 2.00 compliant SD host controller Mitsyanko Igor

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=4EF97DBA.9040604@samsung.com \
    --to=i.mitsyanko@samsung.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.