[RFC PATCH 0/2] random: tracing: Expose last boot ID on persistent instance

Masami Hiramatsu (Google) posted 2 patches 3 days, 4 hours ago
drivers/char/random.c  |   27 +++++++++++++++++++++------
include/linux/random.h |    9 +++++++++
kernel/trace/trace.c   |   14 ++++++++++++--
3 files changed, 42 insertions(+), 8 deletions(-)
[RFC PATCH 0/2] random: tracing: Expose last boot ID on persistent instance
Posted by Masami Hiramatsu (Google) 3 days, 4 hours ago
Hi,

Here is an RFC series to expose the boot ID (random UUID for each
boot) in the last_boot_info of the persistent ring buffer instance.

The persistent ring buffer can hold trace data beyond reboot/crashes.
This means the recorded data does not always come from the last boot.
Currently we just assume that the data comes from the last boot.

On the other hand, the kernel provides a random generated UUID for
each boot time, called "boot ID". If you record the logs with the
boot ID, it is easy to do cross-referencing it with other logs.

Similarly, recording the Boot ID for persistent ring buffer
instances would make it easier to determine which boot the read
data came from.

For example:

 # cat /proc/sys/kernel/random/boot_id
 df152e7a-c0a7-4d32-9f0b-7f5c39fb7b68

(enable tracing on persistent instance and reboot)

 # cat /sys/kernel/tracing/instances/ptracingtest/last_boot_info
# boot_id: df152e7a-c0a7-4d32-9f0b-7f5c39fb7b68
ffffffff81000000       [kernel]


Thank you,

---

Masami Hiramatsu (Google) (2):
      random: Expose boot ID to other subsystems
      tracing: Record and show boot ID in last_boot_info


 drivers/char/random.c  |   27 +++++++++++++++++++++------
 include/linux/random.h |    9 +++++++++
 kernel/trace/trace.c   |   14 ++++++++++++--
 3 files changed, 42 insertions(+), 8 deletions(-)

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Re: [RFC PATCH 0/2] random: tracing: Expose last boot ID on persistent instance
Posted by Mathieu Desnoyers 3 days, 4 hours ago
On 2026-05-21 10:56, Masami Hiramatsu (Google) wrote:
> Hi,
> 
> Here is an RFC series to expose the boot ID (random UUID for each
> boot) in the last_boot_info of the persistent ring buffer instance.
> 
> The persistent ring buffer can hold trace data beyond reboot/crashes.
> This means the recorded data does not always come from the last boot.
> Currently we just assume that the data comes from the last boot.
> 
> On the other hand, the kernel provides a random generated UUID for
> each boot time, called "boot ID". If you record the logs with the
> boot ID, it is easy to do cross-referencing it with other logs.
> 
> Similarly, recording the Boot ID for persistent ring buffer
> instances would make it easier to determine which boot the read
> data came from.
> 
> For example:
> 
>   # cat /proc/sys/kernel/random/boot_id
>   df152e7a-c0a7-4d32-9f0b-7f5c39fb7b68
> 
> (enable tracing on persistent instance and reboot)
> 
>   # cat /sys/kernel/tracing/instances/ptracingtest/last_boot_info
> # boot_id: df152e7a-c0a7-4d32-9f0b-7f5c39fb7b68
> ffffffff81000000       [kernel]
> 

FWIW, we've used boot id to uniquely identify traces belonging
to a given kernel execution and allow validation that traces
can indeed be correlated across CPU and across kernel vs userspace
for years in LTTng.

Good to see this approach proposed for Ftrace as well.

Thanks,

Mathieu

> 
> Thank you,
> 
> ---
> 
> Masami Hiramatsu (Google) (2):
>        random: Expose boot ID to other subsystems
>        tracing: Record and show boot ID in last_boot_info
> 
> 
>   drivers/char/random.c  |   27 +++++++++++++++++++++------
>   include/linux/random.h |    9 +++++++++
>   kernel/trace/trace.c   |   14 ++++++++++++--
>   3 files changed, 42 insertions(+), 8 deletions(-)
> 
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com