]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86/intel: Support full width counting
authorAndi Kleen <ak@linux.intel.com>
Tue, 25 Jun 2013 15:12:33 +0000 (08:12 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 26 Jun 2013 09:59:25 +0000 (11:59 +0200)
commitd4e31eab129f048ce4eac30170c0435ad16b8819
tree7fa205dc1bfa0ba7cbb8c421b7b9d10741b655a6
parent8c4f5d8cb116c4416daece1657ee779ebebfd2a4
perf/x86/intel: Support full width counting

Recent Intel CPUs like Haswell and IvyBridge have a new
alternative MSR range for perfctrs that allows writing the full
counter width. Enable this range if the hardware reports it
using a new capability bit.

Currently the perf code queries CPUID to get the counter width,
and sign extends the counter values as needed. The traditional
PERFCTR MSRs always limit to 32bit, even though the counter
internally is larger (usually 48 bits on recent CPUs)

When the new capability is set use the alternative range which
do not have these restrictions.

This lowers the overhead of perf stat slightly because it has to
do less interrupts to accumulate the counter value. On Haswell
it also avoids some problems with TSX aborting when the end of
the counter range is reached.

( See the patch "perf/x86/intel: Avoid checkpointed counters
  causing excessive TSX aborts" for more details. )

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1372173153-20215-1-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/uapi/asm/msr-index.h
arch/x86/kernel/cpu/perf_event.h
arch/x86/kernel/cpu/perf_event_intel.c