Re: [tip:perf/core] perf: Ignore non-sampling overflows

From: Francis Moreau
Date: Fri Nov 26 2010 - 14:20:43 EST


Peter,

tip-bot for Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> writes:
>
> perf: Ignore non-sampling overflows
>
> Some arch implementations call perf_event_overflow() by 'accident',
> ignore this.
>
> Reported-by: Francis Moreau <francis.moro@xxxxxxxxx>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
> ---
> kernel/perf_event.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 98c5549..af1e63f 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -4240,6 +4240,13 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
> struct hw_perf_event *hwc = &event->hw;
> int ret = 0;
>
> + /*
> + * Non-sampling counters might still use the PMI to fold short
> + * hardware counters, ignore those.
> + */
> + if (unlikely(!is_sampling_event(event)))
> + return 0;
> +
> if (!throttle) {
> hwc->interrupts++;
> } else {

Couldn't we place this in perf_event_overflow() instead, like the
following ?

--8<---------------cut here---------------start------------->8---

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index df27fd8..1dabb54 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4267,7 +4267,9 @@ int perf_event_overflow(struct perf_event *event,
int nmi,
struct perf_sample_data *data,
struct pt_regs *regs)
{
- return __perf_event_overflow(event, nmi, 1, data, regs);
+ if (is_sampling_event(event))
+ return __perf_event_overflow(event, nmi, 1, data, regs);
+ return 0;
}

/*

--8<---------------cut here---------------end--------------->8---

thanks,
--
Francis
--
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/