irqchip: omap-intc: improve IRQ handler
Subsystems (2)
PATCH RESEND 1/1 irqchip: omap-intc: improve IRQ handler
as it turns out the current IRQ number will *always* be available from SIR register which renders the reads of PENDING registers as plain unnecessary overhead.
In order to catch any situation where SIR reads as zero, we're adding a WARN() to turn it into a very verbose error and users actually report it.
With this patch average running time of omap_intc_handle_irq() reduced from about 28.5us to 19.8us as measured by the kernel function profiler.
Tested with BeagleBoneBlack Rev A5C.
--- drivers/irqchip/irq-omap-intc.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-)
drivers/irqchip/irq-omap-intc.c +5 -30
@@ -331,37 +331,12 @@ static int __init omap_init_irq(u32 base, struct device_node *node) static asmlinkage void __exception_irq_entryomap_intc_handle_irq (struct pt_regs *regs) { -u32 irqnr =0 ; -int handled_irq =0 ; -int i; - -do { -for (i =0 ; i < omap_nr_pending; i++) { - irqnr =intc_readl (INTC_PENDING_IRQ0 + (0x20 * i)); -if (irqnr) - goto out; - } - -out: -if (!irqnr) -break ; - - irqnr =intc_readl (INTC_SIR ); - irqnr &=ACTIVEIRQ_MASK ; +u32 irqnr; -if (irqnr) { -handle_domain_irq (domain, irqnr, regs); - handled_irq =1 ; - } - }while (irqnr); - -/* -* If an irq is masked or deasserted while active, we will -* keep ending up here with no irq handled. So remove it from -* the INTC with an ack. -*/ -if (!handled_irq) -omap_ack_irq (NULL ); + irqnr =intc_readl (INTC_SIR ); + irqnr &=ACTIVEIRQ_MASK ; +WARN (!irqnr,"Spurious IRQ ?\n" ); +handle_domain_irq (domain, irqnr, regs); }void __init omap3_init_irq (void )
Signature · 1 line
2.4.4
drivers/irqchip/irq-omap-intc.c static int __init omap_init_irq(u32 base, struct device_node *node) · line 338
Quoted 3 lines · Felipe Balbi
drivers/irqchip/irq-omap-intc.c +3
-0+ irqnr =intc_readl (INTC_SIR ); + irqnr &=ACTIVEIRQ_MASK ; +WARN (!irqnr,"Spurious IRQ ?\n" );
Shouldn't that be WARN_ONCE?
Thanks,
tglx
Felipe Balbi
Tested-by Tony LindgrenQuoted 6 lines · Thomas Gleixner
Review
Quoted 3 lines · Felipe Balbi
(quoted diff) +3
-0+ irqnr = intc_readl(INTC_SIR); + irqnr &= ACTIVEIRQ_MASK; + WARN(!irqnr, "Spurious IRQ ?\n");Shouldn't that be
WARN_ONCE?
Sure, why not ?
8<--------------------------------------------------------------------
Quoted 1 line
From
a71590d725e54b888db278de6c278d2a106fc76dMon Sep 17 00:00:00 2001
From: Felipe Balbi <[email protected]>
Date: Fri, 2 Jan 2015 16:18:54 -0600
Subject: [PATCH RESEND v2] irqchip: omap-intc: improve IRQ handler
as it turns out the current IRQ number will *always* be available from SIR register which renders the reads of PENDING registers as plain unnecessary overhead.
In order to catch any situation where SIR reads as zero, we're adding a WARN() to turn it into a very verbose error and users actually report it.
With this patch average running time of omap_intc_handle_irq() reduced from about 28.5us to 19.8us as measured by the kernel function profiler.
Tested with BeagleBoneBlack Rev A5C.
---
Changes from V1:
- replace WARN() with WARN_ONCE()
drivers/irqchip/irq-omap-intc.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-)
drivers/irqchip/irq-omap-intc.c +5 -30
@@ -331,37 +331,12 @@ static int __init omap_init_irq(u32 base, struct device_node *node) static asmlinkage void __exception_irq_entryomap_intc_handle_irq (struct pt_regs *regs) { -u32 irqnr =0 ; -int handled_irq =0 ; -int i; - -do { -for (i =0 ; i < omap_nr_pending; i++) { - irqnr =intc_readl (INTC_PENDING_IRQ0 + (0x20 * i)); -if (irqnr) - goto out; - } - -out: -if (!irqnr) -break ; - - irqnr =intc_readl (INTC_SIR ); - irqnr &=ACTIVEIRQ_MASK ; +u32 irqnr; -if (irqnr) { -handle_domain_irq (domain, irqnr, regs); - handled_irq =1 ; - } - }while (irqnr); - -/* -* If an irq is masked or deasserted while active, we will -* keep ending up here with no irq handled. So remove it from -* the INTC with an ack. -*/ -if (!handled_irq) -omap_ack_irq (NULL ); + irqnr =intc_readl (INTC_SIR ); + irqnr &=ACTIVEIRQ_MASK ; +WARN_ONCE (!irqnr,"Spurious IRQ ?\n" ); +handle_domain_irq (domain, irqnr, regs); }void __init omap3_init_irq (void )
Signature · 12 lines
2.4.4 -- balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150720/6a9f0eb0/attachment.sig>
tip-bot for Felipe Balbi
merge bot[tip:irq/core] irqchip: omap-intc: Improve IRQ handler
irqchip: omap-intc: Improve IRQ handler
Commit-ID: 6ed3464897cc825a75218653c710d673282dfcf8 Gitweb: http://git.kernel.org/tip/6ed3464897cc825a75218653c710d673282dfcf8 Author: Felipe Balbi <[email protected]> AuthorDate: Fri, 2 Jan 2015 16:18:54 -0600 Committer: Thomas Gleixner <[email protected]> CommitDate: Wed, 22 Jul 2015 18:37:42 +0200
irqchip: omap-intc: Improve IRQ handler
As it turns out the current IRQ number will *always* be available from SIR register which renders the reads of PENDING registers as plain unnecessary overhead.
In order to catch any situation where SIR reads as zero, we're adding a WARN() to turn it into a very verbose error and users actually report it.
With this patch average running time of omap_intc_handle_irq() reduced from about 28.5us to 19.8us as measured by the kernel function profiler.
Tested with BeagleBoneBlack Rev A5C.
--- drivers/irqchip/irq-omap-intc.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-)
drivers/irqchip/irq-omap-intc.c +5 -30
@@ -330,37 +330,12 @@ static int __init omap_init_irq(u32 base, struct device_node *node) static asmlinkage void __exception_irq_entryomap_intc_handle_irq (struct pt_regs *regs) { -u32 irqnr =0 ; -int handled_irq =0 ; -int i; - -do { -for (i =0 ; i < omap_nr_pending; i++) { - irqnr =intc_readl (INTC_PENDING_IRQ0 + (0x20 * i)); -if (irqnr) - goto out; - } - -out: -if (!irqnr) -break ; - - irqnr =intc_readl (INTC_SIR ); - irqnr &=ACTIVEIRQ_MASK ; +u32 irqnr; -if (irqnr) { -handle_domain_irq (domain, irqnr, regs); - handled_irq =1 ; - } - }while (irqnr); - -/* -* If an irq is masked or deasserted while active, we will -* keep ending up here with no irq handled. So remove it from -* the INTC with an ack. -*/ -if (!handled_irq) -omap_ack_irq (NULL ); + irqnr =intc_readl (INTC_SIR ); + irqnr &=ACTIVEIRQ_MASK ; +WARN_ONCE (!irqnr,"Spurious IRQ ?\n" ); +handle_domain_irq (domain, irqnr, regs); }void __init omap3_init_irq (void )