Messages in this thread Patch in this message | | | Date | Thu, 7 Jul 2022 21:38:20 +0800 | Subject | Re: [RFC PATCH 2/2] arm64: support HAVE_IRQ_EXIT_ON_IRQ_STACK | From | Qi Zheng <> |
| |
On 2022/7/7 20:49, Arnd Bergmann wrote: > On Thu, Jul 7, 2022 at 1:05 PM Qi Zheng <zhengqi.arch@bytedance.com> wrote: >> >> Since softirqs are handled on the per-CPU IRQ stack, >> let's support HAVE_IRQ_EXIT_ON_IRQ_STACK which causes >> the core code to invoke __do_softirq() directly without >> going through do_softirq_own_stack(). >> >> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> > > I think the idea is right, but the extra function pointer adds more complexity > than necessary: > >> static __always_inline void __el1_irq(struct pt_regs *regs, >> void (*handler)(struct pt_regs *)) >> { >> enter_from_kernel_mode(regs); >> >> - irq_enter_rcu(); >> - do_interrupt_handler(regs, handler); >> - irq_exit_rcu(); >> + do_interrupt_handler(regs, handler, irq_handler); >> >> arm64_preempt_schedule_irq(); >> >> @@ -699,9 +711,7 @@ static void noinstr el0_interrupt(struct pt_regs *regs, >> if (regs->pc & BIT(55)) >> arm64_apply_bp_hardening(); >> >> - irq_enter_rcu(); >> - do_interrupt_handler(regs, handler); >> - irq_exit_rcu(); >> + do_interrupt_handler(regs, handler, irq_handler); >> >> exit_to_user_mode(regs); >> } > > Would it be possible to instead pull out the call_on_irq_stack() so these > two functions are instead called on the IRQ stack already?
Hi,
Do you mean to modify call_on_irq_stack()?
I have tried doing a conditional jump inside call_on_irq_stack() like this:
--- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -888,13 +888,22 @@ SYM_FUNC_START(call_on_irq_stack)
/* Move to the new stack and call the function there */ mov sp, x16 - blr x1 + + cmp x2, #1 + b.eq 99f + + blr x1 + b 999f + +99: bl irq_enter_rcu + blr x1 + bl irq_exit_rcu
/* * Restore the SP from the FP, and restore the FP and LR from the frame * record. */ - mov sp, x29 +999: mov sp, x29 ldp x29, x30, [sp], #16 #ifdef CONFIG_SHADOW_CALL_STACK ldp scs_sp, xzr, [sp], #16 But this also requires a new parameter in do_interrupt_handler.
I also considered implementing call_on_irq_stack() for nmi and irq separately, but later think it's unnecessary.
> > Arnd
Thanks, Qi
| |