KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR
Change as described sounds good, however:
Review int kvm_set_msr_common(struct kvm_vcpu *vcpu, · line 2194
Quoted 8 lines
(quoted diff) +2
-0@@ -2188,6 +2188,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) &vcpu->requests); ka->boot_vcpu_runs_old_kvmclock = tmp; + + ka->kvmclock_offset = get_kernel_ns(); }
Should this be ka->kvmclock_offset = -get_kernel_ns()? kvm_guest_time_update() sets hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset, and similarly kvmclock_offset is added to the value from get_kernel_ns() in the handler for HV_X64_MSR_TIME_REF_COUNT.
PATCH v2 1/1 KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR
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.
arch/x86/kvm/x86.c +2 -0
@@ -2188,6 +2188,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) &vcpu->requests); ka->boot_vcpu_runs_old_kvmclock = tmp; + + ka->kvmclock_offset = -get_kernel_ns (); } vcpu->arch.time = data;
Quoted 7 lines · On Sat, 23 May 2015 17:06:29 -0300 Marcelo Tosatti <[email protected]> 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 <[email protected]>
Quoted 20 lines
arch/x86/kvm/x86.c +2
-1@@ -2188,6 +2188,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) &vcpu->requests); ka->boot_vcpu_runs_old_kvmclock = tmp; + + ka->kvmclock_offset = -get_kernel_ns (); } vcpu->arch.time = data; --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/