* [PATCH 19/23] arch: c6x: use generic irq error counter
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
Use the newly introduced irq error counter, that's already maintained
by all callers of ack_bad_irq(), in order to remove duplicate code.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
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(-)
diff --git a/arch/c6x/include/asm/hardirq.h b/arch/c6x/include/asm/hardirq.h
index f37d07d31040..f70f6113e53a 100644
--- a/arch/c6x/include/asm/hardirq.h
+++ b/arch/c6x/include/asm/hardirq.h
@@ -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 */
diff --git a/arch/c6x/include/asm/irq.h b/arch/c6x/include/asm/irq.h
index 9da4d1afd0d7..f42c5747c3ee 100644
--- a/arch/c6x/include/asm/irq.h
+++ b/arch/c6x/include/asm/irq.h
@@ -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 */
diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c
index b9f7cfa2ed21..9f9d798925de 100644
--- a/arch/c6x/kernel/irq.c
+++ b/arch/c6x/kernel/irq.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 14/23] kernel: generic counter for interrupt errors
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
We 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
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
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
diff --git a/include/asm-generic/irq-err.h b/include/asm-generic/irq-err.h
new file mode 100644
index 000000000000..33c75eb50c10
--- /dev/null
+++ b/include/asm-generic/irq-err.h
@@ -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 */
diff --git a/kernel/irq/dummychip.c b/kernel/irq/dummychip.c
index 0b0cdf206dc4..93585dab9bd0 100644
--- a/kernel/irq/dummychip.c
+++ b/kernel/irq/dummychip.c
@@ -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);
}
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 762a928e18f9..ad90f5a56c3a 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -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);
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 62a381351775..6192672be4d2 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -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 {
--
2.11.0
^ permalink raw reply related
* [PATCH 16/23] arch: alpha: use generic irq error counter
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
Use the newly introduced irq error counter, that's already maintained
by all callers of ack_bad_irq(), in order to remove duplicate code.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
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(-)
diff --git a/arch/alpha/include/asm/hardirq.h b/arch/alpha/include/asm/hardirq.h
index 5ce5b34e8a1a..0bbc9947e364 100644
--- a/arch/alpha/include/asm/hardirq.h
+++ b/arch/alpha/include/asm/hardirq.h
@@ -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 */
diff --git a/arch/alpha/include/asm/hw_irq.h b/arch/alpha/include/asm/hw_irq.h
index e2d81ac0d934..0be79f3a6cae 100644
--- a/arch/alpha/include/asm/hw_irq.h
+++ b/arch/alpha/include/asm/hw_irq.h
@@ -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
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index c1980eea75a6..2b7dad83e0dc 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -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);
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index d17e44c99df9..3b6373cf73d9 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -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
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index e7a59d927d78..d855cece7bb1 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -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;
--
2.11.0
^ permalink raw reply related
* [PATCH 12/23] arch: x86: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/x86/kernel/irq.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index c5dd50369e2f..5c66c44b6b60 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -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
--
2.11.0
^ permalink raw reply related
* [PATCH 03/23] arch: arm: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/arm/include/asm/hw_irq.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm/include/asm/hw_irq.h b/arch/arm/include/asm/hw_irq.h
index cecc13214ef1..5305c7e33aee 100644
--- a/arch/arm/include/asm/hw_irq.h
+++ b/arch/arm/include/asm/hw_irq.h
@@ -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)
--
2.11.0
^ permalink raw reply related
* [PATCH 17/23] arch: arm: use generic irq error counter
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
Use the newly introduced irq error counter, that's already maintained
by all callers of ack_bad_irq(), in order to remove duplicate code.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
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(-)
diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index 706efafbf972..d9ae8998240d 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -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>
diff --git a/arch/arm/include/asm/hw_irq.h b/arch/arm/include/asm/hw_irq.h
index 5305c7e33aee..adbbeb11b930 100644
--- a/arch/arm/include/asm/hw_irq.h
+++ b/arch/arm/include/asm/hw_irq.h
@@ -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
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 698b6f636156..72c3b8ce74db 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -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;
}
diff --git a/drivers/irqchip/irq-omap-intc.c b/drivers/irqchip/irq-omap-intc.c
index d360a6eddd6d..2682c6e814c2 100644
--- a/drivers/irqchip/irq-omap-intc.c
+++ b/drivers/irqchip/irq-omap-intc.c
@@ -15,7 +15,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
-
+#include <asm-generic/irq-err.h>
#include <asm/exception.h>
#include <linux/irqchip.h>
#include <linux/irqdomain.h>
@@ -328,7 +328,6 @@ static int __init omap_init_irq(u32 base, struct device_node *node)
static asmlinkage void __exception_irq_entry
omap_intc_handle_irq(struct pt_regs *regs)
{
- extern unsigned long irq_err_count;
u32 irqnr;
irqnr = intc_readl(INTC_SIR);
@@ -351,7 +350,7 @@ omap_intc_handle_irq(struct pt_regs *regs)
*/
if (unlikely((irqnr & SPURIOUSIRQ_MASK) == SPURIOUSIRQ_MASK)) {
pr_err_once("%s: spurious irq!\n", __func__);
- irq_err_count++;
+ irq_err_inc();
omap_ack_irq(NULL);
return;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 18/23] arch: arm64: use generic irq error counter
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
Use the newly introduced irq error counter, that's already maintained
by all callers of ack_bad_irq(), in order to remove duplicate code.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/arm64/include/asm/hardirq.h | 9 ++-------
arch/arm64/kernel/smp.c | 6 ++----
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h
index cbfa7b6f2e09..760922571084 100644
--- a/arch/arm64/include/asm/hardirq.h
+++ b/arch/arm64/include/asm/hardirq.h
@@ -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 */
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 2499b895efea..0edc565ea735 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 10/23] arch: sh: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/sh/kernel/irq.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index ab5f790b0cd2..c14a142efe60 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -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)
--
2.11.0
^ permalink raw reply related
* [PATCH 13/23] arch: generic: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
include/asm-generic/hardirq.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/asm-generic/hardirq.h b/include/asm-generic/hardirq.h
index 7317e8258b48..f5a0240cbf52 100644
--- a/include/asm-generic/hardirq.h
+++ b/include/asm-generic/hardirq.h
@@ -19,7 +19,6 @@ DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);
#ifndef ack_bad_irq
static inline void ack_bad_irq(unsigned int irq)
{
- printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
}
#endif
--
2.11.0
^ permalink raw reply related
* [PATCH 09/23] arch: s390: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/s390/include/asm/hardirq.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/s390/include/asm/hardirq.h b/arch/s390/include/asm/hardirq.h
index dfbc3c6c0674..56d95fcb310a 100644
--- a/arch/s390/include/asm/hardirq.h
+++ b/arch/s390/include/asm/hardirq.h
@@ -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 */
--
2.11.0
^ permalink raw reply related
* [PATCH 08/23] arch: powerpc: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/powerpc/include/asm/hardirq.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index f133b5930ae1..4138193c2367 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -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
--
2.11.0
^ permalink raw reply related
* [PATCH 15/23] arch: mips: use generic irq error counter
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
Use the newly introduced irq error counter, that's already maintained
by all callers of ack_bad_irq(), in order to remove duplicate code.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
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(-)
diff --git a/arch/mips/include/asm/hw_irq.h b/arch/mips/include/asm/hw_irq.h
index 9e8ef5994c9c..b75fe2c4377f 100644
--- a/arch/mips/include/asm/hw_irq.h
+++ b/arch/mips/include/asm/hw_irq.h
@@ -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 ...
diff --git a/arch/mips/kernel/irq-gt641xx.c b/arch/mips/kernel/irq-gt641xx.c
index 93bcf5736a6f..e2c877287bee 100644
--- a/arch/mips/kernel/irq-gt641xx.c
+++ b/arch/mips/kernel/irq-gt641xx.c
@@ -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)
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index c98be305fab6..3ea3e4280648 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -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)
diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index d84744ca871d..c61d60a4dcc5 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -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
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 7b7f25b4b057..462f559ad978 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -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;
}
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index 8f68446ff2d9..b2580de08e25 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -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)
diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
index 98cd715ccc33..c1dbd933d291 100644
--- a/drivers/gpio/gpio-vr41xx.c
+++ b/drivers/gpio/gpio-vr41xx.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 07/23] arch: parisc: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/parisc/include/asm/hardirq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/parisc/include/asm/hardirq.h b/arch/parisc/include/asm/hardirq.h
index fad29aa6f45f..78b581f00bb3 100644
--- a/arch/parisc/include/asm/hardirq.h
+++ b/arch/parisc/include/asm/hardirq.h
@@ -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 */
--
2.11.0
^ permalink raw reply related
* [PATCH 01/23] kernel: irq: irqdescs: warn on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
kernel/irq/irqdesc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index e810eb9906ea..62a381351775 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -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 {
--
2.11.0
^ permalink raw reply related
* [PATCH 11/23] arch: sparc: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/sparc/include/asm/hardirq_64.h | 2 +-
arch/sparc/kernel/irq_64.c | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/sparc/include/asm/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h
index 75b92bfe04b5..874151f520de 100644
--- a/arch/sparc/include/asm/hardirq_64.h
+++ b/arch/sparc/include/asm/hardirq_64.h
@@ -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) */
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 3ec9f1402aad..ea2a52f7fe53 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -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)
--
2.11.0
^ permalink raw reply related
* [PATCH 04/23] arch: c6x: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/c6x/kernel/irq.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c
index e4c53d185b62..b9f7cfa2ed21 100644
--- a/arch/c6x/kernel/irq.c
+++ b/arch/c6x/kernel/irq.c
@@ -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++;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 06/23] arch: mips: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/mips/include/asm/hardirq.h | 3 +--
arch/mips/kernel/irq.c | 9 ---------
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/mips/include/asm/hardirq.h b/arch/mips/include/asm/hardirq.h
index c977a86c2c65..75444120e6cb 100644
--- a/arch/mips/include/asm/hardirq.h
+++ b/arch/mips/include/asm/hardirq.h
@@ -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>
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 85b6c60f285d..c98be305fab6 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -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)
--
2.11.0
^ permalink raw reply related
* [PATCH 05/23] arch: ia64: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/ia64/include/asm/hardirq.h | 2 +-
arch/ia64/kernel/irq.c | 9 ---------
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/arch/ia64/include/asm/hardirq.h b/arch/ia64/include/asm/hardirq.h
index ccde7c2ba00f..dddaafaf84e0 100644
--- a/arch/ia64/include/asm/hardirq.h
+++ b/arch/ia64/include/asm/hardirq.h
@@ -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 */
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index ecef17c7c35b..1365c7cf2095 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -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:
*/
--
2.11.0
^ permalink raw reply related
* cleanup handling of bad IRQs
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:30 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
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
^ permalink raw reply
* [PATCH 02/23] arch: alpha: drop misleading warning on spurious IRQ
From: Enrico Weigelt, metux IT consult @ 2020-12-18 14:31 UTC (permalink / raw)
To: linux-kernel
Cc: mark.rutland, dalias, linux-ia64, linux-sh, alexander.shishkin,
linus.walleij, James.Bottomley, paulus, hpa, sparclinux, will,
gerg, linux-arch, linux-s390, linux-c6x-dev, ysato, jolsa, deller,
x86, bgolaszewski, tony, geert, catalin.marinas, linux-alpha,
arnd, msalter, jacquiot.aurelien, linux-gpio, linux-m68k, bp,
namhyung, tglx, linux-omap, tsbogend, linux-parisc, linux-mips,
maz, linuxppc-dev, davem
In-Reply-To: <20201218143122.19459-1-info@metux.net>
The 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.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
arch/alpha/kernel/irq.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index f6d2946edbd2..c1980eea75a6 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -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
--
2.11.0
^ permalink raw reply related
* [PATCH] mm: Remove arch_remap() and mm-arch-hooks.h
From: Christophe Leroy @ 2020-12-18 14:07 UTC (permalink / raw)
To: Arnd Bergmann, Andrew Morton
Cc: linux-arch, Richard Weinberger, Jeff Dike, linux-um, linux-kernel,
linux-mm, linuxppc-dev, Anton Ivanov
powerpc was the last provider of arch_remap() and the last
user of mm-arch-hooks.h.
Since commit 526a9c4a7234 ("powerpc/vdso: Provide vdso_remap()"),
arch_remap() hence mm-arch-hooks.h are not used anymore.
Remove them.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/um/include/asm/Kbuild | 1 -
include/asm-generic/Kbuild | 1 -
include/asm-generic/mm-arch-hooks.h | 16 ----------------
include/linux/mm-arch-hooks.h | 22 ----------------------
mm/mremap.c | 3 ---
5 files changed, 43 deletions(-)
delete mode 100644 include/asm-generic/mm-arch-hooks.h
delete mode 100644 include/linux/mm-arch-hooks.h
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 1c63b260ecc4..314979467db1 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -14,7 +14,6 @@ generic-y += irq_regs.h
generic-y += irq_work.h
generic-y += kdebug.h
generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
generic-y += mmiowb.h
generic-y += module.lds.h
generic-y += param.h
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 4365b9aa3e3f..e867eb3058d5 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -34,7 +34,6 @@ mandatory-y += kmap_size.h
mandatory-y += kprobes.h
mandatory-y += linkage.h
mandatory-y += local.h
-mandatory-y += mm-arch-hooks.h
mandatory-y += mmiowb.h
mandatory-y += mmu.h
mandatory-y += mmu_context.h
diff --git a/include/asm-generic/mm-arch-hooks.h b/include/asm-generic/mm-arch-hooks.h
deleted file mode 100644
index 5ff0e5193f85..000000000000
--- a/include/asm-generic/mm-arch-hooks.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Architecture specific mm hooks
- */
-
-#ifndef _ASM_GENERIC_MM_ARCH_HOOKS_H
-#define _ASM_GENERIC_MM_ARCH_HOOKS_H
-
-/*
- * This file should be included through arch/../include/asm/Kbuild for
- * the architecture which doesn't need specific mm hooks.
- *
- * In that case, the generic hooks defined in include/linux/mm-arch-hooks.h
- * are used.
- */
-
-#endif /* _ASM_GENERIC_MM_ARCH_HOOKS_H */
diff --git a/include/linux/mm-arch-hooks.h b/include/linux/mm-arch-hooks.h
deleted file mode 100644
index 9c4bedc95504..000000000000
--- a/include/linux/mm-arch-hooks.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Generic mm no-op hooks.
- *
- * Copyright (C) 2015, IBM Corporation
- * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
- */
-#ifndef _LINUX_MM_ARCH_HOOKS_H
-#define _LINUX_MM_ARCH_HOOKS_H
-
-#include <asm/mm-arch-hooks.h>
-
-#ifndef arch_remap
-static inline void arch_remap(struct mm_struct *mm,
- unsigned long old_start, unsigned long old_end,
- unsigned long new_start, unsigned long new_end)
-{
-}
-#define arch_remap arch_remap
-#endif
-
-#endif /* _LINUX_MM_ARCH_HOOKS_H */
diff --git a/mm/mremap.c b/mm/mremap.c
index c5590afe7165..e43696a91260 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -22,7 +22,6 @@
#include <linux/syscalls.h>
#include <linux/mmu_notifier.h>
#include <linux/uaccess.h>
-#include <linux/mm-arch-hooks.h>
#include <linux/userfaultfd_k.h>
#include <asm/cacheflush.h>
@@ -560,8 +559,6 @@ static unsigned long move_vma(struct vm_area_struct *vma,
new_addr = err;
} else {
mremap_userfaultfd_prep(new_vma, uf);
- arch_remap(mm, old_addr, old_addr + old_len,
- new_addr, new_addr + new_len);
}
/* Conceal VM_ACCOUNT so old reservation is not undone */
--
2.25.0
^ permalink raw reply related
* [PATCH 3/3] powerpc/vdso: Fix DOTSYM for 32-bit LE VDSO
From: Michael Ellerman @ 2020-12-18 11:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: skirmisher
In-Reply-To: <20201218111619.1206391-1-mpe@ellerman.id.au>
Skirmisher reported on IRC that the 32-bit LE VDSO was hanging. This
turned out to be due to a branch to self in eg. __kernel_gettimeofday.
Looking at the disassembly with objdump -dR shows why:
00000528 <__kernel_gettimeofday>:
528: f0 ff 21 94 stwu r1,-16(r1)
52c: a6 02 08 7c mflr r0
530: f0 ff 21 94 stwu r1,-16(r1)
534: 14 00 01 90 stw r0,20(r1)
538: 05 00 9f 42 bcl 20,4*cr7+so,53c <__kernel_gettimeofday+0x14>
53c: a6 02 a8 7c mflr r5
540: ff ff a5 3c addis r5,r5,-1
544: c4 fa a5 38 addi r5,r5,-1340
548: f0 00 a5 38 addi r5,r5,240
54c: 01 00 00 48 bl 54c <__kernel_gettimeofday+0x24>
54c: R_PPC_REL24 .__c_kernel_gettimeofday
Because we don't process relocations for the VDSO, this branch remains
a branch from 0x54c to 0x54c.
With the preceding patch to prohibit R_PPC_REL24 relocations, we
instead get a build failure:
0000054c R_PPC_REL24 .__c_kernel_gettimeofday
00000598 R_PPC_REL24 .__c_kernel_clock_gettime
000005e4 R_PPC_REL24 .__c_kernel_clock_gettime64
00000630 R_PPC_REL24 .__c_kernel_clock_getres
0000067c R_PPC_REL24 .__c_kernel_time
arch/powerpc/kernel/vdso32/vdso32.so.dbg: dynamic relocations are not supported
The root cause is that we're branching to `.__c_kernel_gettimeofday`.
But this is 32-bit LE code, which doesn't use function descriptors, so
there are no dot symbols.
The reason we're trying to branch to a dot symbol is because we're
using the DOTSYM macro, but the ifdefs we use to define the DOTSYM
macro do not currently work for 32-bit LE.
So like previous commits we need to differentiate if the current
compilation unit is 64-bit, rather than the kernel as a whole. ie.
switch from CONFIG_PPC64 to __powerpc64__.
With that fixed 32-bit LE code gets the empty version of DOTSYM, which
just resolves to the original symbol name, leading to a direct branch
and no relocations:
000003f8 <__kernel_gettimeofday>:
3f8: f0 ff 21 94 stwu r1,-16(r1)
3fc: a6 02 08 7c mflr r0
400: f0 ff 21 94 stwu r1,-16(r1)
404: 14 00 01 90 stw r0,20(r1)
408: 05 00 9f 42 bcl 20,4*cr7+so,40c <__kernel_gettimeofday+0x14>
40c: a6 02 a8 7c mflr r5
410: ff ff a5 3c addis r5,r5,-1
414: f4 fb a5 38 addi r5,r5,-1036
418: f0 00 a5 38 addi r5,r5,240
41c: 85 06 00 48 bl aa0 <__c_kernel_gettimeofday>
Fixes: ab037dd87a2f ("powerpc/vdso: Switch VDSO to generic C implementation.")
Reported-by: "Will Springer <skirmisher@protonmail.com>"
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/ppc_asm.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index cfa814824285..cc1bca571332 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -180,7 +180,12 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
#define VCPU_GPR(n) __VCPU_GPR(__REG_##n)
#ifdef __KERNEL__
-#ifdef CONFIG_PPC64
+
+/*
+ * We use __powerpc64__ here because we want the compat VDSO to use the 32-bit
+ * version below in the else case of the ifdef.
+ */
+#ifdef __powerpc64__
#define STACKFRAMESIZE 256
#define __STK_REG(i) (112 + ((i)-14)*8)
--
2.25.1
^ permalink raw reply related
* [PATCH 2/3] powerpc/vdso: Don't pass 64-bit ABI cflags to 32-bit VDSO
From: Michael Ellerman @ 2020-12-18 11:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: skirmisher
In-Reply-To: <20201218111619.1206391-1-mpe@ellerman.id.au>
When building the 32-bit VDSO, we are building 32-bit code as part of
a 64-bit kernel build. That requires us to tweak the cflags to trick
the compiler into building 32-bit code for us. The main way we do that
is by passing -m32, but there are other options that affect code
generation and ABI selection.
In particular when building vgettimeofday.c, we end up passing
-mcall-aixdesc because it's in KBUILD_CFLAGS, which causes the
compiler to generate function descriptors, and dot symbols, eg:
$ nm arch/powerpc/kernel/vdso32/vgettimeofday.o
000005d0 T .__c_kernel_clock_getres
00000024 D __c_kernel_clock_getres
...
We get away with that at the moment because we also use the DOTSYM
macro, and that is also incorrectly prepending a '.' in 32-bit VDSO
code due to a separate bug.
But we shouldn't be generating function descriptors for this file,
there's no 32-bit ABI that includes function descriptors, so the
resulting object file is some frankenstein and it's surprising that it
even links.
So filter out all the ABI-related options we add to CFLAGS for 64-bit
builds, so that they're not used when building 32-bit code. With that
we only see regular text symbols:
$ nm arch/powerpc/kernel/vdso32/vgettimeofday.o michael@alpine1-p1
000005d0 T __c_kernel_clock_getres
00000000 T __c_kernel_clock_gettime
00000200 T __c_kernel_clock_gettime64
00000410 T __c_kernel_gettimeofday
00000650 T __c_kernel_time
Fixes: ab037dd87a2f ("powerpc/vdso: Switch VDSO to generic C implementation.")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/vdso32/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 6616f4e794d0..9cb6f524854b 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -27,7 +27,7 @@ endif
CC32FLAGS :=
ifdef CONFIG_PPC64
CC32FLAGS += -m32
-KBUILD_CFLAGS := $(filter-out -mcmodel=medium,$(KBUILD_CFLAGS))
+KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS))
endif
targets := $(obj-vdso32) vdso32.so.dbg
--
2.25.1
^ permalink raw reply related
* [PATCH 1/3] powerpc/vdso: Block R_PPC_REL24 relocations
From: Michael Ellerman @ 2020-12-18 11:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: skirmisher
Add R_PPC_REL24 relocations to the list of relocations we do NOT
support in the VDSO.
These are generated in some cases and we do not support relocating
them at runtime, so if they appear then the VDSO will not work at
runtime, therefore it's preferable to break the build if we see them.
Fixes: ab037dd87a2f ("powerpc/vdso: Switch VDSO to generic C implementation.")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/vdso32/Makefile | 2 +-
arch/powerpc/kernel/vdso64/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 59aa2944ecae..6616f4e794d0 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -2,7 +2,7 @@
# List of files in the vdso, has to be asm only for now
-ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN
+ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24
include $(srctree)/lib/vdso/Makefile
obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index d365810a689a..bf363ff37152 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
# List of files in the vdso, has to be asm only for now
-ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN
+ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24
include $(srctree)/lib/vdso/Makefile
obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
--
2.25.1
^ permalink raw reply related
* [PATCH v2] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: Kajol Jain @ 2020-12-18 10:01 UTC (permalink / raw)
To: mpe, linuxppc-dev; +Cc: kjain, suka, maddy, atrajeev
hv_24x7 performance monitoring unit creates list of supported events
from the event catalog obtained via HCALL. hv_24x7 catalog could also
contain invalid or dummy events (with names like FREE_* or CPM_FREE_*
and RESERVED*). These events do not have any hardware counters
backing them. So patch adds a check to string compare the event names
to filter out them.
Result in power9 machine:
Before this patch:
.....
hv_24x7/PM_XLINK2_OUT_ODD_CYC,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_DATA_COUNT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_TOTAL_UTIL,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT_MISS,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_SENT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_TLBI_RCV,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST1,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST10,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST11,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST12,chip=?/ [Kernel PMU event]
hv_24x7/RESERVED_NEST13,chip=?/ [Kernel PMU event]
......
Dmesg:
[ 0.000362] printk: console [hvc0] enabled
[ 0.815452] hv-24x7: read 1530 catalog entries, created 537 event attrs
(0 failures), 275 descs
After this patch:
......
hv_24x7/PM_XLINK2_OUT_ODD_AVLBL_CYC,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_CYC,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_DATA_COUNT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XLINK2_OUT_ODD_TOTAL_UTIL,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATR_DEMAND_CHECKOUT_MISS,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_SENT,chip=?/ [Kernel PMU event]
hv_24x7/PM_XTS_ATSD_TLBI_RCV,chip=?/ [Kernel PMU event]
hv_24x7/TOD,chip=?/ [Kernel PMU event]
......
Demsg:
[ 0.000357] printk: console [hvc0] enabled
[ 0.808592] hv-24x7: read 1530 catalog entries, created 509 event attrs
(0 failures), 275 descs
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
arch/powerpc/perf/hv-24x7.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
Changelog
v1 -> v2
- Include "RESERVED*" as part of the invalid event check as
suggested by Madhavan Srinivasan
- Add new helper function "ignore_event" to check invalid/dummy
events as suggested by Michael Ellerman
- Remove pr_info to print each invalid event as suggested by
Michael Ellerman
---
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 6e7e820508df..1a6004d88f98 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -764,6 +764,16 @@ static ssize_t catalog_event_len_validate(struct hv_24x7_event_data *event,
return ev_len;
}
+/*
+ * Return true incase of invalid or dummy events with names like FREE_* or CPM_FREE_*
+ * and RESERVED*
+ */
+static bool ignore_event(const char *name)
+{
+ return (strstr(name, "FREE_") || !strncmp(name, "RESERVED", 8)) ?
+ true : false;
+}
+
#define MAX_4K (SIZE_MAX / 4096)
static int create_events_from_catalog(struct attribute ***events_,
@@ -894,6 +904,10 @@ static int create_events_from_catalog(struct attribute ***events_,
name = event_name(event, &nl);
+ if (ignore_event(name)) {
+ junk_events++;
+ continue;
+ }
if (event->event_group_record_len == 0) {
pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
event_idx, nl, name);
@@ -955,6 +969,9 @@ static int create_events_from_catalog(struct attribute ***events_,
continue;
name = event_name(event, &nl);
+ if (ignore_event(name))
+ continue;
+
nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
ct = event_data_to_attrs(event_idx, events + event_attr_ct,
event, nonce);
--
2.27.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox