From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: "Ahmed S. Darwish" <a.darwish@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Prarit Bhargava <prarit@redhat.com>,
Mark Salyzyn <salyzyn@android.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Orson Zhai <orsonzhai@gmail.com>,
Changki Kim <changki.kim@samsung.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC 2/2] printk: Add more information about the printk caller
Date: Fri, 25 Sep 2020 12:20:47 +0200 [thread overview]
Message-ID: <20200925102047.GO29288@alley> (raw)
In-Reply-To: <20200925005400.GD541@jagdpanzerIV.localdomain>
On Fri 2020-09-25 09:54:00, Sergey Senozhatsky wrote:
> On (20/09/24 15:38), Petr Mladek wrote:
> [..]
> >
> > Grrrr, I wonder why I thought that in_irq() covered also the situation
> > when IRQ was disabled. It was likely my wish because disabled
> > interrupts are problem for printk() because the console might
> > cause a softlockup.
>
> preempt_disable() can also trigger softlockup.
>
> > in_irq() actually behaves like in_serving_softirq().
> >
> > I am confused and puzzled now. I wonder what contexts are actually
> > interesting for developers. It goes back to the ideas from Sergey
> > about preemption disabled, ...
>
> Are we talking about context tracking for LOG_CONT or context on
> the serial console and /dev/kmsg?
OK, it is clear that LOG_CONT need to know when a different code
is called suddenly. I mean task code vs. an interrupt handler.
But it was actually also the original purpose of the caller_id.
AFAIK, people wanted to sort related messages when they were mixed
with ones from other CPUs.
> If the latter, then my 5 cents, is that something like preemptible(),
> which checks
>
> (preempt_count() == 0 && !irqs_disabled())
>
> does not look completely unreasonable.
>
> We had a rather OK context tracking in printk() before, but for a
> completely different purpose:
>
> console_may_schedule = !oops_in_progress &&
> preemptible() &&
> !rcu_preempt_depth();
>
> We know that printk() can cause RCU stalls [0]. Tracking this part
> of the context state is sort of meaningful.
>
> Let's look at this from this POV - why do we add in_irq()/etc tracking
> info? Perhaps because we want to connect the dots between printk() caller
> state and watchdog reports. Do we cover all watchdogs? No, I don't think
> so. RCU stalls, local_irq_disable(), preempt_disable() are not covered.
I agree that it would be handy to see this context as well. It might
make it easier when hunting down various lockups and stall. But
I have some concerns.
First, the information is not always reliable (PREEMPT_NONE). I wonder
if it might cause more harm than good. People might get confused
or they might want to fix it by some crazy printk code.
Second, the information might not be detailed enough. Many lockups
depends on the fact that a particular lock is held. Backtraces
are likely more important. Or people would need to distinguish
many contexts. It would require another complex code.
I am not sure that this is woth it. After all, it might be enough
to distinguish the 4 basic contexts just to allow sorting mixed
messages.
Best Regards,
Petr
next prev parent reply other threads:[~2020-09-25 10:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 13:56 [RFC 0/2] printk: Add more metadata for each record Petr Mladek
2020-09-23 13:56 ` [PATCH 1/2] printk: Store all three timestamps Petr Mladek
2020-09-23 22:12 ` John Ogness
2020-09-24 1:45 ` Sergey Senozhatsky
2020-09-24 11:49 ` Petr Mladek
[not found] ` <CAJ-C09hqwOJhSXx1h40q96xhNZFXxP6dUVfjUQZpO4ZhOMZLbQ@mail.gmail.com>
2020-09-25 9:51 ` Petr Mladek
2020-09-24 0:00 ` John Ogness
2020-09-24 10:37 ` Petr Mladek
2020-09-23 13:56 ` [RFC 2/2] printk: Add more information about the printk caller Petr Mladek
2020-09-24 1:40 ` Sergey Senozhatsky
2020-09-24 11:58 ` Petr Mladek
2020-09-24 2:17 ` Sergey Senozhatsky
2020-09-24 8:23 ` John Ogness
2020-09-24 13:26 ` Petr Mladek
2020-09-24 13:06 ` Petr Mladek
2020-09-24 4:24 ` Ahmed S. Darwish
2020-09-24 12:53 ` Petr Mladek
2020-09-24 13:38 ` Petr Mladek
2020-09-25 0:54 ` Sergey Senozhatsky
2020-09-25 10:20 ` Petr Mladek [this message]
2020-10-21 11:48 ` 김창기
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=20200925102047.GO29288@alley \
--to=pmladek@suse.com \
--cc=a.darwish@linutronix.de \
--cc=changki.kim@samsung.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=prarit@redhat.com \
--cc=rostedt@goodmis.org \
--cc=salyzyn@android.com \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=zhang.lyra@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
all inboxes | Powered by JetHome®