All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
	Thomas Gleixner <tglx@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] workqueue: Use raise_softirq() in bh_pool_kick_.*()
Date: Wed, 19 Aug 2026 16:19:09 +0200	[thread overview]
Message-ID: <20260819141909.e2ZfmB3y@linutronix.de> (raw)

bh_pool_kick_normal() is used as irq_work callback to schedule softirq
on a remote CPU.
On PREEMPT_RT the default irq_work item is initialized as IRQ_WORK_LAZY
and is invoked in a thread with enabled interrupts (!RT would use
softirq but interrupts would remain enabled). This triggers the warning
in raise_softirq_irqoff() which expects interrupts to off while the
softirq irq mask is modified.

The kick function triggers an IPI and the remote CPU
wakes of irq_work/ and the callback wakes ksoftirqd/.

By initialising the irq_work as IRQ_WORK_INIT_HARD via
| *bh_pool_irq_work(pool) = IRQ_WORK_INIT_HARD(irq_work_fns[i]);
we get the IPI and either (directly) a wake of ksoftirqd or "injected"
the softirq into the current context if it is already in BH-disabled
context which is in general undesired.
Even if ksoftirqd is woken up, the softirq work could be picked up by
random task which decided to do softirqs and then "drains" the pending
queue.

Scheduling a remote BH-work is undesired because of the possible context
stealing. Using raise_softirq() here avoids the warning. As of today I
did not see any users.

Use raise_softirq() in bh_pool_kick_.*() to avoid a warning in
PREEMPT_RT.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/workqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 78068ae8f28a6..0bb978df02005 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -7923,12 +7923,12 @@ static inline void wq_watchdog_init(void) { }
 
 static void bh_pool_kick_normal(struct irq_work *irq_work)
 {
-	raise_softirq_irqoff(TASKLET_SOFTIRQ);
+	raise_softirq(TASKLET_SOFTIRQ);
 }
 
 static void bh_pool_kick_highpri(struct irq_work *irq_work)
 {
-	raise_softirq_irqoff(HI_SOFTIRQ);
+	raise_softirq(HI_SOFTIRQ);
 }
 
 static void __init restrict_unbound_cpumask(const char *name, const struct cpumask *mask)
-- 
2.55.0


             reply	other threads:[~2026-08-19 14:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 14:19 Sebastian Andrzej Siewior [this message]
2026-08-19 14:34 ` [PATCH] workqueue: Use raise_softirq() in bh_pool_kick_.*() Bradley Morgan
2026-08-19 19:29   ` Tejun Heo
2026-08-19 19:36     ` Bradley Morgan
2026-08-19 20:41 ` Tejun Heo

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=20260819141909.e2ZfmB3y@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.