From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] x86/tsc: Handle CLOCK_SOURCE_VALID_FOR_HRES correctly
Date: Thu, 12 Mar 2026 11:25:25 -0000 [thread overview]
Message-ID: <177331472579.1647592.2205813610153555469.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260123231521.790598171@kernel.org>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 79ccb0693a99e1b91eba95c6bd32a3e02be156ae
Gitweb: https://git.kernel.org/tip/79ccb0693a99e1b91eba95c6bd32a3e02be156ae
Author: Thomas Gleixner <tglx@kernel.org>
AuthorDate: Sat, 24 Jan 2026 00:17:55 +01:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Thu, 12 Mar 2026 12:23:27 +01:00
x86/tsc: Handle CLOCK_SOURCE_VALID_FOR_HRES correctly
Unconditionally setting the CLOCK_SOURCE_VALID_FOR_HRES for the real TSC
clocksource is wrong as there is no guarantee that the early TSC was
validated for high resolution mode.
Set the flag only when the early TSC was validated as otherwise the
clocksource selection might enable high resolution mode with a TSC of
unknown quality and possibly no way to back out once it is discovered to be
unsuitable.
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260123231521.790598171@kernel.org
---
arch/x86/kernel/tsc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index f31046f..9ccd58c 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1200,7 +1200,6 @@ static struct clocksource clocksource_tsc = {
.read = read_tsc,
.mask = CLOCKSOURCE_MASK(64),
.flags = CLOCK_SOURCE_IS_CONTINUOUS |
- CLOCK_SOURCE_VALID_FOR_HRES |
CLOCK_SOURCE_CAN_INLINE_READ |
CLOCK_SOURCE_MUST_VERIFY |
CLOCK_SOURCE_VERIFY_PERCPU |
@@ -1411,6 +1410,15 @@ out:
have_art = true;
clocksource_tsc.base = &art_base_clk;
}
+
+ /*
+ * Transfer the valid for high resolution flag if it was set on the
+ * early TSC already. That guarantees that there is no intermediate
+ * clocksource selected once the early TSC is unregistered.
+ */
+ if (clocksource_tsc_early.flags & CLOCK_SOURCE_VALID_FOR_HRES)
+ clocksource_tsc.flags |= CLOCK_SOURCE_VALID_FOR_HRES;
+
clocksource_register_khz(&clocksource_tsc, tsc_khz);
unreg:
clocksource_unregister(&clocksource_tsc_early);
next prev parent reply other threads:[~2026-03-12 11:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 23:17 [patch 0/5] clocksource: Rewrite clocksource watchdog and related cleanups Thomas Gleixner
2026-01-23 23:17 ` [patch 1/5] parisc: Remove unused clocksource flags Thomas Gleixner
2026-01-24 8:40 ` Helge Deller
2026-03-12 11:25 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2026-01-23 23:17 ` [patch 2/5] MIPS: Dont select CLOCKSOURCE_WATCHDOG Thomas Gleixner
2026-01-24 22:28 ` Maciej W. Rozycki
2026-01-26 9:10 ` Thomas Gleixner
2026-03-12 11:25 ` [tip: timers/core] MIPS: Don't " tip-bot2 for Thomas Gleixner
2026-01-23 23:17 ` [patch 3/5] x86/tsc: Handle CLOCK_SOURCE_VALID_FOR_HRES correctly Thomas Gleixner
2026-03-12 11:25 ` tip-bot2 for Thomas Gleixner [this message]
2026-01-23 23:17 ` [patch 4/5] clocksource: Dont use non-continuous clocksources as watchdog Thomas Gleixner
2026-03-12 11:25 ` [tip: timers/core] clocksource: Don't " tip-bot2 for Thomas Gleixner
2026-01-23 23:18 ` [patch 5/5] clocksource: Rewrite watchdog code completely Thomas Gleixner
2026-02-02 6:45 ` Daniel J Blueman
2026-02-02 11:27 ` Thomas Gleixner
2026-02-15 12:18 ` Daniel J Blueman
2026-02-23 13:53 ` Thomas Gleixner
2026-03-08 9:53 ` Thomas Gleixner
2026-03-15 14:59 ` Daniel J Blueman
2026-03-17 9:01 ` Thomas Gleixner
2026-03-18 14:10 ` Daniel J Blueman
2026-03-19 20:31 ` Thomas Gleixner
2026-03-20 2:21 ` Daniel J Blueman
2026-03-20 8:26 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2026-03-20 12:42 ` tip-bot2 for Thomas Gleixner
2026-02-25 18:13 ` [patch 5/5] " Jiri Wiesner
2026-03-08 10:05 ` Thomas Gleixner
2026-03-11 13:12 ` Jiri Wiesner
2026-03-09 15:43 ` Borislav Petkov
2026-03-11 7:58 ` Thomas Gleixner
2026-09-18 3:46 ` Aithal, Srikanth
2026-09-18 5:54 ` Borislav Petkov
2026-09-18 10:28 ` Aithal, Srikanth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=177331472579.1647592.2205813610153555469.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®