qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [BUG] Migration hv_time rollback
@ 2020-09-16  9:06 Antoine Damhet
  2020-09-16 11:29 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 10+ messages in thread
From: Antoine Damhet @ 2020-09-16  9:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Juan Quintela, Dr. David Alan Gilbert,
	Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

Hi,

We are experiencing timestamp rollbacks during live-migration of
Windows 10 guests with the following qemu configuration (linux 5.4.46
and qemu master):
```
$ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
```

I have tracked the bug to the fact that `kvmclock` is not exposed and
disabled from qemu PoV but is in fact used by `hv-time` (in KVM).

I think we should enable the `kvmclock` (qemu device) if `hv-time` is
present and add Hyper-V support for the `kvmclock_current_nsec`
function.

I'm asking for advice because I am unsure this is the _right_ approach
and how to keep migration compatibility between qemu versions.

Thank you all,

-- 
Antoine 'xdbob' Damhet

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16  9:06 [BUG] Migration hv_time rollback Antoine Damhet
@ 2020-09-16 11:29 ` Dr. David Alan Gilbert
  2020-09-16 11:59   ` Vitaly Kuznetsov
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2020-09-16 11:29 UTC (permalink / raw)
  To: Antoine Damhet, vkuznets
  Cc: Paolo Bonzini, Juan Quintela, qemu-devel, Michael S. Tsirkin

cc'ing in Vitaly who knows about the hv stuff.

* Antoine Damhet (antoine.damhet@blade-group.com) wrote:
> Hi,
> 
> We are experiencing timestamp rollbacks during live-migration of
> Windows 10 guests with the following qemu configuration (linux 5.4.46
> and qemu master):
> ```
> $ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
> ```

How big a jump are you seeing, and how did you notice it in the guest?

Dave

> I have tracked the bug to the fact that `kvmclock` is not exposed and
> disabled from qemu PoV but is in fact used by `hv-time` (in KVM).
> 
> I think we should enable the `kvmclock` (qemu device) if `hv-time` is
> present and add Hyper-V support for the `kvmclock_current_nsec`
> function.
> 
> I'm asking for advice because I am unsure this is the _right_ approach
> and how to keep migration compatibility between qemu versions.
> 
> Thank you all,
> 
> -- 
> Antoine 'xdbob' Damhet


-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 11:29 ` Dr. David Alan Gilbert
@ 2020-09-16 11:59   ` Vitaly Kuznetsov
  2020-09-16 12:14     ` Antoine Damhet
  2020-09-16 11:59   ` Antoine Damhet
  2020-09-16 13:05   ` Paolo Bonzini
  2 siblings, 1 reply; 10+ messages in thread
From: Vitaly Kuznetsov @ 2020-09-16 11:59 UTC (permalink / raw)
  To: Dr. David Alan Gilbert, Antoine Damhet
  Cc: Juan Quintela, Marcelo Tosatti, qemu-devel, Michael S. Tsirkin,
	Paolo Bonzini

"Dr. David Alan Gilbert" <dgilbert@redhat.com> writes:

> cc'ing in Vitaly who knows about the hv stuff.
>

cc'ing Marcelo who knows about clocksources :-)

> * Antoine Damhet (antoine.damhet@blade-group.com) wrote:
>> Hi,
>> 
>> We are experiencing timestamp rollbacks during live-migration of
>> Windows 10 guests

Are you migrating to the same hardware (with the same TSC frequency)? Is
TSC used as the clocksource on the host?

>>  with the following qemu configuration (linux 5.4.46
>> and qemu master):
>> ```
>> $ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
>> ```

Out of pure curiosity, what's the purpose of doing 'kvm=off'? Windows is
not going to check for KVM identification anyway so we pretend we're
Hyper-V. 

Also, have you tried adding more Hyper-V enlightenments? 

>
> How big a jump are you seeing, and how did you notice it in the guest?
>
> Dave
>
>> I have tracked the bug to the fact that `kvmclock` is not exposed and
>> disabled from qemu PoV but is in fact used by `hv-time` (in KVM).
>> 
>> I think we should enable the `kvmclock` (qemu device) if `hv-time` is
>> present and add Hyper-V support for the `kvmclock_current_nsec`
>> function.

AFAICT kvmclock_current_nsec() checks whether kvmclock was enabled by
the guest:

   if (!(env->system_time_msr & 1ULL)) {
        /* KVM clock not active */
        return 0;
    }

and this is (and way) always false for Windows guests.

>> 
>> I'm asking for advice because I am unsure this is the _right_ approach
>> and how to keep migration compatibility between qemu versions.
>> 
>> Thank you all,
>> 
>> -- 
>> Antoine 'xdbob' Damhet

-- 
Vitaly



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 11:29 ` Dr. David Alan Gilbert
  2020-09-16 11:59   ` Vitaly Kuznetsov
@ 2020-09-16 11:59   ` Antoine Damhet
  2020-09-16 12:16     ` Vitaly Kuznetsov
  2020-09-16 13:05   ` Paolo Bonzini
  2 siblings, 1 reply; 10+ messages in thread
