mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH v2] printk: Use two irq_works instead per-CPU
Date: Tue, 22 Sep 2026 11:29:54 +0200	[thread overview]
Message-ID: <arJKkvOTNs2DD9ba@pathway.suse.cz> (raw)
In-Reply-To: <20260922070834.2kmMtN82@linutronix.de>

On Tue 2026-09-22 09:08:34, Sebastian Andrzej Siewior wrote:
> On 2026-09-14 16:34:12 [+0200], To linux-kernel@vger.kernel.org wrote:
> > In commit b845b517b5e37 ("printk: robustify printk") initially got its
> > delayed wake up which is today implemented via the irq_work. Back then
> > it was a variable which was assigned to 1 if a pending wake up was
> > waiting. This variable was checked on each timer tick. Therefore it
> > makes sense to assign a per-CPU variable with this task to avoid cache
> > line bouncing when each CPU reads the variable on each timer tick
> > simultaneously.
> 
> Sashiko complains here, https://sashiko.dev/#/patchset/20260914143412.1sMcp89V%40linutronix.de
> 
> | Does replacing the per-CPU irq_work items with global items introduce a
> | system-wide starvation vulnerability on PREEMPT_RT?
> | On PREEMPT_RT, IRQ_WORK_LAZY items are processed by a per-CPU irq_work thread
> | running at a low SCHED_FIFO priority.
> | If one CPU queues pending_wakeup_work or pending_output_work, the item is
> | added to its local lazy_list and marked as pending. If that CPU runs a
> | higher priority RT task for an extended period, the irq_work thread is starved.
> | Since the irq_work structs are now global, their IRQ_WORK_PENDING flag remains
> | set during this time. Any subsequent calls to irq_work_queue() on other CPUs
> | will fail to queue the work and drop the wakeup requests.
> | Could an RT workload on a single CPU starve the global printk/klogd mechanisms
> | for the entire system, degrading the isolation provided by the previous per-CPU
> | design?
> 
> while this is true, it is not limited to printk but any workload would
> starve in such a scenario. Also, for the per-CPU variant to make a
> difference, one would need to have a printk output on another CPU, which
> is not busy with long running RT tasks.
> Long term this is probably the "legacy" system as console drivers should
> transform into nbcon interface. Here this irq-work would be reduced the
> userland wake up while the printing would happen via the nbcon thread
> which also has a single irq_work queue.
> 
> I don't see a problem with this.

I agree with your explanation. I do not see this as a problem either.

Best Regards,
Petr

  reply	other threads:[~2026-09-22  9:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 14:34 Sebastian Andrzej Siewior
2026-09-22  7:08 ` Sebastian Andrzej Siewior
2026-09-22  9:29   ` Petr Mladek [this message]
2026-09-22 13:18     ` John Ogness
2026-09-22 10:02 ` Petr Mladek
2026-09-22 10:06   ` Sebastian Andrzej Siewior
2026-09-22 17:35 ` John Ogness
2026-09-23  7:55   ` Sebastian Andrzej Siewior
2026-09-23 12:16     ` Petr Mladek

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=arJKkvOTNs2DD9ba@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=bigeasy@linutronix.de \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --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®