From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF3pk-0002TE-2N for qemu-devel@nongnu.org; Wed, 06 Aug 2014 12:13:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF3pe-0005UW-De for qemu-devel@nongnu.org; Wed, 06 Aug 2014 12:13:00 -0400 Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:64727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF3pe-0005U1-6o for qemu-devel@nongnu.org; Wed, 06 Aug 2014 12:12:54 -0400 Received: by mail-wg0-f45.google.com with SMTP id x12so2888942wgg.16 for ; Wed, 06 Aug 2014 09:12:53 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 6 Aug 2014 18:12:27 +0200 Message-Id: <1407341555-13173-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1407341555-13173-1-git-send-email-pbonzini@redhat.com> References: <1407341555-13173-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 03/11] migration: migrate icount fields. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: KONRAD Frederic 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 Reviewed-by: Amit Shah Reviewed-by: Juan Quintela Signed-off-by: Paolo Bonzini --- cpus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cpus.c b/cpus.c index 127de1c..a6b6557 100644 --- a/cpus.c +++ b/cpus.c @@ -429,6 +429,25 @@ void qemu_clock_warp(QEMUClockType type) } } +static bool icount_state_needed(void *opaque) +{ + return use_icount; +} + +/* + * This is a subsection for icount migration. + */ +static const VMStateDescription icount_vmstate_timers = { + .name = "timer/icount", + .version_id = 1, + .minimum_version_id = 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, @@ -438,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.9.3