From: Antoine Damhet @ 2020-09-16 11:59 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Juan Quintela, Michael S. Tsirkin, qemu-devel, Paolo Bonzini,
	vkuznets

[-- Attachment #1: Type: text/plain, Size: 2680 bytes --]

On Wed, Sep 16, 2020 at 12:29:56PM +0100, Dr. David Alan Gilbert wrote:
> cc'ing in Vitaly who knows about the hv stuff.

Thanks

> 
> * Antoine Damhet (antoine.damhet@blade-group.com) wrote:
> > Hi,
> > 
> > We are experiencing timestamp rollbacks during live-migration of
> > Windows 10 guests with the following qemu configuration (linux 5.4.46
> > and qemu master):
> > ```
> > $ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
> > ```
> 
> How big a jump are you seeing, and how did you notice it in the guest?

I'm seeing jumps of about the guest uptime (indicating a reset of the
counter). It's expected because we won't call `KVM_SET_CLOCK` to
restore any value.

We first noticed it because after some migrations `dwm.exe` crashes with
the "(NTSTATUS) 0x8898009b - QueryPerformanceCounter returned a time in
the past." error code.

I can also confirm the following hack makes the behavior disappear:

```
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 64283358f9..f334bdf35f 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -332,11 +332,7 @@ void kvmclock_create(void)
 {
     X86CPU *cpu = X86_CPU(first_cpu);

-    if (kvm_enabled() &&
-        cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
-                                       (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
-        sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
-    }
+    sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
 }

 static void kvmclock_register_types(void)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 32b1453e6a..11d980ba85 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -158,9 +158,7 @@ static void pc_init1(MachineState *machine,

     x86_cpus_init(x86ms, pcmc->default_cpu_version);

-    if (kvm_enabled() && pcmc->kvmclock_enabled) {
-        kvmclock_create();
-    }
+    kvmclock_create();

     if (pcmc->pci_enabled) {
         pci_memory = g_new(MemoryRegion, 1);
```

> 
> Dave
> 
> > I have tracked the bug to the fact that `kvmclock` is not exposed and
> > disabled from qemu PoV but is in fact used by `hv-time` (in KVM).
> > 
> > I think we should enable the `kvmclock` (qemu device) if `hv-time` is
> > present and add Hyper-V support for the `kvmclock_current_nsec`
> > function.
> > 
> > I'm asking for advice because I am unsure this is the _right_ approach
> > and how to keep migration compatibility between qemu versions.
> > 
> > Thank you all,
> > 
> > -- 
> > Antoine 'xdbob' Damhet
> 
> 
> -- 
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> 

-- 
Antoine 'xdbob' Damhet

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 11:59   ` Vitaly Kuznetsov
@ 2020-09-16 12:14     ` Antoine Damhet
  0 siblings, 0 replies; 10+ messages in thread
From: Antoine Damhet @ 2020-09-16 12:14 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: Marcelo Tosatti, Juan Quintela, Michael S. Tsirkin,
	Dr. David Alan Gilbert, qemu-devel, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 2522 bytes --]

On Wed, Sep 16, 2020 at 01:59:43PM +0200, Vitaly Kuznetsov wrote:
> "Dr. David Alan Gilbert" <dgilbert@redhat.com> writes:
> 
> > cc'ing in Vitaly who knows about the hv stuff.
> >
> 
> cc'ing Marcelo who knows about clocksources :-)
> 
> > * Antoine Damhet (antoine.damhet@blade-group.com) wrote:
> >> Hi,
> >> 
> >> We are experiencing timestamp rollbacks during live-migration of
> >> Windows 10 guests
> 
> Are you migrating to the same hardware (with the same TSC frequency)? Is
> TSC used as the clocksource on the host?

