Re: [PATCH] printk: Add caller information to printk() output.

From: Sergey Senozhatsky
Date: Mon Dec 03 2018 - 21:02:37 EST


On (12/02/18 20:23), Tetsuo Handa wrote:
>
> Some examples for console output:
>
> [ 0.919699]@T1 x86: Booting SMP configuration:
> [ 4.152681]@T271 Fusion MPT base driver 3.04.20
> [ 5.070470]@C0 random: fast init done
> [ 6.587900]@C3 random: crng init done

This is hard to read. Let's have a fixed width space for from_id.

> +#ifdef CONFIG_PRINTK_FROM
> + if (in_task())
> + msg->from_id = current->pid;

Let's use task_pid_nr().

> -static size_t print_time(u64 ts, char *buf)
> -{
> - unsigned long rem_nsec = do_div(ts, 1000000000);
> -
> - if (!buf)
> - return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
> -
> - return sprintf(buf, "[%5lu.%06lu] ",
> - (unsigned long)ts, rem_nsec / 1000);
> -}

OK, this patch depends on printk_time patch.

> +config PRINTK_FROM
> + bool "Show caller information on printks"
> + depends on PRINTK

Wasn't it supposed to also depend on DEBUG_AID_FOR_SYZBOT?

-ss