From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7orI-0003R5-2V for qemu-devel@nongnu.org; Wed, 14 Mar 2012 10:07:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7orB-0007kO-FI for qemu-devel@nongnu.org; Wed, 14 Mar 2012 10:07:19 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:18144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7orB-0007jX-8y for qemu-devel@nongnu.org; Wed, 14 Mar 2012 10:07:13 -0400 Received: from euspt2 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M0V00M25OJU8KA0@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 14 Mar 2012 14:07:06 +0000 (GMT) Received: from [106.109.8.162] by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M0V002PQOJTBS@spt2.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 14 Mar 2012 14:07:06 +0000 (GMT) Date: Wed, 14 Mar 2012 18:07:05 +0400 From: Igor Mitsyanko In-reply-to: <4F60955E.6060204@suse.de> Message-id: <4F60A609.4070502@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-15; format=flowed Content-transfer-encoding: QUOTED-PRINTABLE References: <1330936245-2570-1-git-send-email-i.mitsyanko@samsung.com> <1330936245-2570-6-git-send-email-i.mitsyanko@samsung.com> <4F60955E.6060204@suse.de> Subject: Re: [Qemu-devel] [PATCH V2 5/5] vmstate: introduce get_bufsize entry in VMStateField Reply-To: i.mitsyanko@samsung.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= Cc: peter.maydell@linaro.org, d.solodkiy@samsung.com, qemu-devel@nongnu.org, quintela@redhat.com On 03/14/2012 04:55 PM, Andreas F=E4rber wrote: > Am 05.03.2012 09:30, schrieb Igor Mitsyanko: >> New get_bufsize field in VMStateField is supposed to help us easil= y add save/restore >> support of dynamically allocated buffers in device's states. >> There are some cases when information about size of dynamically al= located buffer is >> already presented in specific device's state structure, but in suc= h a form that >> can not be used with existing VMStateField interface. Currently, w= e 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. 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 get_bufsize callback we can calculate size of dynamic array i= n whichever >> way we need. We don't need .size_offset field anymore, so we can r= emove it from >> VMState Field structure to compensate for extra memory consuption = because of >> get_bufsize addition. Macros VMSTATE_VBUFFER* are modified to use = new callback >> instead of .size_offset. Macro VMSTATE_BUFFER_MULTIPLY and VMFlag = VMS_MULTIPLY >> are removed completely as they are now redundant. >> >> Signed-off-by: Igor Mitsyanko > > Apart from this commit message being an overwhelmingly huge block o= f > text ;) (maybe insert an empty line or two?) OK :) this had touched on the > overall discussion of whether to pursue a declarative or imperative > approach for VMState. > > So, what about adding this as a new, optional mechanism and leaving > VBUFFER / BUFFER_MULTIPLY users untouched? I don't mind. Now that we decided (in another thread) against live saving of wp_gro= ups=20 in SDState, the question with this patch arises again: do we need to= =20 introduce get_bufsize or we should just use additional member in SDSt= ate=20 to hold wp_groups buffer size for use with current=20 VMSTATE_VBUFFER_UINT32 macro? --=20 Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: i.mitsyanko@samsung.com