From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRKZC-0002Pc-Nq for qemu-devel@nongnu.org; Tue, 09 Sep 2014 08:30:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRKZ6-00037s-Uv for qemu-devel@nongnu.org; Tue, 09 Sep 2014 08:30:38 -0400 Received: from mail-qc0-x22c.google.com ([2607:f8b0:400d:c01::22c]:41378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRKZ6-00037k-NW for qemu-devel@nongnu.org; Tue, 09 Sep 2014 08:30:32 -0400 Received: by mail-qc0-f172.google.com with SMTP id o8so16978759qcw.17 for ; Tue, 09 Sep 2014 05:30:32 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 9 Sep 2014 14:30:02 +0200 Message-Id: <1410265809-27247-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1410265809-27247-1-git-send-email-pbonzini@redhat.com> References: <1410265809-27247-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 03/10] cpu: init vmstate for ticks and clock offset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, dgilbert@redhat.com, Pavel.Dovgaluk@ispras.ru, quintela@redhat.com From: Pavel Dovgalyuk 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 Signed-off-by: Paolo Bonzini --- 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 0f7d0ea..2a0e133 100644 --- a/cpus.c +++ b/cpus.c @@ -493,13 +493,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 15aea95..5db0d08 100644 --- a/vl.c +++ b/vl.c @@ -4334,6 +4334,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"); -- 2.1.0