powerpc: handle simultanneous interrupts at once
RFC 1/1 powerpc: handle simultanneous interrupts at once
It often happens to have simultanneous interrupts, for instance when having double Ethernet attachment. With the current implementation, we suffer the cost of kernel entry/exit for each interrupt.
This patch introduces a loop in __do_irq() to handle all interrupts at once before returning.
--- arch/powerpc/include/asm/hw_irq.h | 6 ++++++ arch/powerpc/kernel/irq.c | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/hw_irq.h +6 -0
@@ -123,6 +123,11 @@ static inline void may_hard_irq_enable(void)__hard_irq_enable (); } +static inline void may_hard_irq_disable (void ) +{ +__hard_irq_disable (); +} +static inline bool arch_irq_disabled_regs (struct pt_regs *regs) {return !regs->softe;
@@ -204,6 +209,7 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs) }static inline void may_hard_irq_enable (void ) { } +static inline void may_hard_irq_disable (void ) { }#endif /* CONFIG_PPC64 */
arch/powerpc/kernel/irq.c +15 -7
@@ -515,14 +515,22 @@ void __do_irq(struct pt_regs *regs)*/ irq = ppc_md.get_irq (); -/* We can hard enable interrupts now to allow perf interrupts */ -may_hard_irq_enable (); +do { +/* We can hard enable interrupts now to allow perf interrupts */ +may_hard_irq_enable (); + +/* And finally process it */ +if (unlikely (!irq)) +__this_cpu_inc (irq_stat.spurious_irqs); +else +generic_handle_irq (irq); + +may_hard_irq_disable (); -/* And finally process it */ -if (unlikely (!irq)) -__this_cpu_inc (irq_stat.spurious_irqs); -else -generic_handle_irq (irq); + irq = ppc_md.get_irq (); + }while (irq); + +may_hard_irq_enable ();trace_irq_exit (regs);
Signature · 1 line
2.12.0
Quoted 54 lines · Christophe Leroy
It often happens to have simultanneous interrupts, for instance when having double Ethernet attachment. With the current implementation, we suffer the cost of kernel entry/exit for each interrupt.
This patch introduces a loop in
__do_irq()to handle all interrupts at once before returning.Signed-off-by Christophe Leroy <[email protected]>---
arch/powerpc/include/asm/hw_irq.h | 6 ++++++ arch/powerpc/kernel/irq.c | 22 +++++++++++++++-------2 files changed, 21 insertions(+), 7 deletions(-)arch/powerpc/include/asm/hw_irq.h +0
-0@@ -123,6 +123,11 @@ static inline void may_hard_irq_enable(void) __hard_irq_enable(); }arch/powerpc/include/asm/hw_irq.h +5
-0+static inline void may_hard_irq_disable (void ) +{ +__hard_irq_disable (); +} +static inline bool
arch_irq_disabled_regs(struct pt_regs *regs){
return !regs->softe;arch/powerpc/include/asm/hw_irq.h +0
-0@@ -204,6 +209,7 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs) }
static inline voidmay_hard_irq_enable(void){ } +static inline voidmay_hard_irq_disable(void){ }
#endif /*CONFIG_PPC64*/arch/powerpc/kernel/irq.c +0
-0@@ -515,14 +515,22 @@ void __do_irq(struct pt_regs *regs)*/ irq = ppc_md.get_irq();arch/powerpc/kernel/irq.c +0
-1-/* We can hard enable interrupts now to allow perf interrupts */
arch/powerpc/kernel/irq.c +2
-1-may_hard_irq_enable (); + do { + /* We can hard enable interrupts now to allow perfinterrupts */
arch/powerpc/kernel/irq.c void __do_irq(struct pt_regs *regs) · line 528
Quoted 9 lines
arch/powerpc/kernel/irq.c +9
-0+may_hard_irq_enable (); + +/* And finally process it */ +if (unlikely (!irq)) +__this_cpu_inc (irq_stat.spurious_irqs); +else +generic_handle_irq (irq); + +may_hard_irq_disable ();
Not sure the above is that useful. If another interrupt is pending, on ppc64 at least, you will have got it right at may_hard_irq_enable() which would have caused a hard-disable for you anyway.
Quoted 12 lines
arch/powerpc/kernel/irq.c +4
-5-/* And finally process it */ -if (unlikely (!irq)) -__this_cpu_inc (irq_stat.spurious_irqs); -else -generic_handle_irq (irq); + irq = ppc_md.get_irq (); + }while (irq); + +may_hard_irq_enable ();
trace_irq_exit(regs);