Re: [PATCH] KVM: x86: update master clock before computing kvmclock_offset

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

 



>   I regret not pressing harder when we sanctified this frequency
>   difference ... too late to make kvm clock follow the boot clock? :)
> ---
>  arch/x86/kvm/x86.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index b54125b590e8..b8aad0969690 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4180,9 +4180,15 @@ long kvm_arch_vm_ioctl(struct file *filp,
>  			goto out;
>  
>  		r = 0;
> +		/*
> +		 * TODO: userspace has to take care of races with VCPU_RUN, so
> +		 * kvm_gen_update_masterclock() can be cut down to locked
> +		 * pvclock_update_vm_gtod_copy().
> +		 */
> +		kvm_gen_update_masterclock(kvm);
>  		now_ns = get_kvmclock_ns(kvm);
>  		kvm->arch.kvmclock_offset += user_ns.clock - now_ns;
> -		kvm_gen_update_masterclock(kvm);
> +		kvm_make_all_cpus_request(kvm, KVM_REQ_CLOCK_UPDATE);
>  		break;

Looks good, though I'd still prefer to do what the TODO says...  I'll
try to put together a patch today.

Paolo



[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