Commit b69c3847 authored by John Levon's avatar John Levon Committed by Anton Blanchard

[PATCH] fix oprofile multiple counters

This ensures we deal properly with multiple perfctr overflow interrupts
under high load.
parent d48dde40
...@@ -95,17 +95,16 @@ static int athlon_check_ctrs(unsigned int const cpu, ...@@ -95,17 +95,16 @@ static int athlon_check_ctrs(unsigned int const cpu,
struct pt_regs * const regs) struct pt_regs * const regs)
{ {
unsigned int low, high; unsigned int low, high;
int handled = 0;
int i; int i;
for (i = 0 ; i < NUM_COUNTERS; ++i) { for (i = 0 ; i < NUM_COUNTERS; ++i) {
CTR_READ(low, high, msrs, i); CTR_READ(low, high, msrs, i);
if (CTR_OVERFLOWED(low)) { if (CTR_OVERFLOWED(low)) {
oprofile_add_sample(regs->eip, i, cpu); oprofile_add_sample(regs->eip, i, cpu);
CTR_WRITE(reset_value[i], msrs, i); CTR_WRITE(reset_value[i], msrs, i);
handled = 1; return 1;
} }
} }
return handled; return 0;
} }
......
...@@ -90,17 +90,16 @@ static int ppro_check_ctrs(unsigned int const cpu, ...@@ -90,17 +90,16 @@ static int ppro_check_ctrs(unsigned int const cpu,
{ {
unsigned int low, high; unsigned int low, high;
int i; int i;
int handled = 0;
for (i = 0 ; i < NUM_COUNTERS; ++i) { for (i = 0 ; i < NUM_COUNTERS; ++i) {
CTR_READ(low, high, msrs, i); CTR_READ(low, high, msrs, i);
if (CTR_OVERFLOWED(low)) { if (CTR_OVERFLOWED(low)) {
oprofile_add_sample(regs->eip, i, cpu); oprofile_add_sample(regs->eip, i, cpu);
CTR_WRITE(reset_value[i], msrs, i); CTR_WRITE(reset_value[i], msrs, i);
handled = 1; return 1;
} }
} }
return handled; return 0;
} }
......
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