From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@kernel.org>
Cc: "Bird, Tim" <Tim.Bird@sony.com>,
"pmladek@suse.com" <pmladek@suse.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
Shashank Balaji <shashankbalaji02@gmail.com>,
"john.ogness@linutronix.de" <john.ogness@linutronix.de>,
"francesco@valla.it" <francesco@valla.it>,
"geert@linux-m68k.org" <geert@linux-m68k.org>,
"linux-embedded@vger.kernel.org" <linux-embedded@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
x86@kernel.org, Paolo Bonzini <bonzini@gnu.org>,
Sean Christopherson <seanjc@google.com>,
KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH v3] printk: fix zero-valued printk timestamps in early boot
Date: Mon, 30 Mar 2026 14:05:38 +0200 [thread overview]
Message-ID: <20260330120538.GM3738010@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <87fr5ib6ks.ffs@tglx>
On Mon, Mar 30, 2026 at 12:42:59AM +0200, Thomas Gleixner wrote:
> Quite the contrary, I'm going to get rid of technical debt:
>
> The get_cycles() related changes in tsc.h are going to end up in a
> obviously revised formal patch tomorrow as there is exactly _zero_
> requirement to provide this as a functional interface.
>
> 1) The default implementation in asm-generic returns 0
>
> Ergo any code depending on a functional implementation is broken
> by definition.
>
> 2) The ops/cycles metrics are as bogus as the infamous BogoMIPS metrics
>
> The "cycle" counter runs on almost all contemporary CPUs at a fixed
> frequency, which is completely unrelated to the actual CPU
> frequency and therefore to the actual CPU cycles.
>
> The only realistic metric is ops/sec and nothing else and that can
> be trivially achieved by using the generic time getter interfaces.
>
> Those might end up resulting in bogus benchmark results too if the
> underlying clocksource is jiffies, but that's again a matter of
> accepting reality.
>
> If people really mandate that ops/bogo_cycles is required for the
> very wrong reasons, then I'm happy to bring it back with a global
> name change from get_cycles() to get_bogo_cycles() which excludes
> it from any serious usage including printk.
>
> Thanks,
>
> tglx
> ---
> arch/x86/include/asm/tsc.h | 11 ++--
> arch/x86/kernel/platform-quirks.c | 2
> arch/x86/kernel/tsc.c | 96 ++++++++++++++++++++++++++++++--------
> 3 files changed, 85 insertions(+), 24 deletions(-)
>
> --- a/arch/x86/include/asm/tsc.h
> +++ b/arch/x86/include/asm/tsc.h
> @@ -76,10 +76,7 @@ extern void disable_TSC(void);
>
> static inline cycles_t get_cycles(void)
> {
> - if (!IS_ENABLED(CONFIG_X86_TSC) &&
> - !cpu_feature_enabled(X86_FEATURE_TSC))
> - return 0;
> - return rdtsc();
> + return 0;
> }
> #define get_cycles get_cycles
>
So this is probably going to break a bunch of generic stuff. There is a
fair amount of 'get_cycles' usage out in the tree.
Mostly it appears to be various test code.
But I do agree that get_cycles() is terrible and should go away.
next prev parent reply other threads:[~2026-03-30 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <39b09edb-8998-4ebd-a564-7d594434a981@bird.org>
[not found] ` <20260210234741.3262320-1-tim.bird@sony.com>
[not found] ` <87zf3ud92r.ffs@tglx>
[not found] ` <MW5PR13MB5632FC91EE0EF8754331400DFD57A@MW5PR13MB5632.namprd13.prod.outlook.com>
[not found] ` <87jyuvboo2.ffs@tglx>
2026-03-29 22:42 ` [PATCH v3] printk: fix zero-valued printk timestamps in early boot Thomas Gleixner
2026-03-30 12:05 ` Peter Zijlstra [this message]
2026-03-30 13:38 ` David Laight
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=20260330120538.GM3738010@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Tim.Bird@sony.com \
--cc=bonzini@gnu.org \
--cc=francesco@valla.it \
--cc=geert@linux-m68k.org \
--cc=john.ogness@linutronix.de \
--cc=kvm@vger.kernel.org \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=senozhatsky@chromium.org \
--cc=shashankbalaji02@gmail.com \
--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