2020-12-04 06:19:27

by Sergey Senozhatsky

[permalink] [raw]
Subject: Re: [PATCH next v2 1/3] printk: inline log_output(),log_store() in vprintk_store()

On (20/12/03 17:31), John Ogness wrote:
[..]
> >> + if (!prb_reserve(&e, prb, &r)) {
> >> + /* truncate the message if it is too long for empty buffer */
> >> + truncate_msg(&text_len, &trunc_msg_len);
> >> +
> >> + prb_rec_init_wr(&r, text_len + trunc_msg_len);
> >> + if (!prb_reserve(&e, prb, &r))
> >> + return 0;
> >> + }
> >> +
> >> + /* fill message */
> >> + memcpy(&r.text_buf[0], text, text_len);
> >> + if (trunc_msg_len)
> >> + memcpy(&r.text_buf[text_len], trunc_msg, trunc_msg_len);
> >> + r.info->text_len = text_len + trunc_msg_len;
> >> + r.info->facility = facility;
> >> + r.info->level = level & 7;
> >> + r.info->flags = lflags & 0x1f;
> >> + r.info->ts_nsec = ts_nsec;
> >
> > This is the only location where ts_nsec is used. I would remove the
> > variable and call:
> >
> > r.info->ts_nsec = local_clock();
>
> My reason for grabbing the clock at the beginning is so that the
> timestamp is as close to the printk() call as possible. IMHO it is a
> more deterministic timestamp than if it is taken after reservation(s)
> and sprint'ing. I prefer to keep it as it is, but will not object if
> such a change is necessary for mailine acceptance.

Sounds reasonable

Reviewed-by: Sergey Senozhatsky <[email protected]>

-ss