Re: [PATCH] ARM: entry: Convert IRQ handling to generic IRQ entry

Linus Walleij <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.ports.arm.kernel
Message-ID <CAD++jLnKzxtW=csmrV=19-_DofVG=aqnM0uiBTWGygTWmeQgvw@mail.gmail.com>
On Sat, Jun 27, 2026 at 5:16 AM Jinjie Ruan <[email protected]> wrote:

> > +noinstr void arm_irq_handler(struct pt_regs *regs, int mode)
> > +{
> > +     irqentry_state_t state = irqentry_enter(regs);
> > +
> > +     /*
> > +      * mode == 1 means we came from userspace, and then we
> > +      * should just immediately switch to the irq stack.
> > +      * Then we check of we are on the thread stack. If we are
> > +      * not, then by definition we are already using the irq stack.
> > +      */
> > +     if (mode == 1 || on_thread_stack())
> > +             call_on_irq_stack(handle_arm_irq, regs);
>
> It seems that the CONFIG_VMAP_STACK Overflow Protection is missing,

I don't think so, it is checked before this point in the assembly:

+       svc_entry trace=0
+       mov     r0, sp                          @ regs
+       mov     r1, #0                          @ from kernel mode
+       bl      arm_irq_handler
(...)

svc_entry checks it.

> should we implement the C version of CONFIG_VMAP_STACK first, before
> moving the IRQ handling to C?"

Not 100% sure what you mean here.

Currently the CONFIG_VMAP_STACK checks are done in
arch/arm/kernel/entry-armv.S, in the svc_entry macro
that is called in every exception entry.

svc_entry in turn calls do_overflow_check from
arch/arm/kernel/entry-header.S that does the actual overflow
check and calls __bad_stack() if we get an overflow.

This looks nice to have in assembly to me, and even
arm64 does this check in assembly?

How do you imagine C doing this without using any stack?

Yours,
Linus Walleij
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.