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

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

Comments

Crístian Viana - March 20, 2012, 7:48 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>
---
 vl.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
Anthony Liguori - March 20, 2012, 8:05 p.m.
On 03/20/2012 02:48 PM, Crístian Viana wrote:
> 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>
> ---
>   vl.c |   13 ++++++++++++-
>   1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 112b0e0..2c7cbf0 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -550,11 +550,22 @@ 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);
>           }
> +    } else {
> +        static GlobalProperty slew_lost_ticks[] = {
> +            {
> +                .driver   = "mc146818rtc",
> +                .property = "lost_tick_policy",
> +                .value    = "slew",
> +            },
> +            { /* end of list */ }
> +        };

I think we just want to change:

hw/mc146818rtc.h:
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
                                lost_tick_policy, LOST_TICK_DISCARD),

I think we just need to change this to LOST_TICK_SLEW.  This would effectively 
change the default.

Regards,

Anthony Liguori

> +        qdev_prop_register_global_list(slew_lost_ticks);
>       }
>   }
>
Crístian Viana - March 20, 2012, 8:16 p.m.
On 20-03-2012 17:05, Anthony Liguori wrote:
> I think we just want to change:
> 
> hw/mc146818rtc.h:
>     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
>                                lost_tick_policy, LOST_TICK_DISCARD),
> 
> I think we just need to change this to LOST_TICK_SLEW.  This would
> effectively change the default.

I can't see this code snippet here, I guess we are in a different
branch. I'm using the current master branch (33cf629).
Anthony Liguori - March 20, 2012, 8:31 p.m.
On 03/20/2012 03:16 PM, Crístian Viana wrote:
> On 20-03-2012 17:05, Anthony Liguori wrote:
>> I think we just want to change:
>>
>> hw/mc146818rtc.h:
>>      DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
>>                                 lost_tick_policy, LOST_TICK_DISCARD),
>>
>> I think we just need to change this to LOST_TICK_SLEW.  This would
>> effectively change the default.
>
> I can't see this code snippet here, I guess we are in a different
> branch. I'm using the current master branch (33cf629).

http://git.qemu.org/?p=qemu.git;a=blob;f=hw/mc146818rtc.c;h=2b59c36ee66149f238ea415059c44d7d619925a6;hb=HEAD#l726

Regards,

Anthony Liguori

>
Crístian Viana - March 20, 2012, 8:46 p.m.
On 20-03-2012 17:31, Anthony Liguori wrote:
> On 03/20/2012 03:16 PM, Crístian Viana wrote:
>> On 20-03-2012 17:05, Anthony Liguori wrote:
>>> I think we just want to change:
>>>
>>> hw/mc146818rtc.h:
>>>      DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
>>>                                 lost_tick_policy, LOST_TICK_DISCARD),
>>>
>>> I think we just need to change this to LOST_TICK_SLEW.  This would
>>> effectively change the default.
>>
>> I can't see this code snippet here, I guess we are in a different
>> branch. I'm using the current master branch (33cf629).
> 
> http://git.qemu.org/?p=qemu.git;a=blob;f=hw/mc146818rtc.c;h=2b59c36ee66149f238ea415059c44d7d619925a6;hb=HEAD#l726

So that's on hw/mc146818rtc.c, not .h :-) Thanks for the suggestion,
I'll send a new patch now.

Patch

diff --git a/vl.c b/vl.c
index 112b0e0..2c7cbf0 100644
--- a/vl.c
+++ b/vl.c
@@ -550,11 +550,22 @@  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);
         }
+    } else {
+        static GlobalProperty slew_lost_ticks[] = {
+            {
+                .driver   = "mc146818rtc",
+                .property = "lost_tick_policy",
+                .value    = "slew",
+            },
+            { /* end of list */ }
+        };
+
+        qdev_prop_register_global_list(slew_lost_ticks);
     }
 }