]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
cpu: init vmstate for ticks and clock offset
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Mon, 1 Sep 2014 05:34:49 +0000 (09:34 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Sep 2014 10:20:32 +0000 (12:20 +0200)
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 <Pavel.Dovgaluk@ispras.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cpus.c
include/qemu-common.h
vl.c

diff --git a/cpus.c b/cpus.c
index 0f7d0eaf3674a09d1ab89a1a8f8cfd0649c082e6..2a0e133d39aef03ba8bab325bde5430e443995f3 100644 (file)
--- 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) {
index bcf7a6ad431b46abd5044d6bf83871e534b1aa78..dcb57ab4b9ebd16bdf01c1f1598bcbec3dcbd27f 100644 (file)
@@ -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 15aea95c572f01ca2ca8062eebd80efffa5dbb8d..5db0d08496eebf508c41e82209a72a3faf99217a 100644 (file)
--- 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");