[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240415030019.2220750-1-lei.chen@smartx.com>
Date: Sun, 14 Apr 2024 23:00:18 -0400
From: Lei Chen <lei.chen@...rtx.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: Lei Chen <lei.chen@...rtx.com>,
Ingo Molnar <mingo@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] x86/tsc: print some log if calibrated tsc freq deviates from original too much
In most cases, tsc_khz is refined by hpet on boot. But in a few
production-level nodes, the refinement fails because calibrated
freq diviates from origin tsc freq more than 1%. Printing some
logs will help get this info.
Signed-off-by: Lei Chen <lei.chen@...rtx.com>
Suggested-by: Ingo Molnar <mingo@...nel.org>
---
Changes from v1:
https://lore.kernel.org/all/20240408100607.1732600-1-lei.chen@smartx.com/
1. s/deviates too much from/deviates by more than 1%% from
2. Use pr_info instead of pr_warning
arch/x86/kernel/tsc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 15f97c0abc9d..06c6583aa8fb 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1435,8 +1435,15 @@ static void tsc_refine_calibration_work(struct work_struct *work)
}
/* Make sure we're within 1% */
- if (abs(tsc_khz - freq) > tsc_khz/100)
+ if (abs(tsc_khz - freq) > tsc_khz/100) {
+ pr_info("TSC freq calibrated by [%s]: %lu.%03lu MHz deviates by more than 1%% from original freq: %lu.%03lu MHz\n",
+ hpet ? "HPET" : "PM_TIMER",
+ (unsigned long)freq / 1000,
+ (unsigned long)freq % 1000,
+ (unsigned long)tsc_khz / 1000,
+ (unsigned long)tsc_khz % 1000);
goto out;
+ }
tsc_khz = freq;
pr_info("Refined TSC clocksource calibration: %lu.%03lu MHz\n",
--
2.44.0
Powered by blists - more mailing lists