Commit c8e5910e authored by Robert Richter's avatar Robert Richter Committed by Ingo Molnar

perf, x86: Use ALTERNATIVE() to check for X86_FEATURE_PERFCTR_CORE

Using ALTERNATIVE() when checking for X86_FEATURE_PERFCTR_CORE avoids
an extra pointer chase and data cache hit.
Signed-off-by: default avatarRobert Richter <>
Signed-off-by: default avatarPeter Zijlstra <>
Link: default avatarIngo Molnar <>
parent 68d2cf25
......@@ -31,6 +31,7 @@
#include <asm/nmi.h>
#include <asm/compat.h>
#include <asm/smp.h>
#include <asm/alternative.h>
#if 0
#undef wrmsrl
......@@ -363,12 +364,18 @@ x86_perf_event_update(struct perf_event *event)
return new_raw_count;
/* using X86_FEATURE_PERFCTR_CORE to later implement ALTERNATIVE() here */
static inline int x86_pmu_addr_offset(int index)
if (boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
return index << 1;
return index;
int offset;
/* offset = X86_FEATURE_PERFCTR_CORE ? index << 1 : index */
"shll $1, %%eax",
"=a" (offset),
"a" (index));
return offset;
static inline unsigned int x86_pmu_config_addr(int index)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment