Re: [tip:perf/urgent] perf, x86: Catch spurious interrupts afterdisabling counters
From: Stephane Eranian
Date: Wed Sep 29 2010 - 11:33:16 EST
Robert,
There is something else bothering me with cpuc->running.
It is not reset outside of the interrupt handler. So what if
event scheduling shuffles things around and an event is
moved somewhere else. Don't you need to clear the
cpuc->running[idx] for the old counter index?
On Wed, Sep 29, 2010 at 5:27 PM, Cyrill Gorcunov <gorcunov@xxxxxxxxx> wrote:
> On Wed, Sep 29, 2010 at 05:12:53PM +0200, Robert Richter wrote:
>> On 29.09.10 17:01:40, Robert Richter wrote:
>> > Right, I wasn't remembering correctly, it was P6 and core. And yes, P4
>> > requires the fix. Will send a patch for this.
>>
>> Ok, Cyrill is sending the patch.
>>
>> Thanks,
>>
>> -Robert
>>
>
> Managed to implement it earlier then I thought.
>
> ÂCyrill
> ---
> Subject: [PATCH -tip] perf, x86: Handle in flight IRQs on P4 platform
>
> Stephane reported we've missed to guard P4 platform
> against spurious in-flight performance IRQs. Fix it.
>
> [ the patch is a complement to commit 63e6be6d98e1 ]
>
> Reported-by: Stephane Eranian <eranian@xxxxxxxxxx>
> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
> CC: Robert Richter <robert.richter@xxxxxxx>
> CC: Lin Ming <ming.m.lin@xxxxxxxxx>
> ---
> Âarch/x86/kernel/cpu/perf_event_p4.c | Â Â6 +++++-
> Â1 file changed, 5 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
> =====================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event_p4.c
> +++ linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
> @@ -904,8 +904,12 @@ static int p4_pmu_handle_irq(struct pt_r
> Â Â Â Âfor (idx = 0; idx < x86_pmu.num_counters; idx++) {
> Â Â Â Â Â Â Â Âint overflow;
>
> - Â Â Â Â Â Â Â if (!test_bit(idx, cpuc->active_mask))
> + Â Â Â Â Â Â Â if (!test_bit(idx, cpuc->active_mask)) {
> + Â Â Â Â Â Â Â Â Â Â Â /* catch in-flight IRQs */
> + Â Â Â Â Â Â Â Â Â Â Â if (__test_and_clear_bit(idx, cpuc->running))
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â handled++;
> Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
> + Â Â Â Â Â Â Â }
>
> Â Â Â Â Â Â Â Âevent = cpuc->events[idx];
> Â Â Â Â Â Â Â Âhwc = &event->hw;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/