mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-30 02:21:15 +00:00
perf/x86/intel: Avoid rewriting DEBUGCTL with the same value for LBRs
perf with LBRs on has a tendency to rewrite the DEBUGCTL MSR with the same value. Add a little optimization to skip the unnecessary write. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: eranian@google.com Link: http://lkml.kernel.org/r/1426871484-21285-2-git-send-email-andi@firstfloor.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
1a78d93750
commit
cd1f11de69
1 changed files with 4 additions and 2 deletions
|
@ -135,7 +135,7 @@ static void intel_pmu_lbr_filter(struct cpu_hw_events *cpuc);
|
||||||
static void __intel_pmu_lbr_enable(bool pmi)
|
static void __intel_pmu_lbr_enable(bool pmi)
|
||||||
{
|
{
|
||||||
struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
|
struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
|
||||||
u64 debugctl, lbr_select = 0;
|
u64 debugctl, lbr_select = 0, orig_debugctl;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to reprogram LBR_SELECT in a PMI, as it
|
* No need to reprogram LBR_SELECT in a PMI, as it
|
||||||
|
@ -147,6 +147,7 @@ static void __intel_pmu_lbr_enable(bool pmi)
|
||||||
}
|
}
|
||||||
|
|
||||||
rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
|
rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
|
||||||
|
orig_debugctl = debugctl;
|
||||||
debugctl |= DEBUGCTLMSR_LBR;
|
debugctl |= DEBUGCTLMSR_LBR;
|
||||||
/*
|
/*
|
||||||
* LBR callstack does not work well with FREEZE_LBRS_ON_PMI.
|
* LBR callstack does not work well with FREEZE_LBRS_ON_PMI.
|
||||||
|
@ -155,7 +156,8 @@ static void __intel_pmu_lbr_enable(bool pmi)
|
||||||
*/
|
*/
|
||||||
if (!(lbr_select & LBR_CALL_STACK))
|
if (!(lbr_select & LBR_CALL_STACK))
|
||||||
debugctl |= DEBUGCTLMSR_FREEZE_LBRS_ON_PMI;
|
debugctl |= DEBUGCTLMSR_FREEZE_LBRS_ON_PMI;
|
||||||
wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
|
if (orig_debugctl != debugctl)
|
||||||
|
wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __intel_pmu_lbr_disable(void)
|
static void __intel_pmu_lbr_disable(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue