[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1465421807-2450-1-git-send-email-andi@firstfloor.org>
Date: Wed, 8 Jun 2016 14:36:46 -0700
From: Andi Kleen <andi@...stfloor.org>
To: peterz@...radead.org
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 1/2] Switch NMI watchdog to ref cycles on x86
From: Andi Kleen <ak@...ux.intel.com>
The NMI watchdog uses either the fixed cycles or a generic cycles
counter. This causes a lot of conflicts with users of the PMU who want
to run a full group including the cycles fixed counter, for example
the --topdown support recently added to perf stat. The code needs to
fall back to not use groups, which can cause measurement inaccuracy
due to multiplexing errors.
This patch switches the NMI watchdog to use reference cycles
on Intel systems. This is actually more accurate than cycles,
because cycles can tick faster than the measured CPU Frequency
due to Turbo mode.
The ref cycles always tick at their frequency, or slower when
the system is idling. That means the NMI watchdog can never
expire too early, unlike with cycles.
The reference cycles tick roughly at the frequency of the TSC,
so the same period computation can be used.
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
arch/x86/kernel/apic/hw_nmi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index c546aac36ee7..016f4263fad4 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -18,6 +18,7 @@
#include <linux/nmi.h>
#include <linux/module.h>
#include <linux/delay.h>
+#include <linux/perf_event.h>
#ifdef CONFIG_HARDLOCKUP_DETECTOR
int hw_nmi_get_event(void)
--
2.5.5
Powered by blists - more mailing lists