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 D763F16BE14; Wed, 18 Sep 2024 07:18:09 +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=1726643889; cv=none; b=GOjhi1vMDvWGNFS6W6AEirURuHT8q9Eo6APbh5DkGrIYdpSWs3s/NtBmydFGGLkbuMch2HbnjgEl4A35ulJsXmKP+Cvcrt70V+0CyXmQB05jKspaSHSY/2w5P75BvEiNKoenIiPhzJtu630C243ZFPb86OSqRLEQf1Uq8LUihJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726643889; c=relaxed/simple; bh=VuIhgX0aIBpCJp0kNodFaEnnzvm7wiw0m0bIXLnJIYA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=In78/rbNNG2XGCIBGWOzphjwGXU5PAOZMe+yXEchvDBXyK1kleZDLKJENpZjEf7D82EGWetcuJ+yQOmWjAmb7QGIHKyN19pqjSKsiOSEJb39rKnqJsdJIDaawLJI/6y5NnGeYEdjHRggbR1obHfeFTzjPq0ZZINEf30jEJVtAqU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O7A8z/Uj; 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="O7A8z/Uj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 562C3C4CEC3; Wed, 18 Sep 2024 07:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726643889; bh=VuIhgX0aIBpCJp0kNodFaEnnzvm7wiw0m0bIXLnJIYA=; h=From:To:Cc:Subject:Date:From; b=O7A8z/UjjTK0WJBU069eSwmSZXIQn8qt/Qoll9WDoENZqcO2lxA2/ouPplRIdtcfj 4VYYwem7Elmv23hqoITHcOAhzPXCSUdYZ7+AfM16bwvL1bldlvmgQf+V3N9qV2K+Hm kTSKdselspsxt+maCf/aF6IwPOu30+P6JWG9l7ySEopg8vqJrDWwA3d79Hd9S9k2bQ 9eObea0auO5j78ygSo/l9tu2a4MObNV7y8wWy3B0LAejKob4V7ldBiZFjmAOCg1Enk CKiD1RgCFlu8LTxGQTmWjVqQhvrZkRO3jLndtBaBEAoM45edcCAOCQ8Ugcp8g/VSoc 6qfoA8iLSznvw== 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 6.6 1/2] x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency Date: Wed, 18 Sep 2024 02:36:26 -0400 Message-ID: <20240918063628.238885-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 6.6.51 Content-Transfer-Encoding: 8bit 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 e6bba12c759c..9a7cd3ce59ed 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -423,6 +423,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) { -- 2.43.0