[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328616532-13783-1-git-send-email-bp@alien8.de>
Date: Tue, 7 Feb 2012 13:08:52 +0100
From: Borislav Petkov <bp@...en8.de>
To: Ingo Molnar <mingo@...e.hu>
Cc: Borislav Petkov <bp@...64.org>, Venki Pallipadi <venki@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...radead.org>,
Robert Richter <robert.richter@....com>,
Eric Dumazet <eric.dumazet@...il.com>,
Andreas Herrmann <andreas.herrmann3@....com>,
Borislav Petkov <bp@...en8.de>
Subject: [PATCH] x86, AMD: Set sched_clock_stable
Stephane Eranian reported that doing a scheduler latency measurements
with perf on AMD doesn't work out as expected due to the fact that the
sched_clock() granularity is too coarse, i.e. done in jiffies due to the
sched_clock_stable not set, which, if set, would mean that we get to use
the TSC as sample source which would give us much higher precision.
However, there's no reason not to set sched_clock_stable on AMD because
all families from F10h and upwards do have an invariant TSC and have the
CPUID flag to prove (CPUID_8000_0007_EDX[8]).
Make it so, #1.
Signed-off-by: Borislav Petkov <bp@...en8.de>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...e.hu>
Link: http://lkml.kernel.org/r/20120206132546.GA30854@quad
---
arch/x86/kernel/cpu/amd.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f4773f4..0a44b90 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -5,6 +5,7 @@
#include <linux/mm.h>
#include <linux/io.h>
+#include <linux/sched.h>
#include <asm/processor.h>
#include <asm/apic.h>
#include <asm/cpu.h>
@@ -456,6 +457,8 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
if (c->x86_power & (1 << 8)) {
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
+ if (!check_tsc_unstable())
+ sched_clock_stable = 1;
}
#ifdef CONFIG_X86_64
--
1.7.9
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists