* Re: KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR
@ 2015-05-22 21:40 Owen Hofmann
2015-05-23 20:06 ` [PATCH v2] " Marcelo Tosatti
0 siblings, 1 reply; 3+ messages in thread
From: Owen Hofmann @ 2015-05-22 21:40 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: KVM General, Paolo Bonzini, LKML, Sasha Levin
Change as described sounds good, however:
> @@ -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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR
2015-05-22 21:40 KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR Owen Hofmann
@ 2015-05-23 20:06 ` Marcelo Tosatti
2015-05-26 13:22 ` Luiz Capitulino
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2015-05-23 20:06 UTC (permalink / raw)
To: Owen Hofmann, Paolo Bonzini; +Cc: KVM General, Paolo Bonzini, LKML, Sasha Levin
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@redhat.com>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index cc2c759..ea40d24 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR
2015-05-23 20:06 ` [PATCH v2] " Marcelo Tosatti
@ 2015-05-26 13:22 ` Luiz Capitulino
0 siblings, 0 replies; 3+ messages in thread
From: Luiz Capitulino @ 2015-05-26 13:22 UTC (permalink / raw)
To: Marcelo Tosatti
Cc: Owen Hofmann, Paolo Bonzini, KVM General, LKML, Sasha Levin
On Sat, 23 May 2015 17:06:29 -0300
Marcelo Tosatti <mtosatti@redhat.com> 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@redhat.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index cc2c759..ea40d24 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-26 13:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 21:40 KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR Owen Hofmann
2015-05-23 20:06 ` [PATCH v2] " Marcelo Tosatti
2015-05-26 13:22 ` Luiz Capitulino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).