Skip to contentSkip to conversation

Force driftfix=none on previous machines

PATCH In review Crístian Viana 2 participants 3 messages Jun 19, 2012 – Jun 20, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 Force driftfix=none on previous machines

The current value for the -rtc driftfix option is 'none'. This patch makes sure that the old machines configuration will work the same way even after that option changes its default value.

---

There's a scenario when things don't work the way I expected: when I set a previous machine with -M, the driftfix flag value on the command line is not used, the machine's default value overwrites it. I'm not sure if that's the expected behavior of QEMU in those cases (if I set a machine, I can't change its properties) or if there's a bug somewhere. This is the question I asked in a previous e-mail (http://article.gmane.org/gmane.comp.emulators.qemu/149902).

For example,

$ x86_64-softmmu/qemu-x86_64 -M pc-1.0 --rtc driftfix=slew

will use "driftfix=none", which is the default for the machine pc-1.0, not "driftfix=slew" as I set on the command line. That only happens if I choose a different machine than the default one (pc-1.1 as of now); otherwise it works fine.

Changes since v3:
- Rebase the code

 hw/pc_piix.c |    4 ++++
 1 file changed, 4 insertions(+)
hw/pc_piix.c +4 -0
index d68f77a..ed463da 100644
@@ -378,6 +378,10 @@ static QEMUMachine pc_machine_v1_1 = {
             .driver   = TYPE_USB_DEVICE,\
             .property = "full-path",\
             .value    = "no",\
+        },{\
+            .driver   = "mc146818rtc",\
+            .property = "lost_tick_policy",\
+            .value    = "discard",\
         }
 
 static QEMUMachine pc_machine_v1_0 = {
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 2/2 Change driftfix default value to slew

Windows 2008+ is very sensitive to missed ticks. The RTC is used by default as the time source. If driftfix is not enabled, Windows is prone to blue screening.

---

Anthony,
Could you please try to reproduce the segfault again (as you stated in
http://article.gmane.org/gmane.comp.emulators.qemu/143649)? I can't find it anymore.

Changes since v3:
- Fix a segfault

 hw/mc146818rtc.c |    2 +-
 vl.c             |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
hw/mc146818rtc.c +1 -1
index 3777f85..dfd7ee6 100644
@@ -686,7 +686,7 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
 static Property mc146818rtc_properties[] = {
     DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
-                               lost_tick_policy, LOST_TICK_DISCARD),
+                               lost_tick_policy, LOST_TICK_SLEW),
     DEFINE_PROP_END_OF_LIST(),
 };
 
vl.c +10 -1
index 204d85b..03661d1 100644
@@ -559,7 +559,16 @@ static void configure_rtc(QemuOpts *opts)
 
             qdev_prop_register_global_list(slew_lost_ticks);
         } else if (!strcmp(value, "none")) {
-            /* discard is default */
+            static GlobalProperty discard_lost_ticks[] = {
+                {
+                    .driver   = "mc146818rtc",
+                    .property = "lost_tick_policy",
+                    .value    = "discard",
+                },
+                { /* end of list */ }
+            };
+
+            qdev_prop_register_global_list(discard_lost_ticks);
         } else {
             fprintf(stderr, "qemu: invalid option value '%s'\n", value);
             exit(1);
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Crístian Viana
Quoted 14 lines · Crístian Viana

The current value for the -rtc driftfix option is 'none'. This patch makes sure that the old machines configuration will work the same way even after that option changes its default value.

---

There's a scenario when things don't work the way I expected: when I set a previous machine with -M, the driftfix flag value on the command line is not used, the machine's default value overwrites it. I'm not sure if that's the expected behavior of QEMU in those cases (if I set a machine, I can't change its properties) or if there's a bug somewhere. This is the question I asked in a previous e-mail (http://article.gmane.org/gmane.comp.emulators.qemu/149902).

Quoted 8 lines

For example,

$ x86_64-softmmu/qemu-x86_64 -M pc-1.0 --rtc driftfix=slew

will use "driftfix=none", which is the default for the machine pc-1.0, not "driftfix=slew" as I set on the command line. That only happens if I choose a different machine than the default one (pc-1.1 as of now); otherwise it works fine.

I can't answer your question as to why this happens, but this is a critical problem we must fix before merging this change. We need to be able to set driftfix=slew for old machine types manually.

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|