From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSU6k-0001XE-5g for qemu-devel@nongnu.org; Tue, 25 Mar 2014 12:26:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSU20-0007OH-H6 for qemu-devel@nongnu.org; Tue, 25 Mar 2014 12:21:46 -0400 Received: from greensocs.com ([178.33.234.66]:32926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSU20-0007OB-AY for qemu-devel@nongnu.org; Tue, 25 Mar 2014 12:16:52 -0400 From: fred.konrad@greensocs.com Date: Tue, 25 Mar 2014 17:16:30 +0100 Message-Id: <1395764200-7379-3-git-send-email-fred.konrad@greensocs.com> In-Reply-To: <1395764200-7379-1-git-send-email-fred.konrad@greensocs.com> References: <1395764200-7379-1-git-send-email-fred.konrad@greensocs.com> Subject: [Qemu-devel] [RFC PATCH v2 02/12] migration: migrate icount fields. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, mark.burton@greensocs.com, fred.konrad@greensocs.com From: KONRAD Frederic This fixes a bug where qemu_icount and qemu_icount_bias are not migrated. It adds a subsection "timer/icount" to vmstate_timers so icount is migrated only when needed. Signed-off-by: KONRAD Frederic --- cpus.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cpus.c b/cpus.c index 687717f..89f4b26 100644 --- a/cpus.c +++ b/cpus.c @@ -427,6 +427,26 @@ void qemu_clock_warp(QEMUClockType type) } } +static bool icount_state_needed(void *opaque) +{ + return (use_icount != 0); +} + +/* + * This is a subsection for icount migration. + */ +static const VMStateDescription icount_vmstate_timers = { + .name = "timer/icount", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_INT64(qemu_icount_bias, TimersState), + VMSTATE_INT64(qemu_icount, TimersState), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_timers = { .name = "timer", .version_id = 2, @@ -437,6 +457,14 @@ static const VMStateDescription vmstate_timers = { VMSTATE_INT64(dummy, TimersState), VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2), VMSTATE_END_OF_LIST() + }, + .subsections = (VMStateSubsection[]) { + { + .vmsd = &icount_vmstate_timers, + .needed = icount_state_needed, + }, { + /* empty */ + } } }; -- 1.8.1.4