fix oprofile on x86 > 1 counter
PATCH 1/1 fix oprofile on x86 > 1 counter
See the comment below, without this we have a choice between dropping lots of counter events for counters > 0, or getting dazed and confused. This brings it inline with the 2.4 module code. Tested on my 2-way.
Also fix a typo from Steven Cole, and remove some unnecessary code
please apply,
john
arch/alpha/oprofile/op_model_ev4.c +1 -1
@@ -34,7 +34,7 @@for these "disabled" counter overflows are ignored by the interrupt handler. -This is most irritating, becuase the hardware *can* enable and +This is most irritating, because the hardware *can* enable and disable the interrupts for these counters independently, but the wrperfmon interface doesn't allow it. */
arch/i386/oprofile/op_model_athlon.c +3 -2
@@ -104,10 +104,11 @@if (CTR_OVERFLOWED (low)) {oprofile_add_sample (eip, is_kernel, i, cpu);CTR_WRITE (reset_value[i], msrs, i); -return 1 ; } } -return 0 ; + +/* See op_model_ppro.c */ +return 1 ; }
arch/i386/oprofile/op_model_p4.c +3 -2
@@ -608,13 +608,14 @@CTR_WRITE (reset_value[i], real);/* P4 quirk: you have to re-unmask the apic vector */ apic_write (APIC_LVTPC ,apic_read (APIC_LVTPC ) & ~APIC_LVT_MASKED ); -return 1 ; } }/* P4 quirk: you have to re-unmask the apic vector */ apic_write (APIC_LVTPC ,apic_read (APIC_LVTPC ) & ~APIC_LVT_MASKED ); -return 0 ; + +/* See op_model_ppro.c */ +return 1 ; }
arch/i386/oprofile/op_model_ppro.c +9 -2
@@ -98,10 +98,17 @@if (CTR_OVERFLOWED (low)) {oprofile_add_sample (eip, is_kernel, i, cpu);CTR_WRITE (reset_value[i], msrs, i); -return 1 ; } } -return 0 ; + +/* We can't work out if we really handled an interrupt. We +* might have caught a *second* counter just after overflowing +* the interrupt for this counter then arrives +* and we don't find a counter that's overflowed, so we +* would return 0 and get dazed + confused. Instead we always +* assume we found an overflow. This sucks. +*/ +return 1 ; }
drivers/oprofile/cpu_buffer.c +0 -3
@@ -85,9 +85,6 @@unsigned long head = b->head_pos;unsigned long tail = b->tail_pos; -if (tail == head) -return b->buffer_size; -if (tail > head)return tail - head;