From nobody Fri Nov 29 15:56:05 2024 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 126E816C852; Wed, 18 Sep 2024 07:18: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=1726643923; cv=none; b=ajwVexT6yBjuxVVZ3mmpwK58DymitWEnwYf+hh7tf/BG865x369zukjeQ+6SVSmxawTzydmXu+b5g5lThg7rOs5EXQFJ5MTt5U3cSl+1x20unNy216I5d4iX6PkohdDDjXHzvXge95BXJYV2gzwmDwdxxOi4GFahFZCcDjmO6m0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726643923; c=relaxed/simple; bh=mDUm5HnuT8XAIWwSA2FsYNYxm7HOA0+SdLfLadWOtQ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=t1PPLKht3QQanL3W1k4ckvQMf1K5l8XTxln18xA1gtXxqLDCAwTAWaHpJ8p2QE0YePdP8mBhQSSimif10G9Zk3aBSIltOphDE30sANdtsGgAAnMzaWhjecC0IrQ6TRpSprPq7Vsrb5gU55i6asJvqIxUg/A+t5heLgip+9aA8o8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UFlFh7mx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UFlFh7mx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 912F8C4CED1; Wed, 18 Sep 2024 07:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726643922; bh=mDUm5HnuT8XAIWwSA2FsYNYxm7HOA0+SdLfLadWOtQ8=; h=From:To:Cc:Subject:Date:From; b=UFlFh7mxQSimASiTpj0jSP/v75dr6jLz+prn+1QUvtY7VmmHQS2AnGdQJbQ5J4gKG jmR3kkv8azxm8AgIFJ7fJboG3v1nj9BDSFic0gLf84acGdl41jRv4WCKGf9hgXx99g 7k/BVA6n3ZVgXB/Oc8d2ba46kezg4LzfavcOsTtwOBeFJPBnwlNBUBeN5mDYPto3gc VG5y1vX1ixSmgjUrc/kUI9X854Co5qhrjPebTbzpaRiY0kCoUbQ+OdhJ1e0gd22yq2 Syn3IOOnN4vtLuoAOQQ6z/xoSU+i9bAWY77qxhx+sh1AQuxYVCNZSQRxNIh2wKtTQN zsCzy1/UEMljg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Kelley , Roman Kisel , Wei Liu , Sasha Levin , kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, linux-hyperv@vger.kernel.org Subject: [PATCH AUTOSEL 5.4] x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency Date: Wed, 18 Sep 2024 02:37:01 -0400 Message-ID: <20240918063701.239061-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.284 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 51d95c4b692c..cebbcc6c36ae 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 =3D hv_get_tsc_khz; x86_platform.calibrate_cpu =3D hv_get_tsc_khz; + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ); } =20 if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) { --=20 2.43.0