Re: [patch 3/3] KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR

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

 




On 28/05/2015 03:47, Marcelo Tosatti wrote:
> Initialize kvmclock base, on kvmclock system MSR write time,
> so that the guest sees kvmclock counting from zero.
> 
> This matches baremetal behaviour when kvmclock in guest
> sets sched clock stable.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
> 
> ---
>  arch/x86/kvm/x86.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> Index: kvm/arch/x86/kvm/x86.c
> ===================================================================
> --- kvm.orig/arch/x86/kvm/x86.c	2015-05-27 17:40:46.948189811 -0300
> +++ kvm/arch/x86/kvm/x86.c	2015-05-27 22:43:47.340413347 -0300
> @@ -1703,6 +1703,8 @@
>  	/* If the host uses TSC clocksource, then it is stable */
>  	if (use_master_clock)
>  		pvclock_flags |= PVCLOCK_TSC_STABLE_BIT;
> +	if (ka->kvmclk_counts_from_zero)

Not defined anywhere.

> +		pvclock_flags |= PVCLOCK_COUNTS_FROM_ZERO;

Why can't this be unconditional?

Paolo

>  	vcpu->hv_clock.flags = pvclock_flags;
>  
> @@ -2282,6 +2284,9 @@
>  					&vcpu->requests);
>  
>  			ka->boot_vcpu_runs_old_kvmclock = tmp;
> +
> +			ka->kvmclock_offset = -get_kernel_ns();
> +			ka->kvmclk_counts_from_zero = true;
>  		}
>  
>  		vcpu->arch.time = data;
> 
> 
--
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