[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] Migration hv_time rollback
From: |
Antoine Damhet |
Subject: |
Re: [BUG] Migration hv_time rollback |
Date: |
Wed, 16 Sep 2020 13:59:50 +0200 |
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
signature.asc
Description: PGP signature