Re: [PATCH net-next v2] declance: Remove IRQF_ONESHOT

Sebastian Andrzej Siewior
2026-05-05T07:30:00Z

On 2026-05-04 23:35:42 [+0100], Maciej W. Rozycki wrote:
> On Sun, 29 Mar 2026, Maciej W. Rozycki wrote:
>
> > I've now got back to it and while preparing the justification for the
> > removal of the IRQF_ONESHOT recommendation and having looked through
> > Documentation/core-api/real-time/differences.rst I became stumped and
> > need a further clarification after all.
> >
> > I read in the document that:
> >
> > "However, on a PREEMPT_RT system, interrupts are forced-threaded and no
> > longer run in hard IRQ context."
> >
> > and:
> >
> > "All interrupts are forced-threaded in a PREEMPT_RT system. The exceptions
> > are interrupts that are requested with the IRQF_NO_THREAD, IRQF_PERCPU, or
> > IRQF_ONESHOT flags."
> >
> > -- do I infer correctly that on a PREEMPT_RT system in the absence of any
> > flags passed to request_irq() the handler requested such as one concerned
> > here (i.e. lance_dma_merr_int()) will run with interrupts locally enabled
> > on the CPU?
>
> No reply, but I've gone through irq_setup_forced_threading() now and my
> inference was indeed correct, and the handler does need to be installed
> with IRQF_NO_THREAD. I'll send corrective patches shortly.

Sorry. I missed that previous email.
IRQF_NO_THREAD will not force-thread the interrupt handler so it will
run with interrupts disabled.

With force-threading enabled, the interrupt handler is masked in the
IRQ-chip until after the threaded-handler run. See the cond_unmask_irq()
in handle_level_irq() or the mask_irq() & cond_unmask_eoi_irq() in
handle_fasteoi_ack_irq(). That means the hw-IRQ is done, the thread is
running with interrupts enabled but the hw-IRQ will not trigger again.
The cited commit 5a4a4ad851dd8 ("MIPS: Mark cascade and low level
interrupts IRQF_NO_THREAD") is different as it acts on cascading
interrupts which is not what we have here.

If you request a threaded interrupt you must either provide two handler
and the primary must mask the interrupt so it does not fire again or you
pass a flag such as IRQF_ONESHOT and which point the IRQ subsystem will
mask the IRQ within the irqchip so it does not fire again.

> Maciej

Sebastian