On (05/10/18 23:50), Tetsuo Handa wrote:
> What I meant is nothing but something like below (i.e. inject context ID 
> before
> string to print)
> 
>   -sprintf(printk_buf + offset, "[ %s] %s", stamp, string_to_print);
>   +cpu = smp_processor_id()
>   +if (in_nmi())
>   +  sprintf(printk_buf + offset, "[ %s](N%u) %s", stamp, cpu, 
> string_to_print);
>   +else if (in_irq())
>   +  sprintf(printk_buf + offset, "[ %s](I%u) %s", stamp, cpu, 
> string_to_print);
>   +else if (in_serving_softirq())
>   +  sprintf(printk_buf + offset, "[ %s](S%u) %s", stamp, cpu, 
> string_to_print);
>   +else
>   +  sprintf(printk_buf + offset, "[ %s](%u) %s", stamp, current->pid, 
> string_to_print);
> 
> without touching any struct.

So you basically want to have one more con_msg_format_flags? Do
you want to track a context which prints out a messages or the
context which "generated" the message? A CPU/task that stores
a logbuf entry - vprintk_emit() - is not always the same as the
CPU/task that prints it to consoles - console_unlock().

        -ss

Reply via email to