From patchwork Mon Sep 1 05:34:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 384657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 17CC214012E for ; Mon, 1 Sep 2014 15:35:17 +1000 (EST) Received: from localhost ([::1]:52115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOKGo-0004Zi-WE for incoming@patchwork.ozlabs.org; Mon, 01 Sep 2014 01:35:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOKGU-0004EI-Hw for qemu-devel@nongnu.org; Mon, 01 Sep 2014 01:35:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOKGN-0004n2-NB for qemu-devel@nongnu.org; Mon, 01 Sep 2014 01:34:54 -0400 Received: from mail.ispras.ru ([83.149.199.45]:45345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOKGN-0004m8-GP for qemu-devel@nongnu.org; Mon, 01 Sep 2014 01:34:47 -0400 Received: from [10.10.150.147] (unknown [80.250.189.177]) by mail.ispras.ru (Postfix) with ESMTPSA id EC920540151; Mon, 1 Sep 2014 09:34:43 +0400 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Mon, 01 Sep 2014 09:34:49 +0400 Message-ID: <20140901053449.440.82678.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Cc: pbonzini@redhat.com, zealot351@gmail.com, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru Subject: [Qemu-devel] [PATCH] cpu: init vmstate for ticks and clock offset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Ticks and clock offset used by CPU timers have to be saved in vmstate. But vmstate for these fields registered only in icount mode. Missing registration leads to breaking the continuity when vmstate is loaded. This patch introduces new initialization function which fixes this. Signed-off-by: Pavel Dovgalyuk --- cpus.c | 8 ++++++-- include/qemu-common.h | 2 ++ vl.c | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cpus.c b/cpus.c index 2b5c0bd..c07826d 100644 --- a/cpus.c +++ b/cpus.c @@ -492,13 +492,17 @@ static const VMStateDescription vmstate_timers = { } }; +void cpu_ticks_init(void) +{ + seqlock_init(&timers_state.vm_clock_seqlock, NULL); + vmstate_register(NULL, 0, &vmstate_timers, &timers_state); +} + void configure_icount(QemuOpts *opts, Error **errp) { const char *option; char *rem_str = NULL; - seqlock_init(&timers_state.vm_clock_seqlock, NULL); - vmstate_register(NULL, 0, &vmstate_timers, &timers_state); option = qemu_opt_get(opts, "shift"); if (!option) { if (qemu_opt_get(opts, "align") != NULL) { diff --git a/include/qemu-common.h b/include/qemu-common.h index bcf7a6a..dcb57ab 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -105,6 +105,8 @@ static inline char *realpath(const char *path, char *resolved_path) } #endif +void cpu_ticks_init(void); + /* icount */ void configure_icount(QemuOpts *opts, Error **errp); extern int use_icount; diff --git a/vl.c b/vl.c index b796c67..9241e2d 100644 --- a/vl.c +++ b/vl.c @@ -4330,6 +4330,7 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); #endif + cpu_ticks_init(); if (icount_opts) { if (kvm_enabled() || xen_enabled()) { fprintf(stderr, "-icount is not allowed with kvm or xen\n");