ACK: [B][PATCH 1/1] kvmclock: fix TSC calibration for nested guests

Stefan Bader stefan.bader at canonical.com
Thu Apr 4 09:39:16 UTC 2019


On 02.04.19 19:49, Heitor R. Alves de Siqueira wrote:
> From: Peng Hao <peng.hao2 at zte.com.cn>
> 
> BugLink: https://bugs.launchpad.net/bugs/1822821
> 
> Inside a nested guest, access to hardware can be slow enough that
> tsc_read_refs always return ULLONG_MAX, causing tsc_refine_calibration_work
> to be called periodically and the nested guest to spend a lot of time
> reading the ACPI timer.
> 
> However, if the TSC frequency is available from the pvclock page,
> we can just set X86_FEATURE_TSC_KNOWN_FREQ and avoid the recalibration.
> 'refine' operation.
> 
> Suggested-by: Peter Zijlstra <peterz at infradead.org>
> Signed-off-by: Peng Hao <peng.hao2 at zte.com.cn>
> [Commit message rewritten. - Paolo]
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> (cherry picked from commit e10f7805032365cc11c739a97f226ebb48aee042)
> Signed-off-by: Heitor R. Alves de Siqueira <halves at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
> ---
>  arch/x86/kernel/kvmclock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index d79a18b4cf9d..4c53d12ca933 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -138,6 +138,7 @@ static unsigned long kvm_get_tsc_khz(void)
>  	src = &hv_clock[cpu].pvti;
>  	tsc_khz = pvclock_tsc_khz(src);
>  	put_cpu();
> +	setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
>  	return tsc_khz;
>  }
>  
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20190404/6446dbc3/attachment.sig>


More information about the kernel-team mailing list