* [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64
@ 2015-04-09 2:52 Anton Blanchard
2015-04-09 2:52 ` [PATCH 2/2] powerpc: Add ppc64 hard lockup detector support Anton Blanchard
2015-04-09 5:43 ` [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64 Robert Richter
0 siblings, 2 replies; 4+ messages in thread
From: Anton Blanchard @ 2015-04-09 2:52 UTC (permalink / raw)
To: benh, paulus, mpe, rric; +Cc: linuxppc-dev, oprofile-list
We want to enable the hard lockup detector on ppc64, but right now
that enables the oprofile NMI timer too.
We'd prefer not to enable the oprofile NMI timer, it adds another
element to our PMU testing and it requires us to increase our
exported symbols (eg cpu_khz).
Modify the config entry for OPROFILE_NMI_TIMER to disable it on PPC64.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
arch/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 05d7a8a..0cc605d 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -32,7 +32,7 @@ config HAVE_OPROFILE
config OPROFILE_NMI_TIMER
def_bool y
- depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI
+ depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !PPC64
config KPROBES
bool "Kprobes"
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] powerpc: Add ppc64 hard lockup detector support
2015-04-09 2:52 [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64 Anton Blanchard
@ 2015-04-09 2:52 ` Anton Blanchard
2015-04-09 23:48 ` Scott Wood
2015-04-09 5:43 ` [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64 Robert Richter
1 sibling, 1 reply; 4+ messages in thread
From: Anton Blanchard @ 2015-04-09 2:52 UTC (permalink / raw)
To: benh, paulus, mpe, rric; +Cc: linuxppc-dev, oprofile-list
The hard lockup detector uses a PMU event as a periodic NMI to
detect if we are stuck (where stuck means no timer interrupts have
occurred).
Ben's rework of the ppc64 soft disable code has made ppc64 PMU
exceptions a partial NMI. They can get disabled if an external
interrupt comes in, but otherwise PMU interrupts will fire in
interrupt disabled regions.
We disable the hard lockup detector by default for a few reasons:
- It breaks userspace event based branches on POWER8.
- It is likely to produce false positives on KVM guests.
- Since PMCs can only count to 2^31, counting cycles means we might
take multiple PMU exceptions per second per hardware thread even
if our hard lockup timeout is 10 seconds.
It can be enabled via a boot option, or via procfs.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/nmi.h | 4 ++++
arch/powerpc/kernel/setup_64.c | 20 ++++++++++++++++++++
3 files changed, 25 insertions(+)
create mode 100644 arch/powerpc/include/asm/nmi.h
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c102668..716c9e6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -152,6 +152,7 @@ config PPC
select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
select NO_BOOTMEM
select HAVE_GENERIC_RCU_GUP
+ select HAVE_PERF_EVENTS_NMI if PPC64
config GENERIC_CSUM
def_bool CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/include/asm/nmi.h b/arch/powerpc/include/asm/nmi.h
new file mode 100644
index 0000000..ff1ccb3
--- /dev/null
+++ b/arch/powerpc/include/asm/nmi.h
@@ -0,0 +1,4 @@
+#ifndef _ASM_NMI_H
+#define _ASM_NMI_H
+
+#endif /* _ASM_NMI_H */
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 300be7d..ae39ec6 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -37,6 +37,7 @@
#include <linux/memblock.h>
#include <linux/hugetlb.h>
#include <linux/memory.h>
+#include <linux/nmi.h>
#include <asm/io.h>
#include <asm/kdump.h>
@@ -779,3 +780,22 @@ unsigned long memory_block_size_bytes(void)
struct ppc_pci_io ppc_pci_io;
EXPORT_SYMBOL(ppc_pci_io);
#endif
+
+#ifdef CONFIG_HARDLOCKUP_DETECTOR
+u64 hw_nmi_get_sample_period(int watchdog_thresh)
+{
+ return ppc_proc_freq * watchdog_thresh;
+}
+
+/*
+ * The hardlockup detector breaks PMU event based branches and is likely
+ * to get false positives in KVM guests, so disable it by default.
+ */
+static int __init disable_hardlockup_detector(void)
+{
+ watchdog_enable_hardlockup_detector(false);
+
+ return 0;
+}
+early_initcall(disable_hardlockup_detector);
+#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64
2015-04-09 2:52 [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64 Anton Blanchard
2015-04-09 2:52 ` [PATCH 2/2] powerpc: Add ppc64 hard lockup detector support Anton Blanchard
@ 2015-04-09 5:43 ` Robert Richter
1 sibling, 0 replies; 4+ messages in thread
From: Robert Richter @ 2015-04-09 5:43 UTC (permalink / raw)
To: Anton Blanchard; +Cc: oprofile-list, paulus, linuxppc-dev
On 09.04.15 12:52:55, Anton Blanchard wrote:
> We want to enable the hard lockup detector on ppc64, but right now
> that enables the oprofile NMI timer too.
>
> We'd prefer not to enable the oprofile NMI timer, it adds another
> element to our PMU testing and it requires us to increase our
> exported symbols (eg cpu_khz).
>
> Modify the config entry for OPROFILE_NMI_TIMER to disable it on PPC64.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Robert Richter <rric@kernel.org>
Please pass this patch along with patch 2 of this series (ppc tree or
so).
Thanks,
-Robert
> ---
> arch/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 05d7a8a..0cc605d 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -32,7 +32,7 @@ config HAVE_OPROFILE
>
> config OPROFILE_NMI_TIMER
> def_bool y
> - depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI
> + depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !PPC64
>
> config KPROBES
> bool "Kprobes"
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] powerpc: Add ppc64 hard lockup detector support
2015-04-09 2:52 ` [PATCH 2/2] powerpc: Add ppc64 hard lockup detector support Anton Blanchard
@ 2015-04-09 23:48 ` Scott Wood
0 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2015-04-09 23:48 UTC (permalink / raw)
To: Anton Blanchard; +Cc: rric, oprofile-list, paulus, linuxppc-dev
On Thu, 2015-04-09 at 12:52 +1000, Anton Blanchard wrote:
> The hard lockup detector uses a PMU event as a periodic NMI to
> detect if we are stuck (where stuck means no timer interrupts have
> occurred).
>
> Ben's rework of the ppc64 soft disable code has made ppc64 PMU
> exceptions a partial NMI. They can get disabled if an external
> interrupt comes in, but otherwise PMU interrupts will fire in
> interrupt disabled regions.
>
> We disable the hard lockup detector by default for a few reasons:
>
> - It breaks userspace event based branches on POWER8.
> - It is likely to produce false positives on KVM guests.
What causes the false positives with KVM? I'm wondering if it makes
sense to enable this by default for book3e.
> - Since PMCs can only count to 2^31, counting cycles means we might
> take multiple PMU exceptions per second per hardware thread even
> if our hard lockup timeout is 10 seconds.
It'd be nice if this could be used with some event other than
PERF_COUNT_HW_CPU_CYCLES, such as something based on the timebase -- or
using the actual watchdog on book3e which would not consume a perf
counter and would be a full NMI as long as MSR[CE] is left on.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-09 23:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-09 2:52 [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64 Anton Blanchard
2015-04-09 2:52 ` [PATCH 2/2] powerpc: Add ppc64 hard lockup detector support Anton Blanchard
2015-04-09 23:48 ` Scott Wood
2015-04-09 5:43 ` [PATCH 1/2] oprofile: Disable oprofile NMI timer on ppc64 Robert Richter
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).