Yes we are migrating to the exact same hardware. And yes TSC is used as
a clocksource in the host (but the bug is still happening with `hpet` as
a clocksource).

> 
> >>  with the following qemu configuration (linux 5.4.46
> >> and qemu master):
> >> ```
> >> $ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
> >> ```
> 
> Out of pure curiosity, what's the purpose of doing 'kvm=off'? Windows is
> not going to check for KVM identification anyway so we pretend we're
> Hyper-V. 

Some softwares explicitly checks for the presence of KVM and then crash
if they find it in CPUID :/

> 
> Also, have you tried adding more Hyper-V enlightenments? 

Yes, I published a stripped-down command-line for a minimal reproducer
but even `hv-frequencies` and `hv-reenlightenment` don't help.

> 
> >
> > How big a jump are you seeing, and how did you notice it in the guest?
> >
> > Dave
> >
> >> I have tracked the bug to the fact that `kvmclock` is not exposed and
> >> disabled from qemu PoV but is in fact used by `hv-time` (in KVM).
> >> 
> >> I think we should enable the `kvmclock` (qemu device) if `hv-time` is
> >> present and add Hyper-V support for the `kvmclock_current_nsec`
> >> function.
> 
> AFAICT kvmclock_current_nsec() checks whether kvmclock was enabled by
> the guest:
> 
>    if (!(env->system_time_msr & 1ULL)) {
>         /* KVM clock not active */
>         return 0;
>     }
> 
> and this is (and way) always false for Windows guests.

Hooo, I missed this piece. When is `clock_is_reliable` expected to be
false ? Because if it is I still think we should be able to query at
least `HV_X64_MSR_REFERENCE_TSC`

> 
> >> 
> >> I'm asking for advice because I am unsure this is the _right_ approach
> >> and how to keep migration compatibility between qemu versions.
> >> 
> >> Thank you all,
> >> 
> >> -- 
> >> Antoine 'xdbob' Damhet
> 
> -- 
> Vitaly
> 

