Re: [PATCH 1/2] printk: Store all three timestamps

From: Sergey Senozhatsky
Date: Wed Sep 23 2020 - 21:45:41 EST


On (20/09/24 00:18), John Ogness wrote:
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index 1560649cbd35..0ed8901916f4 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -520,10 +522,10 @@ static int log_store(u32 caller_id, int facility, int level,
> > r.info->facility = facility;
> > r.info->level = level & 7;
> > r.info->flags = flags & 0x1f;
> > - if (ts_nsec > 0)
> > - r.info->ts_nsec = ts_nsec;
> > + if (ts)
> > + r.info->ts = *ts;
> > else
> > - r.info->ts_nsec = local_clock();
> > + ktime_get_fast_timestamps(&r.info->ts);
>
> I am wondering if we still want to keep the local_clock() as well (and
> as the default). ftrace also uses it by default, which means traces and
> printk logs could be coordinated by default until now.

Good point.

> If we wanted to keep the local clock, should the local clock be a part
> of struct ktime_timestamps? Or should struct printk_info maintain that
> separately (either as @ts_nsec or @ts_local or whatever).

I like the idea of having a dedicated printk_timestamps structure
with the timestamps.

-ss