workqueue: Use raise_softirq() to trigger softirq in irq_work handler
PATCH 1/1 workqueue: Use raise_softirq() to trigger softirq in irq_work handler
The bh_pool_kick_normal() and bh_pool_kick_highpri() are registered via init_irq_work() without IRQ_WORK_HARD_IRQ flag. On PREEMPT_RT, such work items are processed by the per-CPU irq_workd kthread in preemptible task context with IRQs enabled. However calling raise_softirq_irqoff() requires IRQS must be disabled, This commit therefore replace raise_softirq_irqoff() with raise_softirq() in irq_work handler.
--- kernel/workqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/workqueue.c +2 -2
@@ -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)
Signature · 1 line
2.17.1
Quoted 6 lines
The
bh_pool_kick_normal()andbh_pool_kick_highpri()are registered viainit_irq_work()withoutIRQ_WORK_HARD_IRQflag. OnPREEMPT_RT, such work items are processed by the per-CPUirq_workdkthread in preemptible task context with IRQs enabled. However callingraise_softirq_irqoff()requires IRQS must be disabled, This commit therefore replaceraise_softirq_irqoff()withraise_softirq()inirq_workhandler.
Hi zhang!
Could you add
?
Also, if you would like this to go to stable, could you write a small part of the description about the user-space effects and why this is bad?
After all changes.
Quoted 26 lines
Signed-off-by Zqiang <[email protected]>--- kernel/workqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/workqueue.c +2
-2@@ -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)Signature · 1 line
2.17.1
Thanks!
Hello,
Applied to wq/for-7.1-fixes with the description reworded and the following tags added:
The Fixes target differs from the suggested 4cb1ef64609f. There, the raises ran under pool->lock with IRQs disabled. The irq_work handlers were added later by 2f34d7337d98 which moved the remote-CPU raise out of kick_pool(). Also picked up Bradley's Reviewed-by.
Thanks.
Signature · 1 line
tejun
Quoted 13 lines
Quoted 9 lines
The
bh_pool_kick_normal()andbh_pool_kick_highpri()are registered via
init_irq_work()withoutIRQ_WORK_HARD_IRQflag. OnPREEMPT_RT, such work items are processed by the per-CPUirq_workdkthread in preemptible task context with IRQs enabled. However callingraise_softirq_irqoff()requires IRQS must be disabled, This commit therefore replaceraise_softirq_irqoff()withraise_softirq()inirq_workhandler.Hi zhang!
Could you add
Quoted 7 lines
Fixes 4cb1ef64609f ("workqueue: Implement BH workqueues to eventually replace tasklets")?
Also, if you would like this to go to stable, could you write a small part of the description about the user-space effects and why this is bad?
The or_softirq_pending(nr) be translated into the following three assembly instructions(arm64 platform):
ldr w0, [x18, #softirq_pending_offset]
by interrupt:
calling __raise_softirq_irqoff(NET_RX_SOFTIRQ)
orr w0, w0, 1<< nr
str w0, [x18, #softirq_pending_offset] <-- still use old value, the NET_RX_SOFTIRQ maybe lose.
Thanks
Zqiang
Quoted 35 lines
After all changes.
Reviewed-by Bradley Morgan <[email protected]>Quoted 24 lines
Signed-off-by Zqiang <[email protected]>---
kernel/workqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff --git
a/kernel/workqueue.cb/kernel/workqueue.c
index78068ae8f28a..0bb978df0200100644
---a/kernel/workqueue.c
+++b/kernel/workqueue.c
@@ -7923,12 +7923,12 @@ static inline voidwq_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);
}Quoted 4 lines
static void
__initrestrict_unbound_cpumask(const char *name, const struct cpumask *mask)--
2.17.1Thanks!
Quoted 6 lines
Hello,
Applied to wq/for-7.1-fixes with the description reworded and the following tags added:
Quoted 7 lines
Fixes 2f34d7337d98 ("workqueue: Fix queue_work_on() with BH workqueues")Cc [email protected] # v6.9+The Fixes target differs from the suggested
4cb1ef64609f. There, the raises ran underpool->lockwith IRQs disabled. Theirq_workhandlers were added later by2f34d7337d98which moved the remote-CPU raise out ofkick_pool(). Also picked up Bradley's Reviewed-by.
Hello, Tejun
Thank you very much for reword description!
Quoted 6 lines
Thanks.
Signature · 1 line
tejun