powerpc: improve accounting of non maskable interrupts
Nicholas Piggin
reviewerv2 cover powerpc: improve accounting of non maskable interrupts
This is the same as the last patch, but broken out and in the process of making ifdefs nicer, also found and fixed a watchdog build bug in patch 2.
Patches 1-2 are fixes that should go to 4.13.
Patches 3-4 are probably simple enough they could also go to 4.13.
Nicholas Piggin (4):
powerpc/64s: fix mce accounting for powernv
powerpc: fix powerpc-specific watchdog build configuration
powerpc: add irq accounting for system reset interrupts
powerpc: add irq accounting for watchdog interrupts
arch/powerpc/Kconfig | 11 +++++++++++ arch/powerpc/include/asm/hardirq.h | 4 ++++ arch/powerpc/kernel/Makefile | 2 +- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- arch/powerpc/kernel/irq.c | 16 ++++++++++++++++ arch/powerpc/kernel/traps.c | 9 +++++++++ arch/powerpc/kernel/watchdog.c | 3 +++ 7 files changed, 47 insertions(+), 4 deletions(-)
Signature · 1 line
2.11.0
Nicholas Piggin
reviewerPATCH v2 1/4 powerpc/64s: fix mce accounting for powernv
--- arch/powerpc/kernel/traps.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kernel/traps.c +7 -0
@@ -755,7 +755,14 @@ void machine_check_exception(struct pt_regs *regs)enum ctx_state prev_state =exception_enter ();int recover =0 ; +#ifdef CONFIG_PPC_BOOK3S_64 +/* 64s accounts the mce in machine_check_early when in HVMODE */ +if (!cpu_has_feature (CPU_FTR_HVMODE )) +__this_cpu_inc (irq_stat.mce_exceptions); +#else __this_cpu_inc (irq_stat.mce_exceptions); +#endif +add_taint (TAINT_MACHINE_CHECK ,LOCKDEP_NOW_UNRELIABLE );
Signature · 1 line
2.11.0
Re: [v2,1/4] powerpc/64s: fix mce accounting for powernv
Quoted 13 lines · Nicholas Piggin
--- arch/powerpc/kernel/traps.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/powerpc/kernel/traps.c +1
-0@@ -755,7 +755,14 @@ void machine_check_exception(struct pt_regs *regs)enum ctx_state prev_state =exception_enter ();int recover =0 ; +#ifdef CONFIG_PPC_BOOK3S_64
arch/powerpc/kernel/traps.c void machine_check_exception(struct pt_regs *regs) · line 768
Quoted 10 lines
arch/powerpc/kernel/traps.c +6
-0+/* 64s accounts the mce in machine_check_early when in HVMODE */ +if (!cpu_has_feature (CPU_FTR_HVMODE )) +__this_cpu_inc (irq_stat.mce_exceptions); +#else __this_cpu_inc (irq_stat.mce_exceptions); +#endif +add_taint (TAINT_MACHINE_CHECK ,LOCKDEP_NOW_UNRELIABLE );
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/f886f0f6e0e20d53dc36421c2ee83f
cheers
Nicholas Piggin
reviewerPATCH v2 2/4 powerpc: Fix powerpc-specific watchdog build configuration
In reply to Nicholas PigginThe powerpc kernel/watchdog.o should be built when HARDLOCKUP_DETECTOR and HAVE_HARDLOCKUP_DETECTOR_ARCH are both selected. If only the former is selected, then the generic perf watchdog has been selected.
To simplify this check, introduce a new Kconfig symbol PPC_WATCHDOG that depends on both. This Kconfig option means the powerpc specific watchdog is enabled.
Without this patch, Book3E will attempt to build the powerpc watchdog.
--- arch/powerpc/Kconfig | 11 +++++++++++ arch/powerpc/kernel/Makefile | 2 +- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- 3 files changed, 15 insertions(+), 4 deletions(-)
arch/powerpc/Kconfig +11 -0
@@ -85,6 +85,17 @@ config NMI_IPI depends on SMP && (DEBUGGER || KEXEC_CORE || HARDLOCKUP_DETECTOR) default y +config PPC_WATCHDOG + bool + depends on HARDLOCKUP_DETECTOR + depends on HAVE_HARDLOCKUP_DETECTOR_ARCH + default y + help + This is a placeholder when the powerpc hardlockup detector + watchdog is selected (arch/powerpc/kernel/watchdog.c). It is + seleted via the generic lockup detector menu which is why we + have no standalone config option for it here. + config STACKTRACE_SUPPORT bool default y
arch/powerpc/kernel/Makefile +1 -1
@@ -38,7 +38,7 @@ obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ signal_64.o ptrace32.o \ paca.o nvram_64.o firmware.o obj-$(CONFIG_VDSO32) += vdso32/ -obj-$(CONFIG_HARDLOCKUP_DETECTOR) += watchdog.o +obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
arch/powerpc/kernel/exceptions-64s.S +3 -3
@@ -1314,7 +1314,7 @@ EXC_REAL_NONE(0x1800, 0x100) EXC_VIRT_NONE(0x5800, 0x100) #endif -#if defined(CONFIG_HARDLOCKUP_DETECTOR) && defined(CONFIG_HAVE_HARDLOCKUP_DETECTOR_ARCH) +#ifdef CONFIG_PPC_WATCHDOG #define MASKED_DEC_HANDLER_LABEL 3f
@@ -1335,10 +1335,10 @@ EXC_COMMON_BEGIN(soft_nmi_common) ADD_NVGPRS;ADD_RECONCILE) b ret_from_except -#else +#else /* CONFIG_PPC_WATCHDOG */ #define MASKED_DEC_HANDLER_LABEL 2f /* normal return */ #define MASKED_DEC_HANDLER(_H) -#endif +#endif /* CONFIG_PPC_WATCHDOG */ /* * An interrupt came in while soft-disabled. We set paca->irq_happened, then:
Signature · 1 line
2.11.0
Nicholas Piggin
reviewerPATCH v2 3/4 powerpc: add irq accounting for system reset interrupts
In reply to Nicholas Piggin--- arch/powerpc/include/asm/hardirq.h | 1 + arch/powerpc/kernel/irq.c | 6 ++++++ arch/powerpc/kernel/traps.c | 2 ++ arch/powerpc/kernel/watchdog.c | 3 +++ 4 files changed, 12 insertions(+)
arch/powerpc/include/asm/hardirq.h +1 -0
@@ -12,6 +12,7 @@ typedef struct {unsigned int mce_exceptions;unsigned int spurious_irqs;unsigned int hmi_exceptions; +unsigned int sreset_irqs;#ifdef CONFIG_PPC_DOORBELL unsigned int doorbell_irqs;#endif
arch/powerpc/kernel/irq.c +6 -0
@@ -470,6 +470,11 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p," Hypervisor Maintenance Interrupts\n" ); } +seq_printf (p,"%*s: " , prec,"NMI" ); +for_each_online_cpu (j) +seq_printf (p,"%10u " ,per_cpu (irq_stat, j).sreset_irqs); +seq_printf (p," System Reset interrupts\n" ); +#ifdef CONFIG_PPC_DOORBELL if (cpu_has_feature (CPU_FTR_DBELL )) {seq_printf (p,"%*s: " , prec,"DBL" );
@@ -494,6 +499,7 @@ u64 arch_irq_stat_cpu(unsigned int cpu) sum +=per_cpu (irq_stat, cpu).spurious_irqs; sum +=per_cpu (irq_stat, cpu).timer_irqs_others; sum +=per_cpu (irq_stat, cpu).hmi_exceptions; + sum +=per_cpu (irq_stat, cpu).sreset_irqs;#ifdef CONFIG_PPC_DOORBELL sum +=per_cpu (irq_stat, cpu).doorbell_irqs;#endif
arch/powerpc/kernel/traps.c +2 -0
@@ -288,6 +288,8 @@ void system_reset_exception(struct pt_regs *regs)if (!nested)nmi_enter (); +__this_cpu_inc (irq_stat.sreset_irqs); +/* See if any machine dependent calls */ if (ppc_md.system_reset_exception) {if (ppc_md.system_reset_exception (regs))
arch/powerpc/kernel/watchdog.c +3 -0
@@ -204,6 +204,9 @@ void soft_nmi_interrupt(struct pt_regs *regs)return ;nmi_enter (); + +__this_cpu_inc (irq_stat.soft_nmi_irqs); + tb =get_tb ();if (tb -per_cpu (wd_timer_tb, cpu) >= wd_panic_timeout_tb) {per_cpu (wd_timer_tb, cpu) = tb;
Signature · 1 line
2.11.0
Nicholas Piggin
reviewerRe: [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts
Quoted 5 lines · On Tue, 1 Aug 2017 22:00:53 +1000 Nicholas Piggin <[email protected]> wrote:
arch/powerpc/kernel/watchdog.c +0
-0
arch/powerpc/kernel/watchdog.c void soft_nmi_interrupt(struct pt_regs *regs) · line 212
Quoted 9 lines
arch/powerpc/kernel/watchdog.c +3
-0@@ -204,6 +204,9 @@ void soft_nmi_interrupt(struct pt_regs *regs)return ;nmi_enter (); + +__this_cpu_inc (irq_stat.soft_nmi_irqs); + tb =get_tb ();if (tb -per_cpu (wd_timer_tb, cpu) >= wd_panic_timeout_tb) {per_cpu (wd_timer_tb, cpu) = tb;
Sorry, this hunk leaked into patch 3. Should be in patch 4.
Nicholas Piggin
reviewerPATCH v2 4/4 powerpc: add irq accounting for watchdog interrupts
In reply to Nicholas PigginThis adds an irq counter for the watchdog soft-NMI. This interrupt only fires when interrupts are soft-disabled, so it will not increment much even when the watchdog is running. However it's useful for debugging and sanity checking.
--- arch/powerpc/include/asm/hardirq.h | 3 +++ arch/powerpc/kernel/irq.c | 10 ++++++++++ 2 files changed, 13 insertions(+)
arch/powerpc/include/asm/hardirq.h +3 -0
@@ -13,6 +13,9 @@ typedef struct {unsigned int spurious_irqs;unsigned int hmi_exceptions;unsigned int sreset_irqs; +#ifdef CONFIG_PPC_WATCHDOG +unsigned int soft_nmi_irqs; +#endif #ifdef CONFIG_PPC_DOORBELL unsigned int doorbell_irqs;#endif
arch/powerpc/kernel/irq.c +10 -0
@@ -475,6 +475,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p,"%10u " ,per_cpu (irq_stat, j).sreset_irqs);seq_printf (p," System Reset interrupts\n" ); +#ifdef CONFIG_PPC_WATCHDOG +seq_printf (p,"%*s: " , prec,"WDG" ); +for_each_online_cpu (j) +seq_printf (p,"%10u " ,per_cpu (irq_stat, j).soft_nmi_irqs); +seq_printf (p," Watchdog soft-NMI interrupts\n" ); +#endif +#ifdef CONFIG_PPC_DOORBELL if (cpu_has_feature (CPU_FTR_DBELL )) {seq_printf (p,"%*s: " , prec,"DBL" );
@@ -500,6 +507,9 @@ u64 arch_irq_stat_cpu(unsigned int cpu) sum +=per_cpu (irq_stat, cpu).timer_irqs_others; sum +=per_cpu (irq_stat, cpu).hmi_exceptions; sum +=per_cpu (irq_stat, cpu).sreset_irqs; +#ifdef CONFIG_PPC_WATCHDOG + sum +=per_cpu (irq_stat, cpu).soft_nmi_irqs; +#endif #ifdef CONFIG_PPC_DOORBELL sum +=per_cpu (irq_stat, cpu).doorbell_irqs;#endif
Signature · 1 line
2.11.0