public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	John Ogness <john.ogness@linutronix.de>
Cc: Changki Kim <changki.kim@samsung.com>,
	pmladek@suse.com, sergey.senozhatsky@gmail.com,
	rostedt@goodmis.org, changbin.du@intel.com, masahiroy@kernel.org,
	rd.dunlap@gmail.com, krzk@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: printk: Add process name information to printk() output.
Date: Fri, 04 Sep 2020 12:27:23 -0700	[thread overview]
Message-ID: <897438bf3fbbd38ee92e964ce5b9d1dc2bccd2ec.camel@perches.com> (raw)
In-Reply-To: <20200904103541.GB2693206@kroah.com>

On Fri, 2020-09-04 at 12:35 +0200, Greg KH wrote:
> On Fri, Sep 04, 2020 at 11:53:42AM +0206, John Ogness wrote:
> > On 2020-09-04, Changki Kim <changki.kim@samsung.com> wrote:
> > > Printk() meesages are the most basic and useful debug method.
> > > However, additional information needs in multi-processor.
> > > If we add messages with processor id and process name, we can find
> > > a problem only with messages when the problem occurs with H/W IP or CPU.
> > > This is very useful in narrowing down the scope of the problems.
> > 
> > [...]
> > 
> > > diff --git a/kernel/printk/printk_ringbuffer.h b/kernel/printk/printk_ringbuffer.h
> > > index e6302da041f9..fcefe9516606 100644
> > > --- a/kernel/printk/printk_ringbuffer.h
> > > +++ b/kernel/printk/printk_ringbuffer.h
> > > @@ -21,6 +22,12 @@ struct printk_info {
> > >  	u8	flags:5;	/* internal record flags */
> > >  	u8	level:3;	/* syslog level */
> > >  	u32	caller_id;	/* thread id or processor id */
> > > +#ifdef CONFIG_PRINTK_PROCESS
> > > +	int	pid;			/* process id */
> > > +	u8	cpu_id;			/* processor id */
> > > +	u8	in_interrupt;		/* interrupt conext */
> > > +	char process[TASK_COMM_LEN];	/* process name */
> > > +#endif
> > >  };
> > 
> > I can understand the desire to have more information with messages. But
> > IMHO adding it to the ringbuffer descriptor is the wrong place for
> > it. The descriptor should really be limited to data that the printk
> > subsystem needs for _itself_. With respect to LOG_CONT, I think we can
> > agree that @caller_id is not enough. But there has been discussions [0]
> > of having @caller_id provide a better context representation.
> > 
> > If we want to support adding more meta information to messages, I would
> > prefer that the information is either prepended directly to the message
> > text string or appended to the dictionary text string. We could even go
> > so far as providing a boot argument where a list of information could be
> > specified, what should be automatically added to the text/dict strings
> > of each message. That would not require any ringbuffer changes and would
> > allow new types of information to be added later.
> > 
> > Something like:
> > 
> >     printk.format=ts,cpu,comm,pid,in_atomic
> > 
> > John Ogness
> > 
> > [0] https://lkml.kernel.org/r/20200719143527.GA566@jagdpanzerIV.localdomain
> 
> Ah, finally a good use of the "dictionary" that we all can agree makes
> sense :)
> 
> This does seem like a better solution overall, thanks.

__func__ too please so that it could optionally be enabled per
subsystem using %pS, __builtin_return_address(<appropriate_level>)

That way a lot of %s:..., __func__ could be removed from
specific printk instances.




  reply	other threads:[~2020-09-04 19:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200904082449epcas2p4420d5df2083325b328a182c79f5c0948@epcas2p4.samsung.com>
2020-09-04  8:24 ` printk: Add process name information to printk() output Changki Kim
2020-09-04  9:05   ` Greg KH
2020-09-04  9:31     ` 김창기
2020-09-04 10:34       ` 'Greg KH'
2020-09-07  1:48         ` 김창기
2020-09-04  9:47   ` John Ogness
2020-09-04 10:35     ` Greg KH
2020-09-04 19:27       ` Joe Perches [this message]
2020-09-04 12:45     ` Petr Mladek
2020-09-04 13:17       ` John Ogness
2020-09-04 15:13         ` Petr Mladek
2020-09-04 23:27           ` John Ogness
2020-09-07  9:28             ` 김창기
2020-09-07  9:54             ` Petr Mladek
2020-09-07 10:30               ` John Ogness
2020-09-07 15:47                 ` Petr Mladek
2020-09-11  9:50       ` [POC] printk: Convert dict ring into array Petr Mladek
2020-09-11 10:32         ` Petr Mladek
2020-09-11 11:09           ` John Ogness

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=897438bf3fbbd38ee92e964ce5b9d1dc2bccd2ec.camel@perches.com \
    --to=joe@perches.com \
    --cc=changbin.du@intel.com \
    --cc=changki.kim@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rd.dunlap@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox