mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Lin Junzhe <m18667909625@163.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: fold consecutive duplicate messages
Date: Wed, 23 Sep 2026 11:43:36 +0200	[thread overview]
Message-ID: <arOfSJT-xRcAb-T1@pathway.suse.cz> (raw)
In-Reply-To: <87ik3yssy0.fsf@jogness.linutronix.de>

On Mon 2026-09-21 14:19:43, John Ogness wrote:
> Hi Lin,
> 
> On 2026-09-21, Lin Junzhe <m18667909625@163.com> wrote:
> > Real cases I have seen in the field and in bug reports:
> >
> > 1. GPU faults (nouveau): a misbehaving userspace program or a dying
> >    GPU can trigger a stream of identical fault reports from the
> >    in-tree nouveau driver, e.g. repeated "fifo: fault at ..." lines
> >    while the offending context keeps being rescheduled. Similar
> >    spam exists for other GPU drivers when a fence or scheduler
> >    loop misbehaves.
> 
> There are several such "fault at" messages. However, the ones I looked
> at have other printk messages following in the same context, so your
> patch would not even help in these cases.
> 
> Please specify the exact message (file + line number) you are talking
> about. Perhaps it would be enough to change it to use a printk
> ratelimited variant.
> 
> > 2. Failing storage: a dying SATA disk produces endless identical
> >    "ata1.00: failed command" / "ata1: SError" storms. This is a
> >    classic dmesg flood that buries everything else on machines
> >    with a serial console and no syslogd.
> 
> The "failed command" ata printk is also followed by further printk's, so
> your patch would not help.
> 
> Please specify the exact message you are concerned about.
> 
> > 3. USB reset loops: a flaky cable or port makes the USB stack
> >    repeatedly print the identical "usb X-Y: reset <speed> USB
> >    device number N using <hcd>" line, sometimes for minutes.
> 
> I could not find this pattern. Please specify the exact message.
> 
> > 4. IRQ storms: an unhandled level-triggered interrupt prints the
> >    identical "irq N: nobody cared" report for every retrigger
> >    until the IRQ is disabled.
> 
> This message also follows with more messages, so your patch would not
> help.
> 
> >> printk is NMI safe and lockless. It needs to remain so.
> >
> > Fully agreed, and thank you for the clear statement. My
> > implementation takes a raw spinlock in vprintk_emit(), which
> > violates exactly that invariant -- the in_nmi() guard only avoids
> > the deadlock by disabling the feature where it would be most
> > dangerous, which is not acceptable either.
> >
> > Given this, I see two options:
> >
> > a) I drop the patch entirely; or
> >
> > b) I rework the idea as lockless per-CPU/per-console state at the
> >    console output layer (or on top of nbcon), so the printk
> >    fast path stays lock- and NMI-safe.
> >
> > Please tell me whether (b) is worth exploring or whether the
> > consensus is that deduplication belongs in userspace and (a) is
> > the right outcome. Either way is fine with me.
> 
> I am against a patch that drops messages just because a format string
> repeats. The _data_ is not the same and that is important (particularly
> with your GPU and SATA examples).
> 
> I am also skeptical that these are real-world issues as all of your
> examples (that I could find) had different printk messages following,
> which would lead to no drops.
> 
> There is also the ratelimited variant of printk. If there are indeed
> messages that are not useful and can flood the kernel log, perhaps those
> messages should be either removed or ratelimited.
> 
> If such a feature were to exist, I would prefer it is implemented such
> that:
> 
> 1. A duplicate message means contents are identical (except for the
> timestamp of course).
> 
> 2. It is implemented using flows similar to LOG_CONT to be certain that
> the message being dropped is really the next message.
> 
> 3. Records could be extended to include a counter for how often they
> repeat (so that deferred consoles can print the "repeated" line).
> 
> Honestly, I do not see a real value for this feature. In my experience,
> even if a console is being flooded with messages, I still want all those
> messages. If a console is unable to keep up with the flood of incoming
> records, I need to use a faster console and/or reduce my console
> loglevel. And if there really are printk messages that can flood the
> kernel log and are useless when repeated output, they should be make to
> use the once or ratelimited variants.

I have nothing more to say. I fully agree with John here.

Best Regards,
Petr

  parent reply	other threads:[~2026-09-23  9:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  5:03 林濬哲
2026-09-21  7:52 ` John Ogness
2026-09-21 10:30   ` Lin Junzhe
2026-09-21 12:13     ` John Ogness
2026-09-21 14:40       ` Lin Junzhe
2026-09-23  9:43       ` Petr Mladek [this message]
2026-09-23 20:59 ` kernel test robot
2026-09-23 21:34 ` kernel test robot
2026-09-25 12:22 ` kernel test robot

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=arOfSJT-xRcAb-T1@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m18667909625@163.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /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®