Re: [RFC PATCH v2 1/2] add support for Hyper-V reference time counter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23.05.2013 15:23, Paolo Bonzini wrote:
Il 23/05/2013 15:20, Peter Lieven ha scritto:
On 23.05.2013 15:18, Paolo Bonzini wrote:
Il 23/05/2013 14:25, Vadim Rozenfeld ha scritto:


----- Original Message -----
From: "Peter Lieven" <pl@xxxxxxxxx>
To: "Paolo Bonzini" <pbonzini@xxxxxxxxxx>
Cc: "Vadim Rozenfeld" <vrozenfe@xxxxxxxxxx>, "Marcelo Tosatti"
<mtosatti@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, gleb@xxxxxxxxxx, pl@xxxxxxx
Sent: Thursday, May 23, 2013 4:17:57 PM
Subject: Re: [RFC PATCH v2 1/2] add support for Hyper-V reference
time counter

On 22.05.2013 23:55, Paolo Bonzini wrote:
Il 22/05/2013 09:32, Vadim Rozenfeld ha scritto:
@@ -1827,6 +1829,29 @@ static int set_msr_hyperv_pw(struct
kvm_vcpu *vcpu, u32 msr, u64 data)
            if (__copy_to_user((void __user *)addr, instructions, 4))
                return 1;
            kvm->arch.hv_hypercall = data;
+        local_irq_disable();
+        kvm->arch.hv_ref_count = get_kernel_ns();
+        local_irq_enable();
+        break;
local_irq_disable/local_irq_enable not needed.


What is the reasoning behind reading this time value at msr write
time?
[VR] Windows writs this MSR only once, during HAL initialization.
So, I decided to treat this call as a partition crate event.


But is it expected by Windows that the reference count starts counting
up from 0 at partition creation time?  If you could just use
(get_kernel_ns() + kvm->arch.kvmclock_offset) / 100, it would also be
simpler for migration purposes.

I can just report, that I have used the patch that does it that way
and it works.
Maybe Windows is calculating the uptime by the reference counter?

[VR]
Windows use it (reference counters/iTSC/PMTimer/HPET) as a time-stamp
source
for (Ke)QueryPerformanceCounter function.

So I would prefer to remove kvm->arch.hv_ref_count altogether.

But only if the migration support is guaranteed.

Migration support wouldn't work yet anyway, you need to recompute the
scale and sequence.  But that could be done by KVM_SET_CLOCK.

hv_ref_counter does work out of the box. what I was trying to say is
even it is slower than iTSC, it is significantly faster than hpet
or pmtimer and I can confirm it works flawlessly with migration.


And what if we have a host which lacks invariant TSC support?

Then the sequence must be set to 0 or 0xFFFFFFFF, I still haven't
understood. :)

yes, but windows does then fall back to pmtimer or hpet which is much slower
then reference counter.

Peter
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux