linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Kisel <romank@linux.microsoft.com>
To: mhklinux@outlook.com, kys@microsoft.com, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency
Date: Tue, 11 Jun 2024 07:51:48 -0700	[thread overview]
Message-ID: <226804eb-af9d-4a56-aef5-e3045e83b551@linux.microsoft.com> (raw)
In-Reply-To: <20240606025559.1631-1-mhklinux@outlook.com>



On 6/5/2024 7:55 PM, mhkelley58@gmail.com wrote:
> From: Michael Kelley <mhklinux@outlook.com>
> 
> A Linux guest on Hyper-V gets the TSC frequency from a synthetic MSR, if
> available. In this case, set X86_FEATURE_TSC_KNOWN_FREQ so that Linux
> doesn't unnecessarily do refined TSC calibration when setting up the TSC
> clocksource.
> 
> With this change, a message such as this is no longer output during boot
> when the TSC is used as the clocksource:
> 
> [    1.115141] tsc: Refined TSC clocksource calibration: 2918.408 MHz
> 
> Furthermore, the guest and host will have exactly the same view of the
> TSC frequency, which is important for features such as the TSC deadline
> timer that are emulated by the Hyper-V host.
> 
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>
> ---
>   arch/x86/kernel/cpu/mshyperv.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index e0fd57a8ba84..c3e38eaf6d2f 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -424,6 +424,7 @@ static void __init ms_hyperv_init_platform(void)
>   	    ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {
>   		x86_platform.calibrate_tsc = hv_get_tsc_khz;
>   		x86_platform.calibrate_cpu = hv_get_tsc_khz;
> +		setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
>   	}
>   
>   	if (ms_hyperv.priv_high & HV_ISOLATION) {

LGTM

Reviewed-by: Roman Kisel <romank@linux.microsoft.com>

-- 
Thank you,
Roman

  reply	other threads:[~2024-06-11 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06  2:55 [PATCH 1/1] x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency mhkelley58
2024-06-11 14:51 ` Roman Kisel [this message]
2024-08-02 23:49   ` Wei Liu
2024-08-06  2:01     ` Michael Kelley
2024-08-23 21:51       ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=226804eb-af9d-4a56-aef5-e3045e83b551@linux.microsoft.com \
    --to=romank@linux.microsoft.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).