linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] powerpc: improve accounting of non maskable interrupts
@ 2017-08-01 12:00 Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 1/4] powerpc/64s: fix mce accounting for powernv Nicholas Piggin
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Nicholas Piggin @ 2017-08-01 12:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

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(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] powerpc/64s: fix mce accounting for powernv
  2017-08-01 12:00 [PATCH v2 0/4] powerpc: improve accounting of non maskable interrupts Nicholas Piggin
@ 2017-08-01 12:00 ` Nicholas Piggin
  2017-08-11 12:19   ` [v2,1/4] " Michael Ellerman
  2017-08-01 12:00 ` [PATCH v2 2/4] powerpc: Fix powerpc-specific watchdog build configuration Nicholas Piggin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Nicholas Piggin @ 2017-08-01 12:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

---
 arch/powerpc/kernel/traps.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index bfcfd9ef09f2..5adfea2dc822 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -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);
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] powerpc: Fix powerpc-specific watchdog build configuration
  2017-08-01 12:00 [PATCH v2 0/4] powerpc: improve accounting of non maskable interrupts Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 1/4] powerpc/64s: fix mce accounting for powernv Nicholas Piggin
@ 2017-08-01 12:00 ` Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 4/4] powerpc: add irq accounting for watchdog interrupts Nicholas Piggin
  3 siblings, 0 replies; 7+ messages in thread
From: Nicholas Piggin @ 2017-08-01 12:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

The 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.

Fixes: 2104180a53 ("powerpc/64s: implement arch-specific hardlockup watchdog")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Kconfig                 | 11 +++++++++++
 arch/powerpc/kernel/Makefile         |  2 +-
 arch/powerpc/kernel/exceptions-64s.S |  6 +++---
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 36f858c37ca7..2a5060aa1674 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -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
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 4aa7c147e447..5622bd0248e5 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -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
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 9029afd1fa2a..48aaca3e0b20 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -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:
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts
  2017-08-01 12:00 [PATCH v2 0/4] powerpc: improve accounting of non maskable interrupts Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 1/4] powerpc/64s: fix mce accounting for powernv Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 2/4] powerpc: Fix powerpc-specific watchdog build configuration Nicholas Piggin
@ 2017-08-01 12:00 ` Nicholas Piggin
  2017-08-02  2:00   ` Nicholas Piggin
  2017-08-01 12:00 ` [PATCH v2 4/4] powerpc: add irq accounting for watchdog interrupts Nicholas Piggin
  3 siblings, 1 reply; 7+ messages in thread
From: Nicholas Piggin @ 2017-08-01 12:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 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(+)

diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 8add8b861e8d..64b73b03d473 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -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
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 0bcec745a672..5c18335580b6 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -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
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 5adfea2dc822..6a892ca7bf18 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -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))
diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index b67f8b03a32d..4b9a567c9975 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] powerpc: add irq accounting for watchdog interrupts
  2017-08-01 12:00 [PATCH v2 0/4] powerpc: improve accounting of non maskable interrupts Nicholas Piggin
                   ` (2 preceding siblings ...)
  2017-08-01 12:00 ` [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts Nicholas Piggin
@ 2017-08-01 12:00 ` Nicholas Piggin
  3 siblings, 0 replies; 7+ messages in thread
From: Nicholas Piggin @ 2017-08-01 12:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

This 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.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/include/asm/hardirq.h |  3 +++
 arch/powerpc/kernel/irq.c          | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 64b73b03d473..c97603d617e3 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -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
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5c18335580b6..77a7f7514327 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -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
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts
  2017-08-01 12:00 ` [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts Nicholas Piggin
@ 2017-08-02  2:00   ` Nicholas Piggin
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas Piggin @ 2017-08-02  2:00 UTC (permalink / raw)
  To: linuxppc-dev

On Tue,  1 Aug 2017 22:00:53 +1000
Nicholas Piggin <npiggin@gmail.com> wrote:

> diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
> index b67f8b03a32d..4b9a567c9975 100644
> --- a/arch/powerpc/kernel/watchdog.c
> +++ b/arch/powerpc/kernel/watchdog.c
> @@ -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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v2,1/4] powerpc/64s: fix mce accounting for powernv
  2017-08-01 12:00 ` [PATCH v2 1/4] powerpc/64s: fix mce accounting for powernv Nicholas Piggin
@ 2017-08-11 12:19   ` Michael Ellerman
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2017-08-11 12:19 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

On Tue, 2017-08-01 at 12:00:51 UTC, Nicholas Piggin wrote:
> ---
>  arch/powerpc/kernel/traps.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index bfcfd9ef09f2..5adfea2dc822 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -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);
>  

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f886f0f6e0e20d53dc36421c2ee83f

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-11 12:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01 12:00 [PATCH v2 0/4] powerpc: improve accounting of non maskable interrupts Nicholas Piggin
2017-08-01 12:00 ` [PATCH v2 1/4] powerpc/64s: fix mce accounting for powernv Nicholas Piggin
2017-08-11 12:19   ` [v2,1/4] " Michael Ellerman
2017-08-01 12:00 ` [PATCH v2 2/4] powerpc: Fix powerpc-specific watchdog build configuration Nicholas Piggin
2017-08-01 12:00 ` [PATCH v2 3/4] powerpc: add irq accounting for system reset interrupts Nicholas Piggin
2017-08-02  2:00   ` Nicholas Piggin
2017-08-01 12:00 ` [PATCH v2 4/4] powerpc: add irq accounting for watchdog interrupts Nicholas Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).