2009-06-12 08:25:46

by Yong Wang

[permalink] [raw]
Subject: [PATCH -tip] perf_counter/x86: Add a quirk for Atom processors

The fixed-function performance counters do not work on current Atom
processors. Use the general-purpose ones instead.

Signed-off-by: Yong Wang <[email protected]>

---
perf_counter.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 895c82e..4bba0d8 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -968,6 +968,12 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
if (!x86_pmu.num_counters_fixed)
return -1;

+ /*
+ * Quirk: IA32_FIXED_CTRs do not work on current Atom processors
+ */
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && boot_cpu_data.x86_model == 28)
+ return -1;
+
event = hwc->config & ARCH_PERFMON_EVENT_MASK;

if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))


2009-06-12 11:50:07

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] perf_counter/x86: Add a quirk for Atom processors


* Yong Wang <[email protected]> wrote:

> The fixed-function performance counters do not work on current
> Atom processors. Use the general-purpose ones instead.

ah, nice - applied to tip:perfcounters/core, thanks!

Does this make your Atom testbox work fine now?

Ingo

2009-06-12 11:52:20

by Yong Wang

[permalink] [raw]
Subject: [tip:perfcounters/core] perf_counter/x86: Add a quirk for Atom processors

Commit-ID: dff5da6d09daaab40a8741dce0ed3c2e94079de2
Gitweb: http://git.kernel.org/tip/dff5da6d09daaab40a8741dce0ed3c2e94079de2
Author: Yong Wang <[email protected]>
AuthorDate: Fri, 12 Jun 2009 16:08:55 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 12 Jun 2009 13:48:32 +0200

perf_counter/x86: Add a quirk for Atom processors

The fixed-function performance counters do not work on current Atom
processors. Use the general-purpose ones instead.

Signed-off-by: Yong Wang <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>


---
arch/x86/kernel/cpu/perf_counter.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 895c82e..275bc14 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -968,6 +968,13 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
if (!x86_pmu.num_counters_fixed)
return -1;

+ /*
+ * Quirk, IA32_FIXED_CTRs do not work on current Atom processors:
+ */
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+ boot_cpu_data.x86_model == 28)
+ return -1;
+
event = hwc->config & ARCH_PERFMON_EVENT_MASK;

if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))

2009-06-12 13:49:37

by Yong Wang

[permalink] [raw]
Subject: Re: [PATCH -tip] perf_counter/x86: Add a quirk for Atom processors

On Fri, Jun 12, 2009 at 01:49:48PM +0200, Ingo Molnar wrote:
>
> * Yong Wang <[email protected]> wrote:
>
> > The fixed-function performance counters do not work on current
> > Atom processors. Use the general-purpose ones instead.
>
> ah, nice - applied to tip:perfcounters/core, thanks!
>
> Does this make your Atom testbox work fine now?
>

Yup, I tested the patch before I submitted it. It works fine now;-)
I will also keep an eye on future Atom processors to see whether fixed
function PMCs work or not.

Thanks
-Yong