All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irq_poll: Use raise_softirq_irqoff() in cpu_dead notifier
@ 2021-09-30 10:37 Sebastian Andrzej Siewior
  2021-09-30 10:56 ` [RFC] Is lib/irq_poll still considered useful? Sebastian Andrzej Siewior
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-09-30 10:37 UTC (permalink / raw)
  To: linux-kernel, linux-scsi
  Cc: Peter Zijlstra, Thomas Gleixner, Christoph Hellwig,
	Greg Kroah-Hartman, Sebastian Andrzej Siewior

__raise_softirq_irqoff() adds a bit to the pending sofirq mask and this
is it. The softirq won't be handled in a deterministic way but randomly
when an interrupt fires and handles softirq in its irq_exit() routine or
if something randomly checks and handles pending softirqs in the call
chain before the CPU goes idle.

Add a local_bh_disable/enable() around the IRQ-off section which will
handle pending softirqs.

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

diff --git a/lib/irq_poll.c b/lib/irq_poll.c
index 2f17b488d58e1..2b9f797642f60 100644
--- a/lib/irq_poll.c
+++ b/lib/irq_poll.c
@@ -191,11 +191,13 @@ static int irq_poll_cpu_dead(unsigned int cpu)
 	 * If a CPU goes away, splice its entries to the current CPU
 	 * and trigger a run of the softirq
 	 */
+	local_bh_disable();
 	local_irq_disable();
 	list_splice_init(&per_cpu(blk_cpu_iopoll, cpu),
 			 this_cpu_ptr(&blk_cpu_iopoll));
 	__raise_softirq_irqoff(IRQ_POLL_SOFTIRQ);
 	local_irq_enable();
+	local_bh_enable();
 
 	return 0;
 }
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] irq_poll: Use raise_softirq_irqoff() in cpu_dead notifier
@ 2020-04-02 19:50 Sebastian Andrzej Siewior
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-04-02 19:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner

__raise_softirq_irqoff() adds a pending sofirq mask and this is it. The
softirq won't be invoked unless something checks for a pending softirq
which should happen once the next interrupt fires. The CPU might go
idle in the meantime.

Use raise_softirq_irqoff() to wake ksoftirqd() if the list has work
items pending.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---

Maybe preempt_check_resched() should be added to act on a possible
need_resched flag. Otherwise it will be delayed to the next
cond_resched() / spin_unlock().

 lib/irq_poll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/irq_poll.c b/lib/irq_poll.c
index 2f17b488d58e1..484dbd2aa09fb 100644
--- a/lib/irq_poll.c
+++ b/lib/irq_poll.c
@@ -194,7 +194,8 @@ static int irq_poll_cpu_dead(unsigned int cpu)
 	local_irq_disable();
 	list_splice_init(&per_cpu(blk_cpu_iopoll, cpu),
 			 this_cpu_ptr(&blk_cpu_iopoll));
-	__raise_softirq_irqoff(IRQ_POLL_SOFTIRQ);
+	if (!list_empty(this_cpu_ptr(&blk_cpu_iopoll)))
+		raise_softirq_irqoff(IRQ_POLL_SOFTIRQ);
 	local_irq_enable();
 
 	return 0;
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-10-18 11:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30 10:37 [PATCH] irq_poll: Use raise_softirq_irqoff() in cpu_dead notifier Sebastian Andrzej Siewior
2021-09-30 10:56 ` [RFC] Is lib/irq_poll still considered useful? Sebastian Andrzej Siewior
2021-10-01  4:24   ` Christoph Hellwig
2021-10-01  6:41     ` Sebastian Andrzej Siewior
2021-10-18  7:45 ` [PATCH] irq_poll: Use raise_softirq_irqoff() in cpu_dead notifier Sebastian Andrzej Siewior
2021-10-18 10:53 ` Christoph Hellwig
2021-10-18 11:49   ` Sebastian Andrzej Siewior
  -- strict thread matches above, loose matches on Subject: below --
2020-04-02 19:50 Sebastian Andrzej Siewior

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.