-- 
Antoine 'xdbob' Damhet

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 11:59   ` Antoine Damhet
@ 2020-09-16 12:16     ` Vitaly Kuznetsov
  2020-09-16 12:50       ` Vitaly Kuznetsov
  0 siblings, 1 reply; 10+ messages in thread
From: Vitaly Kuznetsov @ 2020-09-16 12:16 UTC (permalink / raw)
  To: Antoine Damhet, Dr. David Alan Gilbert
  Cc: Juan Quintela, Marcelo Tosatti, qemu-devel, Michael S. Tsirkin,
	Paolo Bonzini

Antoine Damhet <antoine.damhet@blade-group.com> writes:

> On Wed, Sep 16, 2020 at 12:29:56PM +0100, Dr. David Alan Gilbert wrote:
>> cc'ing in Vitaly who knows about the hv stuff.
>
> Thanks
>
>> 
>> * Antoine Damhet (antoine.damhet@blade-group.com) wrote:
>> > Hi,
>> > 
>> > We are experiencing timestamp rollbacks during live-migration of
>> > Windows 10 guests with the following qemu configuration (linux 5.4.46
>> > and qemu master):
>> > ```
>> > $ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
>> > ```
>> 
>> How big a jump are you seeing, and how did you notice it in the guest?
>
> I'm seeing jumps of about the guest uptime (indicating a reset of the
> counter). It's expected because we won't call `KVM_SET_CLOCK` to
> restore any value.
>
> We first noticed it because after some migrations `dwm.exe` crashes with
> the "(NTSTATUS) 0x8898009b - QueryPerformanceCounter returned a time in
> the past." error code.
>
> I can also confirm the following hack makes the behavior disappear:
>
> ```
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 64283358f9..f334bdf35f 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -332,11 +332,7 @@ void kvmclock_create(void)
>  {
>      X86CPU *cpu = X86_CPU(first_cpu);
>
> -    if (kvm_enabled() &&
> -        cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
> -                                       (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
> -        sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
> -    }
> +    sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
>  }
>


Oh, I think I see what's going on. When you add 'kvm=off'
cpu->env.features[FEAT_KVM] is reset (see x86_cpu_expand_features()) so
kvmclock QEMU device is not created and nobody calls KVM_SET_CLOCK on
migration.

In case we really want to support 'kvm=off' I think we can add Hyper-V
features check here along with KVM, this should do the job.

-- 
Vitaly



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 12:16     ` Vitaly Kuznetsov
@ 2020-09-16 12:50       ` Vitaly Kuznetsov
  2020-09-16 13:25         ` Antoine Damhet
  0 siblings, 1 reply; 10+ messages in thread
From: Vitaly Kuznetsov @ 2020-09-16 12:50 UTC (permalink / raw)
  To: Antoine Damhet
  Cc: Juan Quintela, Marcelo Tosatti, qemu-devel,
	Dr. David Alan Gilbert, Michael S. Tsirkin, Paolo Bonzini

Vitaly Kuznetsov <vkuznets@redhat.com> writes:

> Antoine Damhet <antoine.damhet@blade-group.com> writes:
>
>> On Wed, Sep 16, 2020 at 12:29:56PM +0100, Dr. David Alan Gilbert wrote:
>>> cc'ing in Vitaly who knows about the hv stuff.
>>
>> Thanks
>>
>>> 
>>> * Antoine Damhet (antoine.damhet@blade-group.com) wrote:
>>> > Hi,
>>> > 
>>> > We are experiencing timestamp rollbacks during live-migration of
>>> > Windows 10 guests with the following qemu configuration (linux 5.4.46
>>> > and qemu master):
>>> > ```
>>> > $ qemu-system-x86_64 -enable-kvm -cpu host,kvm=off,hv_time [...]
>>> > ```
>>> 
>>> How big a jump are you seeing, and how did you notice it in the guest?
>>
>> I'm seeing jumps of about the guest uptime (indicating a reset of the
>> counter). It's expected because we won't call `KVM_SET_CLOCK` to
>> restore any value.
>>
>> We first noticed it because after some migrations `dwm.exe` crashes with
>> the "(NTSTATUS) 0x8898009b - QueryPerformanceCounter returned a time in
>> the past." error code.
>>
>> I can also confirm the following hack makes the behavior disappear:
>>
>> ```
>> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
>> index 64283358f9..f334bdf35f 100644
>> --- a/hw/i386/kvm/clock.c
>> +++ b/hw/i386/kvm/clock.c
>> @@ -332,11 +332,7 @@ void kvmclock_create(void)
>>  {
>>      X86CPU *cpu = X86_CPU(first_cpu);
>>
>> -    if (kvm_enabled() &&
>> -        cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
>> -                                       (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
>> -        sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
>> -    }
>> +    sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
>>  }
>>
>
>
> Oh, I think I see what's going on. When you add 'kvm=off'
> cpu->env.features[FEAT_KVM] is reset (see x86_cpu_expand_features()) so
> kvmclock QEMU device is not created and nobody calls KVM_SET_CLOCK on
> migration.
>
> In case we really want to support 'kvm=off' I think we can add Hyper-V
> features check here along with KVM, this should do the job.

Does the untested

diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 64283358f91d..e03b2ca6d8f6 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -333,8 +333,9 @@ void kvmclock_create(void)
     X86CPU *cpu = X86_CPU(first_cpu);
 
     if (kvm_enabled() &&
-        cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
-                                       (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
+        ((cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
+                                         (1ULL << KVM_FEATURE_CLOCKSOURCE2))) ||
+         (cpu->env.features[FEAT_HYPERV_EAX] & HV_TIME_REF_COUNT_AVAILABLE))) {
         sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
     }
 }

help?

(I don't think we need to remove all 'if (kvm_enabled())' checks from
machine types as 'kvm=off' should not be related).

-- 
Vitaly



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 11:29 ` Dr. David Alan Gilbert
  2020-09-16 11:59   ` Vitaly Kuznetsov
  2020-09-16 11:59   ` Antoine Damhet
@ 2020-09-16 13:05   ` Paolo Bonzini
  2020-09-16 13:17     ` Vitaly Kuznetsov
  2 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2020-09-16 13:05 UTC (permalink / raw)
  To: Dr. David Alan Gilbert, Antoine Damhet, vkuznets
  Cc: Juan Quintela, qemu-devel, Michael S. Tsirkin

On 16/09/20 13:29, Dr. David Alan Gilbert wrote:
>> I have tracked the bug to the fact that `kvmclock` is not exposed and
>> disabled from qemu PoV but is in fact used by `hv-time` (in KVM).
>>
>> I think we should enable the `kvmclock` (qemu device) if `hv-time` is
>> present and add Hyper-V support for the `kvmclock_current_nsec`
>> function.

Yes, this seems correct.  I would have to check but it may even be
better to _always_ send kvmclock data in the live migration stream.

Paolo



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 13:05   ` Paolo Bonzini
@ 2020-09-16 13:17     ` Vitaly Kuznetsov
  0 siblings, 0 replies; 10+ messages in thread
From: Vitaly Kuznetsov @ 2020-09-16 13:17 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Marcelo Tosatti, Juan Quintela, Michael S. Tsirkin,
	Dr. David Alan Gilbert, qemu-devel, Antoine Damhet

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 16/09/20 13:29, Dr. David Alan Gilbert wrote:
>>> I have tracked the bug to the fact that `kvmclock` is not exposed and
>>> disabled from qemu PoV but is in fact used by `hv-time` (in KVM).
>>>
>>> I think we should enable the `kvmclock` (qemu device) if `hv-time` is
>>> present and add Hyper-V support for the `kvmclock_current_nsec`
>>> function.
>
> Yes, this seems correct.  I would have to check but it may even be
> better to _always_ send kvmclock data in the live migration stream.
>

The question I have is: with 'kvm=off', do we actually restore TSC
reading on migration? (and I guess the answer is 'no' or Hyper-V TSC
page would 'just work' I guess). So yea, maybe dropping the
'cpu->env.features[FEAT_KVM]' check is the right fix.

-- 
Vitaly



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] Migration hv_time rollback
  2020-09-16 12:50       ` Vitaly Kuznetsov
@ 2020-09-16 13:25         ` Antoine Damhet
  0 siblings, 0 replies; 10+ messages in thread
From: Antoine Damhet @ 2020-09-16 13:25 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: Michael S. Tsirkin, Marcelo Tosatti, qemu-devel,
	Dr. David Alan Gilbert, Juan Quintela, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

On Wed, Sep 16, 2020 at 02:50:56PM +0200, Vitaly Kuznetsov wrote:
[...]

> >>
> >
> >
> > Oh, I think I see what's going on. When you add 'kvm=off'
> > cpu->env.features[FEAT_KVM] is reset (see x86_cpu_expand_features()) so
> > kvmclock QEMU device is not created and nobody calls KVM_SET_CLOCK on
> > migration.
> >
> > In case we really want to support 'kvm=off' I think we can add Hyper-V
> > features check here along with KVM, this should do the job.
> 
> Does the untested
> 
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 64283358f91d..e03b2ca6d8f6 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -333,8 +333,9 @@ void kvmclock_create(void)
>      X86CPU *cpu = X86_CPU(first_cpu);
>  
>      if (kvm_enabled() &&
> -        cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
> -                                       (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
> +        ((cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
> +                                         (1ULL << KVM_FEATURE_CLOCKSOURCE2))) ||
> +         (cpu->env.features[FEAT_HYPERV_EAX] & HV_TIME_REF_COUNT_AVAILABLE))) {
>          sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
>      }
>  }
> 
> help?

It appears to work :)

> 
> (I don't think we need to remove all 'if (kvm_enabled())' checks from
> machine types as 'kvm=off' should not be related).

Indeed (I didn't look at the macro, it was just quick & dirty).

> 
> -- 
> Vitaly
> 
> 

-- 
Antoine 'xdbob' Damhet

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-16 13:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-16  9:06 [BUG] Migration hv_time rollback Antoine Damhet
2020-09-16 11:29 ` Dr. David Alan Gilbert
2020-09-16 11:59   ` Vitaly Kuznetsov
2020-09-16 12:14     ` Antoine Damhet
2020-09-16 11:59   ` Antoine Damhet
2020-09-16 12:16     ` Vitaly Kuznetsov
2020-09-16 12:50       ` Vitaly Kuznetsov
2020-09-16 13:25         ` Antoine Damhet
2020-09-16 13:05   ` Paolo Bonzini
2020-09-16 13:17     ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).