Re: [PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration

2018-07-18 Thread Pavel Tatashin
Thank you Paolo for letting me know. I will remove this patch from the
series, or it can be removed by whomever adds the series.

Thank you,
Pavel
On Wed, Jul 18, 2018 at 7:14 AM Paolo Bonzini  wrote:
>
> On 18/07/2018 04:21, Pavel Tatashin wrote:
> > From: Peter Zijlstra 
> >
> > If the host gives us a TSC rate, assume it is good and don't try and
> > recalibrate things against virtual timer hardware.
> >
> > Signed-off-by: Peter Zijlstra (Intel) 
> > Signed-off-by: Pavel Tatashin 
> > ---
> >  arch/x86/kernel/kvmclock.c | 11 ++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> > index ed170171fe49..da0ede8ac8f6 100644
> > --- a/arch/x86/kernel/kvmclock.c
> > +++ b/arch/x86/kernel/kvmclock.c
> > @@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable)
> >   */
> >  static unsigned long kvm_get_tsc_khz(void)
> >  {
> > - return pvclock_tsc_khz(this_cpu_pvti());
> > + unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti());
> > +
> > + /*
> > +  * TSC frequency is reported by the host; calibration against 
> > (virtual)
> > +  * HPET/PM-timer in a guest is dodgy and pointless since the host
> > +  * already did it for us where required.
> > +  */
> > + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
> > +
> > + return tsc_khz;
> >  }
> >
> >  static void kvm_get_preset_lpj(void)
> >
>
> This patch (really a similar one) has just been sent to Linus.
>
> Paolo


Re: [PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration

2018-07-18 Thread Pavel Tatashin
Thank you Paolo for letting me know. I will remove this patch from the
series, or it can be removed by whomever adds the series.

Thank you,
Pavel
On Wed, Jul 18, 2018 at 7:14 AM Paolo Bonzini  wrote:
>
> On 18/07/2018 04:21, Pavel Tatashin wrote:
> > From: Peter Zijlstra 
> >
> > If the host gives us a TSC rate, assume it is good and don't try and
> > recalibrate things against virtual timer hardware.
> >
> > Signed-off-by: Peter Zijlstra (Intel) 
> > Signed-off-by: Pavel Tatashin 
> > ---
> >  arch/x86/kernel/kvmclock.c | 11 ++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> > index ed170171fe49..da0ede8ac8f6 100644
> > --- a/arch/x86/kernel/kvmclock.c
> > +++ b/arch/x86/kernel/kvmclock.c
> > @@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable)
> >   */
> >  static unsigned long kvm_get_tsc_khz(void)
> >  {
> > - return pvclock_tsc_khz(this_cpu_pvti());
> > + unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti());
> > +
> > + /*
> > +  * TSC frequency is reported by the host; calibration against 
> > (virtual)
> > +  * HPET/PM-timer in a guest is dodgy and pointless since the host
> > +  * already did it for us where required.
> > +  */
> > + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
> > +
> > + return tsc_khz;
> >  }
> >
> >  static void kvm_get_preset_lpj(void)
> >
>
> This patch (really a similar one) has just been sent to Linus.
>
> Paolo


Re: [PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration

2018-07-18 Thread Paolo Bonzini
On 18/07/2018 04:21, Pavel Tatashin wrote:
> From: Peter Zijlstra 
> 
> If the host gives us a TSC rate, assume it is good and don't try and
> recalibrate things against virtual timer hardware.
> 
> Signed-off-by: Peter Zijlstra (Intel) 
> Signed-off-by: Pavel Tatashin 
> ---
>  arch/x86/kernel/kvmclock.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index ed170171fe49..da0ede8ac8f6 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable)
>   */
>  static unsigned long kvm_get_tsc_khz(void)
>  {
> - return pvclock_tsc_khz(this_cpu_pvti());
> + unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti());
> +
> + /*
> +  * TSC frequency is reported by the host; calibration against (virtual)
> +  * HPET/PM-timer in a guest is dodgy and pointless since the host
> +  * already did it for us where required.
> +  */
> + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
> +
> + return tsc_khz;
>  }
>  
>  static void kvm_get_preset_lpj(void)
> 

This patch (really a similar one) has just been sent to Linus.

Paolo


Re: [PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration

2018-07-18 Thread Paolo Bonzini
On 18/07/2018 04:21, Pavel Tatashin wrote:
> From: Peter Zijlstra 
> 
> If the host gives us a TSC rate, assume it is good and don't try and
> recalibrate things against virtual timer hardware.
> 
> Signed-off-by: Peter Zijlstra (Intel) 
> Signed-off-by: Pavel Tatashin 
> ---
>  arch/x86/kernel/kvmclock.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index ed170171fe49..da0ede8ac8f6 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable)
>   */
>  static unsigned long kvm_get_tsc_khz(void)
>  {
> - return pvclock_tsc_khz(this_cpu_pvti());
> + unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti());
> +
> + /*
> +  * TSC frequency is reported by the host; calibration against (virtual)
> +  * HPET/PM-timer in a guest is dodgy and pointless since the host
> +  * already did it for us where required.
> +  */
> + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
> +
> + return tsc_khz;
>  }
>  
>  static void kvm_get_preset_lpj(void)
> 

This patch (really a similar one) has just been sent to Linus.

Paolo


[PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration

2018-07-17 Thread Pavel Tatashin
From: Peter Zijlstra 

If the host gives us a TSC rate, assume it is good and don't try and
recalibrate things against virtual timer hardware.

Signed-off-by: Peter Zijlstra (Intel) 
Signed-off-by: Pavel Tatashin 
---
 arch/x86/kernel/kvmclock.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index ed170171fe49..da0ede8ac8f6 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable)
  */
 static unsigned long kvm_get_tsc_khz(void)
 {
-   return pvclock_tsc_khz(this_cpu_pvti());
+   unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti());
+
+   /*
+* TSC frequency is reported by the host; calibration against (virtual)
+* HPET/PM-timer in a guest is dodgy and pointless since the host
+* already did it for us where required.
+*/
+   setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
+
+   return tsc_khz;
 }
 
 static void kvm_get_preset_lpj(void)
-- 
2.18.0



[PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration

2018-07-17 Thread Pavel Tatashin
From: Peter Zijlstra 

If the host gives us a TSC rate, assume it is good and don't try and
recalibrate things against virtual timer hardware.

Signed-off-by: Peter Zijlstra (Intel) 
Signed-off-by: Pavel Tatashin 
---
 arch/x86/kernel/kvmclock.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index ed170171fe49..da0ede8ac8f6 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable)
  */
 static unsigned long kvm_get_tsc_khz(void)
 {
-   return pvclock_tsc_khz(this_cpu_pvti());
+   unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti());
+
+   /*
+* TSC frequency is reported by the host; calibration against (virtual)
+* HPET/PM-timer in a guest is dodgy and pointless since the host
+* already did it for us where required.
+*/
+   setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
+
+   return tsc_khz;
 }
 
 static void kvm_get_preset_lpj(void)
-- 
2.18.0