Re: [PATCH v2] tracing: Record trace_clock and recover when reboot
From: Steven Rostedt
Date: Thu Apr 17 2025 - 10:16:42 EST
On Thu, 17 Apr 2025 14:17:29 +0900
"Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -6004,6 +6004,7 @@ struct trace_mod_entry {
> };
>
> struct trace_scratch {
> + char clock[TRACE_CLOCK_NAME_MAX];
> unsigned long text_addr;
> unsigned long nr_entries;
> struct trace_mod_entry entries[];
> @@ -6114,6 +6115,8 @@ static void update_last_data(struct trace_array *tr)
> if (tr->scratch) {
> struct trace_scratch *tscratch = tr->scratch;
>
> + strscpy(tscratch->clock, trace_clocks[tr->clock_id].name,
Why copy the name and not the clock_id?
The clock ids should not change between kernels.
-- Steve
> + TRACE_CLOCK_NAME_MAX);
> memset(tscratch->entries, 0,
> flex_array_size(tscratch, entries, tscratch->nr_entries));
> tscratch->nr_entries = 0;