All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] x86: use new kvmclock MSRs
@ 2016-03-09  0:48 David Matlack
  2016-03-09 10:53 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: David Matlack @ 2016-03-09  0:48 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, mtosatti, David Matlack

54750f2cf0 (KVM: x86: workaround SuSE's 2.6.16 pvclock vs masterclock
issue) disables masterclock if the boot VCPU uses the old kvmclock
system time MSR. This caused kvmclock_test to start running with
masterclock disabled.

Since the old kvmclock MSRs are deprecated, and their usage disables
masterclock, switch to using the new kvmclock MSRs instead.

Signed-off-by: David Matlack <dmatlack@google.com>
---
 x86/kvmclock.c | 6 +++---
 x86/kvmclock.h | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/x86/kvmclock.c b/x86/kvmclock.c
index 588d8ec..327e60d 100644
--- a/x86/kvmclock.c
+++ b/x86/kvmclock.c
@@ -229,12 +229,12 @@ void kvm_clock_init(void *data)
         struct pvclock_vcpu_time_info *hvc = &hv_clock[index];
 
         printf("kvm-clock: cpu %d, msr %p\n", index, hvc);
-        wrmsr(MSR_KVM_SYSTEM_TIME, (unsigned long)hvc | 1);
+        wrmsr(MSR_KVM_SYSTEM_TIME_NEW, (unsigned long)hvc | 1);
 }
 
 void kvm_clock_clear(void *data)
 {
-        wrmsr(MSR_KVM_SYSTEM_TIME, 0LL);
+        wrmsr(MSR_KVM_SYSTEM_TIME_NEW, 0LL);
 }
 
 void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
@@ -268,7 +268,7 @@ void kvm_get_wallclock(struct timespec *ts)
         struct pvclock_vcpu_time_info *vcpu_time;
         int index = smp_id();
 
-        wrmsr(MSR_KVM_WALL_CLOCK, (unsigned long)&wall_clock);
+        wrmsr(MSR_KVM_WALL_CLOCK_NEW, (unsigned long)&wall_clock);
         vcpu_time = &hv_clock[index];
         pvclock_read_wallclock(&wall_clock, vcpu_time, ts);
 }
diff --git a/x86/kvmclock.h b/x86/kvmclock.h
index 166a338..ab7dc0c 100644
--- a/x86/kvmclock.h
+++ b/x86/kvmclock.h
@@ -1,8 +1,8 @@
 #ifndef KVMCLOCK_H
 #define KVMCLOCK_H
 
-#define MSR_KVM_WALL_CLOCK  0x11
-#define MSR_KVM_SYSTEM_TIME 0x12
+#define MSR_KVM_WALL_CLOCK_NEW  0x4b564d00
+#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
 
 #define MAX_CPU 64
 
-- 
2.7.0.rc3.207.g0ac5344


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH kvm-unit-tests] x86: use new kvmclock MSRs
  2016-03-09  0:48 [PATCH kvm-unit-tests] x86: use new kvmclock MSRs David Matlack
@ 2016-03-09 10:53 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-03-09 10:53 UTC (permalink / raw)
  To: David Matlack, kvm; +Cc: mtosatti



On 09/03/2016 01:48, David Matlack wrote:
> 54750f2cf0 (KVM: x86: workaround SuSE's 2.6.16 pvclock vs masterclock
> issue) disables masterclock if the boot VCPU uses the old kvmclock
> system time MSR. This caused kvmclock_test to start running with
> masterclock disabled.
> 
> Since the old kvmclock MSRs are deprecated, and their usage disables
> masterclock, switch to using the new kvmclock MSRs instead.
> 
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
>  x86/kvmclock.c | 6 +++---
>  x86/kvmclock.h | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/x86/kvmclock.c b/x86/kvmclock.c
> index 588d8ec..327e60d 100644
> --- a/x86/kvmclock.c
> +++ b/x86/kvmclock.c
> @@ -229,12 +229,12 @@ void kvm_clock_init(void *data)
>          struct pvclock_vcpu_time_info *hvc = &hv_clock[index];
>  
>          printf("kvm-clock: cpu %d, msr %p\n", index, hvc);
> -        wrmsr(MSR_KVM_SYSTEM_TIME, (unsigned long)hvc | 1);
> +        wrmsr(MSR_KVM_SYSTEM_TIME_NEW, (unsigned long)hvc | 1);
>  }
>  
>  void kvm_clock_clear(void *data)
>  {
> -        wrmsr(MSR_KVM_SYSTEM_TIME, 0LL);
> +        wrmsr(MSR_KVM_SYSTEM_TIME_NEW, 0LL);
>  }
>  
>  void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
> @@ -268,7 +268,7 @@ void kvm_get_wallclock(struct timespec *ts)
>          struct pvclock_vcpu_time_info *vcpu_time;
>          int index = smp_id();
>  
> -        wrmsr(MSR_KVM_WALL_CLOCK, (unsigned long)&wall_clock);
> +        wrmsr(MSR_KVM_WALL_CLOCK_NEW, (unsigned long)&wall_clock);
>          vcpu_time = &hv_clock[index];
>          pvclock_read_wallclock(&wall_clock, vcpu_time, ts);
>  }
> diff --git a/x86/kvmclock.h b/x86/kvmclock.h
> index 166a338..ab7dc0c 100644
> --- a/x86/kvmclock.h
> +++ b/x86/kvmclock.h
> @@ -1,8 +1,8 @@
>  #ifndef KVMCLOCK_H
>  #define KVMCLOCK_H
>  
> -#define MSR_KVM_WALL_CLOCK  0x11
> -#define MSR_KVM_SYSTEM_TIME 0x12
> +#define MSR_KVM_WALL_CLOCK_NEW  0x4b564d00
> +#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
>  
>  #define MAX_CPU 64
>  
> 

Applied, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-09 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09  0:48 [PATCH kvm-unit-tests] x86: use new kvmclock MSRs David Matlack
2016-03-09 10:53 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.