Re: [PATCH] ring-buffer: Use a housekeeping CPU to wake up waiters

Steven Rostedt
2026-01-07T16:16:49Z

On Wed, 7 Jan 2026 10:51:37 +0100
Petr Tesarik <ptesarik@suse.com> wrote:

> Erm. It's actually good I had a look. :-(
>
> A helpful comment in irq_work_queue_on() explains that "arch remote IPI
> send/receive backend aren't NMI safe". That's something I wasn't aware
> of, and I'm afraid it's the end of story. The comment is followed by a
> WARN_ON_ONCE(in_nmi()), and I can easily trigger it with "perf top"
> while nmi:nmi_handler is traced.
>
> Please, remove the patch again. I'm sorry.

Or we simply change it to:

static inline void
rb_irq_work_queue(struct rb_irq_work *irq_work)
{
int cpu;

/* irq_work_queue_on() is not allowed in NMI context */
if (in_nmi()) {
irq_work_queue(&irq_work->work, cpu);
return;
}

cpu = housekeeping_any_cpu(HK_TYPE_KERNEL_NOISE);
/*
* If CPU isolation is not active, cpu is always the current
* CPU, and the following is equivallent to irq_work_queue().
*/
irq_work_queue_on(&irq_work->work, cpu);
}

-- Steve