From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 661501E0491; Wed, 6 Nov 2024 12:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897803; cv=none; b=G0Q+CEdZW636ROL1YHAkBJw+KT7rtFGsV3bXUOSBMqrEUiu3EoBGX2VqSUcdDOO/08If+k3N2h2wG7nGJPHORzQJ8fEuSaWwMvWdM2JSzZ8UYWmVLA2vmgsTEuqoPi4Y51TZFIrPhvr7qbL1sR08quusSN389eBktXrle0z9DD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897803; c=relaxed/simple; bh=9aQpn1TdKqCW49hx8dO0tOHevx/LZLD6tWcIcoaAxsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VfpmBmIukn1Qz2tWIW+E306v8U88zYUVzYqac47YfIhfaF1hBldJX0NYF8PaabwfPUOeDgDpFHnplkP2tU0tkINcxkfbE+JZlQ2y7zAZw6oPVMohW1qCmgNtGOfZiLM1iotdizhu18xRHXEyNHEM4kJHKuAROj3bRHdo6KEUfWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kNDMIpEq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kNDMIpEq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCF1AC4CECD; Wed, 6 Nov 2024 12:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730897803; bh=9aQpn1TdKqCW49hx8dO0tOHevx/LZLD6tWcIcoaAxsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNDMIpEq5Zj9H2pAYIUUtS62587HF8YDilfxl4QX9/6VXs81Syivejh2qM73Sn678 2U8NjgqcfmAAXzr3k7kQMVRE2XJOIuFTZlxZTLLMx1W3XpmEvPQXhmjBHgWwMIMNHA zM4+xlynius+E2tjkAf2piwvE13gwD5SOqK7UXRo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Kelley , Roman Kisel , Wei Liu , Sasha Levin Subject: [PATCH 5.4 024/462] x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency Date: Wed, 6 Nov 2024 12:58:37 +0100 Message-ID: <20241106120332.112660716@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120331.497003148@linuxfoundation.org> References: <20241106120331.497003148@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Kelley [ Upstream commit 8fcc514809de41153b43ccbe1a0cdf7f72b78e7e ] 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 Reviewed-by: Roman Kisel Link: https://lore.kernel.org/r/20240606025559.1631-1-mhklinux@outlook.com Signed-off-by: Wei Liu Message-ID: <20240606025559.1631-1-mhklinux@outlook.com> Signed-off-by: Sasha Levin --- 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 51d95c4b692c3..cebbcc6c36ae5 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -256,6 +256,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.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) { -- 2.43.0