Re: [PATCH 2/5] irq_work: Ensure that irq_work runs in in-IRQ context.
From: Sebastian Andrzej Siewior
Date: Tue Oct 05 2021 - 11:48:33 EST
On 2021-09-27 23:19:16 [+0200], To linux-kernel@xxxxxxxxxxxxxxx wrote:
> The irq-work callback should be invoked in hardirq context and some
> callbacks rely on this behaviour. At the time irq_work_run_list()
> interrupts should be disabled but the important part is that the
> callback is invoked from a in-IRQ context.
> The "disabled interrupts" check can be satisfied by disabling interrupts
> from a kworker which is not the intended context.
>
> Ensure that the callback is invoked from hardirq context and not just
> with disabled interrupts.
As noted by lkp, this triggers from smpcfd_dying_cpu().
Do we care enough to change this or should I rather drop this one?
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> kernel/irq_work.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/irq_work.c b/kernel/irq_work.c
> index db8c248ebc8c8..caf2edffa20d5 100644
> --- a/kernel/irq_work.c
> +++ b/kernel/irq_work.c
> @@ -167,7 +167,7 @@ static void irq_work_run_list(struct llist_head *list)
> struct irq_work *work, *tmp;
> struct llist_node *llnode;
>
> - BUG_ON(!irqs_disabled());
> + BUG_ON(!in_hardirq());
>
> if (llist_empty(list))
> return;
Sebastian