cleanup handling of bad IRQs
Subsystems (16)
Hello friends,
here's a patch queue for cleaning up the IRQ handling. Inspired by a discussion we had on a previous patch of mine:
"arch: fix 'unexpected IRQ trap at vector' warnings"
https://www.spinics.net/lists/kernel/msg3763137.html
Turned out that the whole message, as it is right now, doesn't make much sense at at all - not just incorrect wording, but also not quite useful information. And the whole ack_bad_irq() thing deserves a cleanup anyways.
So, I've had a closer look and came to these conclusions:
1. The warning message doesn't need to be duplicated in the per architecture ack_bad_irq() functions. All, but one callers already do their own warning. Thus just adding a pr_warn() call there, printing out more useful data like the hardware IRQ number, and dropping all warnings from all the ack_bad_irq() functions.
2. Many of the ack_bad_irq()'s count up the spurious interrupts - lots of duplications over the various archs. Some of them using atomic_t, some just plain ints. Consolidating this by introducing a global counter with inline'd accessors and doing the upcounting in the (currently 3) call sites of ack_bad_irq(). After that, step by step changing all archs to use the new counter.
3. For all but one arch (x86), ack_bad_irq() became a no-op.
On x86, it's just a call to ack_APIC_irq(), in order to prevent lockups when IRQs missed to be ack'ed on the APIC. Could we perhaps do this in some better place ? In that case, ack_bad_irq() could easily be removed entirely.
have fun,
--mtx
PATCH 1/23 kernel: irq: irqdescs: warn on spurious IRQ
Add a warning on spurious IRQs to __handle_domain_irq(), also telling the linux IRQ number (if any), the hw IRQ number and the max nr of IRQs.
That's far more informative than the warnings in (some of) the individual arch's ack_bad_irq()'s. These aren't really helpful since either the other callers already had printed more detailed information or (when called by __handle_domain_irq()) the printout just doesn't tell anything useful.
--- kernel/irq/irqdesc.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/irq/irqdesc.c +3 -0
@@ -681,6 +681,9 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,* than crashing, do something sensible. */ if (unlikely (!irq || irq >= nr_irqs)) { +if (printk_ratelimit ()) +pr_warn ("spurious IRQ: irq=%d hwirq=%d nr_irqs=%d\n" , + irq, hwirq, nr_irqs);ack_bad_irq (irq); ret = -EINVAL ; }else {
Signature · 1 line
2.11.0
Re: [PATCH 01/23] kernel: irq: irqdescs: warn on spurious IRQ
kernel/irq/irqdesc.c int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, · line 686
Quoted 3 lines · metux IT consult
kernel/irq/irqdesc.c +3
-0+if (printk_ratelimit ()) +pr_warn ("spurious IRQ: irq=%d hwirq=%d nr_irqs=%d\n" , + irq, hwirq, nr_irqs);
Perhaps you missed pr_warn_ratelimit() macro which is already in the kernel for a long time.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Michael Ellerman
reviewerRe: [PATCH 01/23] kernel: irq: irqdescs: warn on spurious IRQ
Quoted 9 lines · Andy Shevchenko
kernel/irq/irqdesc.c int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, · line 686
Quoted 3 lines · metux IT consult
kernel/irq/irqdesc.c +3
-0+if (printk_ratelimit ()) +pr_warn ("spurious IRQ: irq=%d hwirq=%d nr_irqs=%d\n" , + irq, hwirq, nr_irqs);Perhaps you missed
pr_warn_ratelimit()macro which is already in the kernel for a long time.
pr_warn_ratelimited() which calls printk_ratelimited().
And see the comment above printk_ratelimit():
/*
* Please don't use printk_ratelimit(), because it shares ratelimiting state
* with all other unrelated printk_ratelimit() callsites. Instead use
* printk_ratelimited() or plain old __ratelimit().
*/
cheers
Re: [PATCH 01/23] kernel: irq: irqdescs: warn on spurious IRQ
Quoted 4 lines · Michael Ellerman
Quoted 3 lines · Andy Shevchenko
On Fri, Dec 18, 2020 at 4:37 PM Enrico Weigelt, metux IT consult <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
kernel/irq/irqdesc.c int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, · line 686
Quoted 3 lines
kernel/irq/irqdesc.c +3
-0+if (printk_ratelimit ()) +pr_warn ("spurious IRQ: irq=%d hwirq=%d nr_irqs=%d\n" , + irq, hwirq, nr_irqs);Perhaps you missed
pr_warn_ratelimit()macro which is already in the kernel for a long time.
pr_warn_ratelimited()which callsprintk_ratelimited().
I stand corrected.
Right, that's what I had in mind (actually didn't know that there are variants).
Thanks!
Quoted 7 lines
And see the comment above
printk_ratelimit():/*
* Please don't useprintk_ratelimit(), because it shares ratelimiting state
* with all other unrelatedprintk_ratelimit()callsites. Instead use
*printk_ratelimited()or plain old__ratelimit().
*/
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 2/23 arch: alpha: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/alpha/kernel/irq.c | 1 - 1 file changed, 1 deletion(-)
arch/alpha/kernel/irq.c +0 -1
@@ -35,7 +35,6 @@ DEFINE_PER_CPU(unsigned long, irq_pmi_count);void ack_bad_irq (unsigned int irq) { irq_err_count++; -printk (KERN_CRIT "Unexpected IRQ trap at vector %u\n" , irq); }#ifdef CONFIG_SMP
Signature · 1 line
2.11.0
PATCH 3/23 arch: arm: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/arm/include/asm/hw_irq.h | 1 - 1 file changed, 1 deletion(-)
arch/arm/include/asm/hw_irq.h +0 -1
@@ -9,7 +9,6 @@ static inline void ack_bad_irq(int irq) {extern unsigned long irq_err_count; irq_err_count++; -pr_crit ("unexpected IRQ trap at vector %02x\n" , irq); }#define ARCH_IRQ_INIT_FLAGS (IRQ_NOREQUEST | IRQ_NOPROBE)
Signature · 1 line
2.11.0
PATCH 4/23 arch: c6x: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/c6x/kernel/irq.c | 1 - 1 file changed, 1 deletion(-)
arch/c6x/kernel/irq.c +0 -1
@@ -116,7 +116,6 @@ void __init init_IRQ(void)void ack_bad_irq (int irq) { -printk (KERN_ERR "IRQ: spurious interrupt %d\n" , irq); irq_err_count++; }
Signature · 1 line
2.11.0
PATCH 5/23 arch: ia64: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o "0x" prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/ia64/include/asm/hardirq.h | 2 +- arch/ia64/kernel/irq.c | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-)
arch/ia64/include/asm/hardirq.h +1 -1
@@ -22,6 +22,6 @@extern void __iomem *ipi_base_addr; -void ack_bad_irq (unsigned int irq); +#define ack_bad_irq (irq)#endif /* _ASM_IA64_HARDIRQ_H */
arch/ia64/kernel/irq.c +0 -9
@@ -28,15 +28,6 @@#include <asm/xtp.h> /* -* 'what should we do if we get a hw irq event on an illegal vector'. -* each architecture has to answer this themselves. -*/ -void ack_bad_irq (unsigned int irq) -{ -printk (KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n" , irq,smp_processor_id ()); -} - -/* * Interrupt statistics: */
Signature · 1 line
2.11.0
PATCH 6/23 arch: mips: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/mips/include/asm/hardirq.h | 3 +-- arch/mips/kernel/irq.c | 9 --------- 2 files changed, 1 insertion(+), 11 deletions(-)
arch/mips/include/asm/hardirq.h +1 -2
@@ -10,8 +10,7 @@#ifndef _ASM_HARDIRQ_H#define _ASM_HARDIRQ_H -extern void ack_bad_irq (unsigned int irq); -#define ack_bad_irq ack_bad_irq +#define ack_bad_irq (irq)#include <asm-generic/hardirq.h>
arch/mips/kernel/irq.c +0 -9
@@ -27,15 +27,6 @@void *irq_stack[NR_CPUS ]; -/* -* 'what should we do if we get a hw irq event on an illegal vector'. -* each architecture has to answer this themselves. -*/ -void ack_bad_irq (unsigned int irq) -{ -printk ("unexpected IRQ # %d\n" , irq); -} -atomic_t irq_err_count;int arch_show_interrupts (struct seq_file *p,int prec)
Signature · 1 line
2.11.0
PATCH 7/23 arch: parisc: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/parisc/include/asm/hardirq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/include/asm/hardirq.h +1 -1
@@ -34,6 +34,6 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);#define __ARCH_IRQ_STAT#define inc_irq_stat (member) this_cpu_inc(irq_stat.member)#define __inc_irq_stat (member) __this_cpu_inc(irq_stat.member) -#define ack_bad_irq (irq) WARN(1, "unexpected IRQ trap at vector %02x\n", irq) +#define ack_bad_irq (irq)#endif /* _PARISC_HARDIRQ_H */
Signature · 1 line
2.11.0
PATCH 8/23 arch: powerpc: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/powerpc/include/asm/hardirq.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/include/asm/hardirq.h +1 -4
@@ -27,10 +27,7 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);#define __ARCH_IRQ_STAT#define __ARCH_IRQ_EXIT_IRQS_DISABLED -static inline void ack_bad_irq (unsigned int irq) -{ -printk (KERN_CRIT "unexpected IRQ trap at vector %02x\n" , irq); -} +#define ack_bad_irq (irq)extern u64 arch_irq_stat_cpu (unsigned int cpu);#define arch_irq_stat_cpu arch_irq_stat_cpu
Signature · 1 line
2.11.0
PATCH 9/23 arch: s390: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/s390/include/asm/hardirq.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/s390/include/asm/hardirq.h +1 -4
@@ -21,9 +21,6 @@#define __ARCH_HAS_DO_SOFTIRQ#define __ARCH_IRQ_EXIT_IRQS_DISABLED -static inline void ack_bad_irq (unsigned int irq) -{ -printk (KERN_CRIT "unexpected IRQ trap at vector %02x\n" , irq); -} +#define ack_bad_irq (irq)#endif /* __ASM_HARDIRQ_H */
Signature · 1 line
2.11.0
PATCH 10/23 arch: sh: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/sh/kernel/irq.c | 1 - 1 file changed, 1 deletion(-)
arch/sh/kernel/irq.c +0 -1
@@ -31,7 +31,6 @@ atomic_t irq_err_count;void ack_bad_irq (unsigned int irq) {atomic_inc (&irq_err_count); -printk ("unexpected IRQ trap at vector %02x\n" , irq); }#if defined(CONFIG_PROC_FS )
Signature · 1 line
2.11.0
PATCH 11/23 arch: sparc: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/sparc/include/asm/hardirq_64.h | 2 +- arch/sparc/kernel/irq_64.c | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-)
arch/sparc/include/asm/hardirq_64.h +1 -1
@@ -14,6 +14,6 @@#define local_softirq_pending_ref \ __cpu_data.__softirq_pending -void ack_bad_irq (unsigned int irq); +#define ack_bad_irq (irq)#endif /* !(__SPARC64_HARDIRQ_H) */
arch/sparc/kernel/irq_64.c +0 -5
@@ -284,11 +284,6 @@ static unsigned int sysino_exists(u32 devhandle, unsigned int devino)return irq; } -void ack_bad_irq (unsigned int irq) -{ -pr_crit ("BAD IRQ ack %d\n" , irq); -} -void irq_install_pre_handler (int irq,void (*func)(unsigned int ,void *,void *),void *arg1,void *arg2)
Signature · 1 line
2.11.0
PATCH 12/23 arch: x86: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- arch/x86/kernel/irq.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/kernel/irq.c +0 -3
@@ -36,9 +36,6 @@ atomic_t irq_err_count;*/ void ack_bad_irq (unsigned int irq) { -if (printk_ratelimit ()) -pr_err ("unexpected IRQ trap at vector %02x\n" , irq); -/* * Currently unexpected vectors happen only on SMP and APIC. * We _must_ ack these because every local APIC has only N
Signature · 1 line
2.11.0
PATCH 13/23 arch: generic: drop misleading warning on spurious IRQ
In reply to Enrico Weigelt, metux IT consultThe warning in ack_bad_irq() is misleading in several ways:
* the term "vector" isn't quite correct
* the printing format isn't consistent across the archs: some print decimal, some hex, some hex w/o 0x prefix.
* the printed linux irq isn't meaningful in all cases - we actually would want it to print the hw irq.
Since all call sites already print out more detailed and correct information, we just don't need to duplicate this in each single arch. So just drop it.
--- include/asm-generic/hardirq.h | 1 - 1 file changed, 1 deletion(-)
include/asm-generic/hardirq.h +0 -1
@@ -19,7 +19,6 @@ DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);#ifndef ack_bad_irqstatic inline void ack_bad_irq (unsigned int irq) { -printk (KERN_CRIT "unexpected IRQ trap at vector %02x\n" , irq); }#endif
Signature · 1 line
2.11.0
PATCH 14/23 kernel: generic counter for interrupt errors
In reply to Enrico Weigelt, metux IT consultWe currently have counters for spurious interrupt spread over all the individual architectures. Mostly done in the arch's ack_bad_irq(), sometimes also in arch specific drivers.
It's time to consolidate this code duplication:
* introduce a global counter and inlined accessors
* increase the counter in all call sites of ack_bad_irq()
* subsequent patches will transform the individual archs one by one
--- include/asm-generic/irq-err.h | 17 +++++++++++++++++ kernel/irq/dummychip.c | 2 ++ kernel/irq/handle.c | 4 ++++ kernel/irq/irqdesc.c | 2 ++ 4 files changed, 25 insertions(+) create mode 100644 include/asm-generic/irq-err.h
include/asm-generic/irq-err.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_GENERIC_IRQ_ERR_H +#define __ASM_GENERIC_IRQ_ERR_H + +extern atomic_t irq_err_counter; + +static inline void irq_err_inc (void ) +{ +atomic_inc (&irq_err_counter); +} + +static inline int irq_err_get (void ) +{ +return atomic_read (&irq_err_counter); +} + +#endif /* __ASM_GENERIC_IRQ_ERR_H */
kernel/irq/dummychip.c +2 -0
@@ -8,6 +8,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/export.h> +#include <asm-generic/irq-err.h> #include "internals.h"
@@ -20,6 +21,7 @@ static void ack_bad(struct irq_data *data)struct irq_desc *desc =irq_data_to_desc (data);print_irq_desc (data->irq, desc); +irq_err_inc ();ack_bad_irq (data->irq); }
kernel/irq/handle.c +4 -0
@@ -13,11 +13,14 @@#include <linux/sched.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> +#include <asm-generic/irq-err.h> #include <trace/events/irq.h> #include "internals.h" +atomic_t irq_err_counter; +#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER void (*handle_arch_irq)(struct pt_regs *)__ro_after_init ;#endif
@@ -34,6 +37,7 @@ void handle_bad_irq(struct irq_desc *desc)print_irq_desc (irq, desc);kstat_incr_irqs_this_cpu (desc); +irq_err_inc ();ack_bad_irq (irq); }EXPORT_SYMBOL_GPL (handle_bad_irq);
kernel/irq/irqdesc.c +2 -0
@@ -16,6 +16,7 @@#include <linux/bitmap.h> #include <linux/irqdomain.h> #include <linux/sysfs.h> +#include <asm-generic/irq-err.h> #include "internals.h"
@@ -684,6 +685,7 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,if (printk_ratelimit ())pr_warn ("spurious IRQ: irq=%d hwirq=%d nr_irqs=%d\n" , irq, hwirq, nr_irqs); +irq_err_inc ();ack_bad_irq (irq); ret = -EINVAL ; }else {
Signature · 1 line
2.11.0
PATCH 15/23 arch: mips: use generic irq error counter
In reply to Enrico Weigelt, metux IT consultUse the newly introduced irq error counter, that's already maintained by all callers of ack_bad_irq(), in order to remove duplicate code.
--- arch/mips/include/asm/hw_irq.h | 4 ---- arch/mips/kernel/irq-gt641xx.c | 3 ++- arch/mips/kernel/irq.c | 7 +++---- arch/mips/sni/rm200.c | 3 ++- arch/mips/vr41xx/common/icu.c | 3 ++- arch/mips/vr41xx/common/irq.c | 5 +++-- drivers/gpio/gpio-vr41xx.c | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-)
arch/mips/include/asm/hw_irq.h +0 -4
@@ -8,10 +8,6 @@#ifndef __ASM_HW_IRQ_H#define __ASM_HW_IRQ_H -#include <linux/atomic.h> - -extern atomic_t irq_err_count; -/* * interrupt-retrigger: NOP for now. This may not be appropriate for all * machines, we'll see ...
arch/mips/kernel/irq-gt641xx.c +2 -1
@@ -11,6 +11,7 @@#include <linux/types.h> #include <asm/gt64120.h> +#include <asm-generic/irq-err.h> #define GT641XX_IRQ_TO_BIT (irq) (1U << (irq - GT641XX_IRQ_BASE))
@@ -97,7 +98,7 @@ void gt641xx_irq_dispatch(void) } } -atomic_inc (&irq_err_count); +irq_err_inc (); }void __init gt641xx_irq_init (void )
arch/mips/kernel/irq.c +3 -4
@@ -8,6 +8,7 @@* Copyright (C) 1992 Linus Torvalds * Copyright (C) 1994 - 2000 Ralf Baechle */ +#include <asm-generic/irq-err.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/init.h>
@@ -27,17 +28,15 @@void *irq_stack[NR_CPUS ]; -atomic_t irq_err_count; -int arch_show_interrupts (struct seq_file *p,int prec) { -seq_printf (p,"%*s: %10u\n" , prec,"ERR" ,atomic_read (&irq_err_count)); +seq_printf (p,"%*s: %10u\n" , prec,"ERR" ,irq_err_get ());return 0 ; } asmlinkage void spurious_interrupt(void) { -atomic_inc (&irq_err_count); +irq_err_inc (); }void __init init_IRQ (void )
arch/mips/sni/rm200.c +2 -1
@@ -21,6 +21,7 @@#include <asm/sni.h> #include <asm/time.h> #include <asm/irq_cpu.h> +#include <asm-generic/irq-err.h> #define RM200_I8259A_IRQ_BASE 32
@@ -270,7 +271,7 @@ void sni_rm200_mask_and_ack_8259A(struct irq_data *d) "spurious RM200 8259A interrupt: IRQ%d.\n", irq); spurious_irq_mask |= irqmask; } -atomic_inc (&irq_err_count); +irq_err_inc ();/* * Theoretically we do not have to handle this IRQ, * but in Linux this does not cause problems and is
arch/mips/vr41xx/common/icu.c +2 -1
@@ -27,6 +27,7 @@#include <asm/io.h> #include <asm/vr41xx/irq.h> #include <asm/vr41xx/vr41xx.h> +#include <asm-generic/irq-err.h> static void __iomem *icu1_base;static void __iomem *icu2_base;
@@ -640,7 +641,7 @@ static int icu_get_irq(unsigned int irq)printk (KERN_ERR "spurious ICU interrupt: %04x,%04x\n" , pend1, pend2); -atomic_inc (&irq_err_count); +irq_err_inc ();return -1 ; }
arch/mips/vr41xx/common/irq.c +3 -2
@@ -10,6 +10,7 @@#include <asm/irq_cpu.h> #include <asm/vr41xx/irq.h> +#include <asm-generic/irq-err.h> typedef struct irq_cascade { int (*get_irq)(unsigned int);
@@ -46,7 +47,7 @@ static void irq_dispatch(unsigned int irq)irq_cascade_t *cascade;if (irq >=NR_IRQS ) { -atomic_inc (&irq_err_count); +irq_err_inc ();return ; }
@@ -66,7 +67,7 @@ static void irq_dispatch(unsigned int irq) ret = cascade->get_irq (irq); irq = ret;if (ret <0 ) -atomic_inc (&irq_err_count); +irq_err_inc ();else irq_dispatch (irq);if (!irqd_irq_disabled (idata) && chip->irq_unmask)
drivers/gpio/gpio-vr41xx.c +2 -2
@@ -18,7 +18,7 @@#include <linux/platform_device.h> #include <linux/spinlock.h> #include <linux/types.h> - +#include <asm-generic/irq-err.h> #include <asm/vr41xx/giu.h> #include <asm/vr41xx/irq.h> #include <asm/vr41xx/vr41xx.h>
@@ -217,7 +217,7 @@ static int giu_get_irq(unsigned int irq)printk (KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n" , maskl, pendl, maskh, pendh); -atomic_inc (&irq_err_count); +irq_err_inc ();return -EINVAL ; }
Signature · 1 line
2.11.0
PATCH 16/23 arch: alpha: use generic irq error counter
In reply to Enrico Weigelt, metux IT consultUse the newly introduced irq error counter, that's already maintained by all callers of ack_bad_irq(), in order to remove duplicate code.
--- arch/alpha/include/asm/hardirq.h | 3 --- arch/alpha/include/asm/hw_irq.h | 2 -- arch/alpha/kernel/irq.c | 12 +++--------- arch/alpha/kernel/irq_alpha.c | 5 +++-- arch/alpha/kernel/perf_event.c | 6 +++--- 5 files changed, 9 insertions(+), 19 deletions(-)
arch/alpha/include/asm/hardirq.h +0 -3
@@ -2,9 +2,6 @@#ifndef _ALPHA_HARDIRQ_H#define _ALPHA_HARDIRQ_H -void ack_bad_irq (unsigned int irq); -#define ack_bad_irq ack_bad_irq -#include <asm-generic/hardirq.h> #endif /* _ALPHA_HARDIRQ_H */
arch/alpha/include/asm/hw_irq.h +0 -2
@@ -2,8 +2,6 @@#ifndef _ALPHA_HW_IRQ_H#define _ALPHA_HW_IRQ_H - -extern volatile unsigned long irq_err_count; DECLARE_PER_CPU(unsigned long, irq_pmi_count);#ifdef CONFIG_ALPHA_GENERIC
arch/alpha/kernel/irq.c +3 -9
@@ -25,18 +25,12 @@#include <linux/seq_file.h> #include <linux/profile.h> #include <linux/bitops.h> - +#include <asm-generic/irq-err.h> #include <asm/io.h> #include <linux/uaccess.h> -volatile unsigned long irq_err_count; DEFINE_PER_CPU(unsigned long, irq_pmi_count); -void ack_bad_irq (unsigned int irq) -{ - irq_err_count++; -} -#ifdef CONFIG_SMP static char irq_user_affinity[NR_IRQS ];
@@ -79,7 +73,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)for_each_online_cpu (j)seq_printf (p,"%10lu " ,per_cpu (irq_pmi_count, j));seq_puts (p," Performance Monitoring\n" ); -seq_printf (p,"ERR: %10lu\n" , irq_err_count); +seq_printf (p,"ERR: %10lu\n" ,irq_err_get ());return 0 ; }
@@ -109,7 +103,7 @@ handle_irq(int irq)if (!desc || ((unsigned ) irq >ACTUAL_NR_IRQS && illegal_count <MAX_ILLEGAL_IRQS )) { - irq_err_count++; +irq_err_inc (); illegal_count++;printk (KERN_CRIT "device_interrupt: invalid interrupt %d\n" , irq);
arch/alpha/kernel/irq_alpha.c +3 -2
@@ -13,6 +13,7 @@#include <asm/dma.h> #include <asm/perf_event.h> #include <asm/mce.h> +#include <asm-generic/irq-err.h> #include "proto.h" #include "irq_impl.h"
@@ -30,7 +31,7 @@ EXPORT_SYMBOL(__min_ipl);static void dummy_perf (unsigned long vector,struct pt_regs *regs) { - irq_err_count++; +irq_err_inc ();printk (KERN_CRIT "Performance counter interrupt!\n" ); }
@@ -60,7 +61,7 @@ do_entInt(unsigned long type, unsigned long vector,handle_ipi (regs);return ;#else - irq_err_count++; +irq_err_inc ();printk (KERN_CRIT "Interprocessor interrupt? " "You must be kidding!\n" );#endif
arch/alpha/kernel/perf_event.c +3 -3
@@ -16,7 +16,7 @@#include <linux/kdebug.h> #include <linux/mutex.h> #include <linux/init.h> - +#include <asm-generic/irq-err.h> #include <asm/hwrpb.h> #include <linux/atomic.h> #include <asm/irq.h>
@@ -823,7 +823,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,/* la_ptr is the counter that overflowed. */ if (unlikely (la_ptr >= alpha_pmu->num_pmcs)) {/* This should never occur! */ - irq_err_count++; +irq_err_inc ();pr_warn ("PMI: silly index %ld\n" , la_ptr);wrperfmon (PERFMON_CMD_ENABLE , cpuc->idx_mask);return ;
@@ -846,7 +846,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,if (unlikely (!event)) {/* This should never occur! */ - irq_err_count++; +irq_err_inc ();pr_warn ("PMI: No event at index %d!\n" , idx);wrperfmon (PERFMON_CMD_ENABLE , cpuc->idx_mask);return ;
Signature · 1 line
2.11.0
PATCH 17/23 arch: arm: use generic irq error counter
In reply to Enrico Weigelt, metux IT consultUse the newly introduced irq error counter, that's already maintained by all callers of ack_bad_irq(), in order to remove duplicate code.
--- arch/arm/include/asm/hardirq.h | 2 +- arch/arm/include/asm/hw_irq.h | 6 ------ arch/arm/kernel/irq.c | 6 ++---- drivers/irqchip/irq-omap-intc.c | 5 ++--- 4 files changed, 5 insertions(+), 14 deletions(-)
arch/arm/include/asm/hardirq.h +1 -1
@@ -5,7 +5,7 @@#include <asm/irq.h> #define __ARCH_IRQ_EXIT_IRQS_DISABLED 1 -#define ack_bad_irq ack_bad_irq +#define ack_bad_irq (irq)#include <asm-generic/hardirq.h>
arch/arm/include/asm/hw_irq.h +0 -6
@@ -5,12 +5,6 @@#ifndef _ARCH_ARM_HW_IRQ_H#define _ARCH_ARM_HW_IRQ_H -static inline void ack_bad_irq (int irq) -{ -extern unsigned long irq_err_count; - irq_err_count++; -} -#define ARCH_IRQ_INIT_FLAGS (IRQ_NOREQUEST | IRQ_NOPROBE)#endif
arch/arm/kernel/irq.c +2 -4
@@ -32,7 +32,7 @@#include <linux/kallsyms.h> #include <linux/proc_fs.h> #include <linux/export.h> - +#include <asm-generic/irq-err.h> #include <asm/hardware/cache-l2x0.h> #include <asm/hardware/cache-uniphier.h> #include <asm/outercache.h>
@@ -41,8 +41,6 @@#include <asm/mach/irq.h> #include <asm/mach/time.h> -unsigned long irq_err_count; -int arch_show_interrupts (struct seq_file *p,int prec) {#ifdef CONFIG_FIQ
@@ -51,7 +49,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)#ifdef CONFIG_SMP show_ipi_list (p, prec);#endif -seq_printf (p,"%*s: %10lu\n" , prec,"Err" , irq_err_count); +seq_printf (p,"%*s: %10lu\n" , prec,"Err" ,irq_err_get ());return 0 ; }
drivers/irqchip/irq-omap-intc.c +0 -0
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/interrupt.h> #include <linux/io.h>
PATCH 18/23 arch: arm64: use generic irq error counter
In reply to Enrico Weigelt, metux IT consultUse the newly introduced irq error counter, that's already maintained by all callers of ack_bad_irq(), in order to remove duplicate code.
--- arch/arm64/include/asm/hardirq.h | 9 ++------- arch/arm64/kernel/smp.c | 6 ++---- 2 files changed, 4 insertions(+), 11 deletions(-)
arch/arm64/include/asm/hardirq.h +2 -7
@@ -13,7 +13,8 @@#include <asm/kvm_arm.h> #include <asm/sysreg.h> -#define ack_bad_irq ack_bad_irq +#define ack_bad_irq (irq) +#include <asm-generic/hardirq.h> #define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
@@ -85,10 +86,4 @@ do { \write_sysreg (___hcr, hcr_el2); \ } while (0) -static inline void ack_bad_irq(unsigned int irq) -{ -extern unsigned long irq_err_count; - irq_err_count++; -} -#endif /* __ASM_HARDIRQ_H */
arch/arm64/kernel/smp.c +2 -4
@@ -33,7 +33,7 @@#include <linux/kernel_stat.h> #include <linux/kexec.h> #include <linux/kvm_host.h> - +#include <asm-generic/irq-err.h> #include <asm/alternative.h> #include <asm/atomic.h> #include <asm/cacheflush.h>
@@ -798,8 +798,6 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = {static void smp_cross_call (const struct cpumask *target,unsigned int ipinr); -unsigned long irq_err_count; -int arch_show_interrupts (struct seq_file *p,int prec) {unsigned int cpu, i;
@@ -813,7 +811,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p," %s\n" , ipi_types[i]); } -seq_printf (p,"%*s: %10lu\n" , prec,"Err" , irq_err_count); +seq_printf (p,"%*s: %10lu\n" , prec,"Err" ,irq_err_get ());return 0 ; }
Signature · 1 line
2.11.0
PATCH 19/23 arch: c6x: use generic irq error counter
In reply to Enrico Weigelt, metux IT consultUse the newly introduced irq error counter, that's already maintained by all callers of ack_bad_irq(), in order to remove duplicate code.
--- arch/c6x/include/asm/hardirq.h | 3 --- arch/c6x/include/asm/irq.h | 2 -- arch/c6x/kernel/irq.c | 11 ++--------- 3 files changed, 2 insertions(+), 14 deletions(-)
arch/c6x/include/asm/hardirq.h +0 -3
@@ -9,9 +9,6 @@#ifndef _ASM_C6X_HARDIRQ_H#define _ASM_C6X_HARDIRQ_H -extern void ack_bad_irq (int irq); -#define ack_bad_irq ack_bad_irq -#include <asm-generic/hardirq.h> #endif /* _ASM_C6X_HARDIRQ_H */
arch/c6x/include/asm/irq.h +0 -2
@@ -45,6 +45,4 @@ struct pt_regs; extern asmlinkage void c6x_do_IRQ(unsigned int prio, struct pt_regs *regs); -extern unsigned long irq_err_count; -#endif /* _ASM_C6X_IRQ_H */
arch/c6x/kernel/irq.c +2 -9
@@ -21,12 +21,10 @@#include <linux/of_irq.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> - +#include <asm-generic/irq-err.h> #include <asm/megamod-pic.h> #include <asm/special_insns.h> -unsigned long irq_err_count; -static DEFINE_RAW_SPINLOCK (core_irq_lock);static void mask_core_irq (struct irq_data *data)
@@ -114,13 +112,8 @@ void __init init_IRQ(void)set_creg (ICR ,0xfff0 ); } -void ack_bad_irq (int irq) -{ - irq_err_count++; -} -int arch_show_interrupts (struct seq_file *p,int prec) { -seq_printf (p,"%*s: %10lu\n" , prec,"Err" , irq_err_count); +seq_printf (p,"%*s: %10lu\n" , prec,"Err" ,irq_err_get ());return 0 ; }
Signature · 1 line
2.11.0