Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147511
b: refs/heads/master
c: aaba980
h: refs/heads/master
i:
  147509: 45da29d
  147507: 35a29c3
  147503: 1ea3c8f
v: v3
  • Loading branch information
Ingo Molnar committed May 26, 2009
1 parent 04746e7 commit f0fc9db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79202ba9ff8cf570a75596f42e011167734d1c4b
refs/heads/master: aaba98018b8295dfa2119345d17f833d74448cd0
26 changes: 26 additions & 0 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,30 @@ static void intel_pmu_save_and_restart(struct perf_counter *counter)
intel_pmu_enable_counter(hwc, idx);
}

static void intel_pmu_reset(void)
{
unsigned long flags;
int idx;

if (!x86_pmu.num_counters)
return;

local_irq_save(flags);

printk("clearing PMU state on CPU#%d\n", smp_processor_id());

for (idx = 0; idx < x86_pmu.num_counters; idx++) {
checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
checking_wrmsrl(x86_pmu.perfctr + idx, 0ull);
}
for (idx = 0; idx < x86_pmu.num_counters_fixed; idx++) {
checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
}

local_irq_restore(flags);
}


/*
* This handler is triggered by the local APIC, so the APIC IRQ handling
* rules apply:
Expand All @@ -750,6 +774,8 @@ static int intel_pmu_handle_irq(struct pt_regs *regs, int nmi)
if (++loops > 100) {
WARN_ONCE(1, "perfcounters: irq loop stuck!\n");
perf_counter_print_debug();
intel_pmu_reset();
perf_enable();
return 1;
}

Expand Down

0 comments on commit f0fc9db

Please sign in to comment.