Patchwork [v2,2/2] Change timedrift default value to slew

login
register
mail settings
Submitter Crístian Viana
Date March 20, 2012, 8:59 p.m.
Message ID <1332277190-14477-2-git-send-email-vianac@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/147841/
State New
Headers show

Comments

Crístian Viana - March 20, 2012, 8:59 p.m.
Windows 2008+ is very sensitive to missed ticks. The RTC is used by default as
the time source.  If time drift is not enabled, Windows is prone to
blue screening.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
---
 hw/mc146818rtc.c |    2 +-
 vl.c             |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Paolo Bonzini - March 21, 2012, 6:02 a.m.
Il 20/03/2012 21:59, Crístian Viana ha scritto:
> Windows 2008+ is very sensitive to missed ticks. The RTC is used by default as
> the time source.  If time drift is not enabled, Windows is prone to
> blue screening.
> 
> Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
> ---
>  hw/mc146818rtc.c |    2 +-
>  vl.c             |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
> index 2b59c36..2b31587 100644
> --- a/hw/mc146818rtc.c
> +++ b/hw/mc146818rtc.c
> @@ -726,7 +726,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(),
>  };
>  
> diff --git a/vl.c b/vl.c
> index 112b0e0..62dda67 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -550,7 +550,7 @@ static void configure_rtc(QemuOpts *opts)
>  
>              qdev_prop_register_global_list(slew_lost_ticks);
>          } else if (!strcmp(value, "none")) {
> -            /* discard is default */
> +            /* do nothing */
>          } else {
>              fprintf(stderr, "qemu: invalid option value '%s'\n", value);
>              exit(1);

This piece of code from the previous if:

        if (!strcmp(value, "slew")) {
            static GlobalProperty slew_lost_ticks[] = {
                {
                    .driver   = "mc146818rtc",
                    .property = "lost_tick_policy",
                    .value    = "slew",
                },
                { /* end of list */ }
            };

            qdev_prop_register_global_list(slew_lost_ticks);

needs to be adjusted and moved to the "if (!strmp(value, "none"))" branch.

Patch 1 looks good.

Paolo
Crístian Viana - March 21, 2012, 5:14 p.m.
On 21-03-2012 03:02, Paolo Bonzini wrote:
> This piece of code from the previous if:
> 
>         if (!strcmp(value, "slew")) {
>             static GlobalProperty slew_lost_ticks[] = {
>                 {
>                     .driver   = "mc146818rtc",
>                     .property = "lost_tick_policy",
>                     .value    = "slew",
>                 },
>                 { /* end of list */ }
>             };
> 
>             qdev_prop_register_global_list(slew_lost_ticks);
> 
> needs to be adjusted and moved to the "if (!strmp(value, "none"))" branch.

Thanks, Paolo! I sent a version 3 of these patches with the changes you
suggested.

Patch

diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 2b59c36..2b31587 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -726,7 +726,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(),
 };
 
diff --git a/vl.c b/vl.c
index 112b0e0..62dda67 100644
--- a/vl.c
+++ b/vl.c
@@ -550,7 +550,7 @@  static void configure_rtc(QemuOpts *opts)
 
             qdev_prop_register_global_list(slew_lost_ticks);
         } else if (!strcmp(value, "none")) {
-            /* discard is default */
+            /* do nothing */
         } else {
             fprintf(stderr, "qemu: invalid option value '%s'\n", value);
             exit(1);