Re: [PATCH REPOST] irq_poll: Add local_bh_disable() in cpu_dead notifier

From: Sebastian Andrzej Siewior
Date: Thu Feb 10 2022 - 07:33:46 EST


On 2022-02-08 23:56:34 [-0800], Christoph Hellwig wrote:
> On Tue, Feb 08, 2022 at 03:34:05PM +0100, Sebastian Andrzej Siewior wrote:
> > __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 the 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.
>
> And I still haven't seen any good explanation of why this is useful.

You need to handle the pending softirqs. If you don't handle them
immediately or in a deterministic say (like on IRQ exit) then they will
be handled at a random point. If you don't handle them at all, the CPU
will go idle and at least the NO_HZ will complain about pending softirqs
(can_stop_idle_tick()).

You could still argue that the CPU will go down and the there are
latencies involved but…
I want to avoid waking ksoftirqd for that since there is no need to wake
it and the pending work can be done in-context, right away.

Sebastian