[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1351008789.13456.37.camel@twins>
Date: Tue, 23 Oct 2012 18:13:09 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Jiri Olsa <jolsa@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 02/11] perf: Do not get values from disabled counters in
group format read
On Sat, 2012-10-20 at 16:33 +0200, Jiri Olsa wrote:
> It's possible some of the counters in the group could be
> disabled when sampling member of the event group is reading
> the rest via PERF_SAMPLE_READ sample type processing. Disabled
> counters could then produce wrong numbers.
>
> Fixing that by reading only enabled counters for PERF_SAMPLE_READ
> sample type processing.
>
However did you run into this?
> ---
> kernel/events/core.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 32aec40..5220d01 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -4012,12 +4012,24 @@ static void perf_output_read_group(struct perf_output_handle *handle,
> __output_copy(handle, values, n * sizeof(u64));
>
> list_for_each_entry(sub, &leader->sibling_list, group_entry) {
> + u64 value = 0;
> n = 0;
>
> - if (sub != event)
> - sub->pmu->read(sub);
> + /*
> + * We are NOT interested in disabled counters,
> + * giving us strange values and keeping us from
> + * good night sleep!!!
> + */
> + if (sub->state > PERF_EVENT_STATE_OFF) {
> +
superfluous whitespace there... ;-)
> + if (sub != event)
> + sub->pmu->read(sub);
> +
> + value = perf_event_count(sub);
> + }
> +
> + values[n++] = value;
>
> - values[n++] = perf_event_count(sub);
> if (read_format & PERF_FORMAT_ID)
> values[n++] = primary_event_id(sub);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists