public inbox for linux-embedded@vger.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: "Bird, Tim" <Tim.Bird@sony.com>,
	Michael Kelley <mhklinux@outlook.com>,
	Petr Mladek <pmladek@suse.com>,
	Shashank Balaji <shashankbalaji02@gmail.com>
Cc: "rostedt@goodmis.org" <rostedt@goodmis.org>,
	"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
	"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>,
	Thomas Gleixner <tglx@kernel.org>,
	John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>
Subject: RE: [PATCH v3] printk: fix zero-valued printk timestamps in early boot
Date: Thu, 26 Mar 2026 10:30:56 +0106	[thread overview]
Message-ID: <87fr5nx7rr.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <MW5PR13MB56324CC9F20373A19325061CFD48A@MW5PR13MB5632.namprd13.prod.outlook.com>

Hi Tim,

On 2026-03-24, "Bird, Tim" <Tim.Bird@sony.com> wrote:
> Yeah - I was worried about other timestamps not being in synchronization
> with my adjusted printk timestamps.  Looks like that worry was justified.
>
> At this point, there are two avenues:
>
>  1) double-down and embed the offset (from power-on rather than from time_init)
>     all the way into local_clock() and/or whatever is providing CLOCK_MONOTONIC
>     and CLOCK_BOOTTIME, or
>
>  2) back off, and abandon adding the offset to local_clock()-based printk timestamps.
>     This would leave a discontinuity when EARLY_PRINTK_TIMES was enabled,
>     between the (now) non-zero early printk timestamps and the ones following
>     time_init().  This has the benefit of changing less code, and only affecting
>     the early printk timestamps (and none of the rest of the system).  And it has
>     the downside of leaving the possibly confusing time discontinuity
>     early in the kernel log.  So far, I haven't seen any tools confused by this, and
>     I can put a message before time_init() to inform humans about the switch.
>
> The purpose of this patch is really focused on that early period of boot, where all
> other timing and tracing mechanisms are unavailable, and limiting the impact to
> just those early (currently zero) timestamps seems like the best course.

I have always felt that printk timestamping should be using a
userspace-accessible clock, such as CLOCK_MONOTONIC, rather than the CPU
local clock. This simplifies applications coordinating their own logs
with raw kernel logs.

I was wondering if your pre-boot timing could be used as the init values
for CLOCK_MONOTONIC, so that CLOCK_MONOTONIC is a clean continuation of
your pre-boot clocking.

And then we could use this opportunity to switch printk to
CLOCK_MONOTONIC.

This might also make sense if initializing CLOCK_MONOTONIC is somehow
more straight forward that tracking an extra CPU local clock diff.

John Ogness

  reply	other threads:[~2026-03-26  9:24 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  5:30 [PATCH] printk: add early_counter_ns routine for printk blind spot Tim Bird
2025-11-25  7:52 ` kernel test robot
2025-11-25 13:08 ` Francesco Valla
2025-11-26  7:38   ` Geert Uytterhoeven
2025-11-27  0:16     ` Bird, Tim
2025-11-27 16:16       ` Petr Mladek
2025-11-26 12:55   ` Petr Mladek
2025-11-27  0:03     ` Bird, Tim
2025-11-26 11:13 ` Petr Mladek
2025-11-27  9:13 ` kernel test robot
2026-01-24 19:40 ` [PATCH v2] printk: fix zero-valued printk timestamps in early boot Tim Bird
2026-01-25 14:41   ` Francesco Valla
2026-01-26 16:52     ` Bird, Tim
2026-02-02 16:23       ` Petr Mladek
2026-01-26 10:12   ` Geert Uytterhoeven
2026-01-26 17:11     ` Bird, Tim
2026-01-27  8:10       ` Geert Uytterhoeven
2026-02-10 23:47 ` [PATCH v3] " Tim Bird
2026-03-04 11:23   ` Petr Mladek
2026-03-09 17:27   ` Shashank Balaji
2026-03-10 10:43     ` Petr Mladek
2026-03-10 19:17     ` Bird, Tim
2026-03-09 19:25   ` Shashank Balaji
2026-03-10 11:39     ` Petr Mladek
2026-03-10 18:54       ` Bird, Tim
2026-03-11 15:45         ` Petr Mladek
2026-03-11 15:47   ` Michael Kelley
2026-03-13  4:52     ` Bird, Tim
2026-03-13 10:45       ` Petr Mladek
2026-03-14 14:16         ` Shashank Balaji
2026-03-24 20:07           ` Bird, Tim
2026-03-14 16:15         ` Michael Kelley
2026-03-24 19:47           ` Bird, Tim
2026-03-26  9:24             ` John Ogness [this message]
2026-03-27 18:04               ` Bird, Tim
2026-03-20 18:15         ` Bird, Tim
2026-03-28 15:56         ` Thomas Gleixner
2026-03-26 13:17   ` Thomas Gleixner
2026-03-27 18:48     ` Bird, Tim
2026-03-28 21:59       ` Thomas Gleixner
2026-03-29 22:42         ` Thomas Gleixner
2026-03-30 12:05           ` Peter Zijlstra
2026-03-30 13:38           ` David Laight
2026-04-07 20:34           ` Earlier tsc init patch (was RE: [PATCH v3] printk: fix zero-valued printk timestamps in early boot) Bird, Tim
2026-03-30 20:42         ` [PATCH v3] printk: fix zero-valued printk timestamps in early boot Bird, Tim
2026-03-31  8:17           ` Geert Uytterhoeven
2026-03-31  9:10           ` Thomas Gleixner
2026-03-31 23:36             ` Thomas Gleixner
2026-04-01  0:05               ` Steven Rostedt
2026-04-01  7:36                 ` Geert Uytterhoeven
2026-04-01  8:33                 ` Thomas Gleixner
2026-04-01 15:12                   ` Steven Rostedt
2026-04-01 19:37                     ` Thomas Gleixner
2026-04-01  1:16               ` Brian Masney
2026-04-01  9:19                 ` Thomas Gleixner

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=87fr5nx7rr.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=Tim.Bird@sony.com \
    --cc=francesco@valla.it \
    --cc=geert@linux-m68k.org \
    --cc=jstultz@google.com \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sboyd@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=shashankbalaji02@gmail.com \
    --cc=tglx@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