From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyS9-0003wu-Bc for qemu-devel@nongnu.org; Thu, 28 Aug 2014 08:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMyS2-0005Dx-ED for qemu-devel@nongnu.org; Thu, 28 Aug 2014 08:05:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyS2-0005Dr-5N for qemu-devel@nongnu.org; Thu, 28 Aug 2014 08:05:14 -0400 Message-ID: <53FF1AEF.8050409@redhat.com> Date: Thu, 28 Aug 2014 14:05:03 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140828111822.1624.24556.stgit@PASHA-ISP> <20140828111857.1624.42771.stgit@PASHA-ISP> In-Reply-To: <20140828111857.1624.42771.stgit@PASHA-ISP> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 06/12] apic_common: fixing loading vmstate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: zealot351@gmail.com, maria.klimushenkova@ispras.ru Il 28/08/2014 13:18, Pavel Dovgalyuk ha scritto: > This patch adds missed sipi_vector and wait_for_sipi fields to the new > subsection of the vmstate of the apic_common module. Saving and loading > of these fields makes migration of the apic state deterministic. > > Signed-off-by: Pavel Dovgalyuk > --- > hw/intc/apic_common.c | 24 ++++++++++++++++++++++++ > 1 files changed, 24 insertions(+), 0 deletions(-) > > diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c > index ce3d903..2d2dfcb 100644 > --- a/hw/intc/apic_common.c > +++ b/hw/intc/apic_common.c > @@ -345,6 +345,23 @@ static int apic_dispatch_post_load(void *opaque, int version_id) > return 0; > } > > +static bool apic_common_sipi_needed(void *opaque) > +{ > + APICCommonState *s = APIC_COMMON(opaque); > + return s->wait_for_sipi != 0; > +} vmstate_apic_common needs a pre_load function that sets wait_for_sipi to 0 (because the default is not zero, it's !cpu_is_bsp(s->cpu)). Paolo > +static const VMStateDescription vmstate_apic_common_sipi = { > + .name = "apic_sipi", > + .version_id = 1, > + .minimum_version_id = 1, > + .fields = (VMStateField[]) { > + VMSTATE_INT32(sipi_vector, APICCommonState), > + VMSTATE_INT32(wait_for_sipi, APICCommonState), > + VMSTATE_END_OF_LIST() > + } > +}; > + > static const VMStateDescription vmstate_apic_common = { > .name = "apic", > .version_id = 3, > @@ -375,6 +392,13 @@ static const VMStateDescription vmstate_apic_common = { > VMSTATE_INT64(timer_expiry, > APICCommonState), /* open-coded timer state */ > VMSTATE_END_OF_LIST() > + }, > + .subsections = (VMStateSubsection[]) { > + { > + .vmsd = &vmstate_apic_common_sipi, > + .needed = apic_common_sipi_needed, > + }, > + VMSTATE_END_OF_LIST() > } > }; > >