[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <172261703803.2215.17943747116347203203.tip-bot2@tip-bot2>
Date: Fri, 02 Aug 2024 16:43:58 -0000
From: "tip-bot2 for Paul E. McKenney" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Zhengxu Chen <zhxchen17@...a.com>,
Danielle Costantino <dcostantino@...a.com>,
"Paul E. McKenney" <paulmck@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/timers] x86/tsc: Check for sockets instead of CPUs to make
code match comment
The following commit has been merged into the x86/timers branch of tip:
Commit-ID: e7ff4ebffe3bedf55560ef861d80f6500ff0d76f
Gitweb: https://git.kernel.org/tip/e7ff4ebffe3bedf55560ef861d80f6500ff0d76f
Author: Paul E. McKenney <paulmck@...nel.org>
AuthorDate: Fri, 02 Aug 2024 08:46:18 -07:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Fri, 02 Aug 2024 18:38:07 +02:00
x86/tsc: Check for sockets instead of CPUs to make code match comment
The unsynchronized_tsc() eventually checks num_possible_cpus(), and if the
system is non-Intel and the number of possible CPUs is greater than one,
assumes that TSCs are unsynchronized. This despite the comment saying
"assume multi socket systems are not synchronized", that is, socket rather
than CPU. This behavior was preserved by commit 8fbbc4b45ce3 ("x86: merge
tsc_init and clocksource code") and by the previous relevant commit
7e69f2b1ead2 ("clocksource: Remove the update callback").
The clocksource drivers were added by commit 5d0cf410e94b ("Time: i386
Clocksource Drivers") back in 2006, and the comment still said "socket"
rather than "CPU".
Therefore, bravely (and perhaps foolishly) make the code match the
comment.
Note that it is possible to bypass both code and comment by booting
with tsc=reliable, but this also disables the clocksource watchdog,
which is undesirable when trust in the TSC is strictly limited.
Reported-by: Zhengxu Chen <zhxchen17@...a.com>
Reported-by: Danielle Costantino <dcostantino@...a.com>
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/all/20240802154618.4149953-5-paulmck@kernel.org
---
arch/x86/kernel/tsc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 0ced187..dfe6847 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1288,7 +1288,7 @@ int unsynchronized_tsc(void)
*/
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
/* assume multi socket systems are not synchronized: */
- if (num_possible_cpus() > 1)
+ if (topology_max_packages() > 1)
return 1;
}
Powered by blists - more mailing lists