[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTik=kHNPPbAo7ynD4AY68Vd3t1bxW_2stZx2QAFH@mail.gmail.com>
Date: Tue, 4 Jan 2011 16:10:17 +0100
From: Stephane Eranian <eranian@...gle.com>
To: Arnaldo Carvalho de Melo <acme@...radead.org>
Cc: linux-kernel@...r.kernel.org,
Frederic Weisbecker <fweisbec@...il.com>,
Han Pingtian <phan@...hat.com>, Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <peterz@...radead.org>,
Tom Zanussi <tzanussi@...il.com>,
Thomas Gleixner <tglx@...utronix.de>, mingo@...e.hu
Subject: Re: [GIT PULL||RFC 00/11] perf library and regression testing improvements
Ok, The problem comes both files picking up a different verison for
perf_event.h.
In my case, util/evsel.c was using /usr/include/linux/perf_event.h whereas
builtin-stat.c was using ../../include/linux/perf_event.h. Both have a different
struct perf_event_attr.
When I remove the /usr/include/linux/perf_event.h file, then I cannot compile
perf anymore:
In file included from perf.c:15:
util/parse-events.h:7:30: error: linux/perf_event.h: No such file or directory
Looks like something changed in the Makefile and the util modules don't know
where to pickup perf_event.h
On Tue, Jan 4, 2011 at 3:59 PM, Stephane Eranian <eranian@...gle.com> wrote:
> The issue is related to a mismatch in the data structure layout
> between builtin-stat.c and util/evsel.c. The offset of the counts fields
> is different between the two files. Getting closer.....
>
> On Tue, Jan 4, 2011 at 3:46 PM, Stephane Eranian <eranian@...gle.com> wrote:
>> On Tue, Jan 4, 2011 at 3:36 PM, Arnaldo Carvalho de Melo
>> <acme@...radead.org> wrote:
>>> Em Tue, Jan 04, 2011 at 03:33:38PM +0100, Stephane Eranian escreveu:
>>>> No improvement with this patch.
>>>
>>> I was guessing you were using it somehow without calling
>>> perf_evsel__alloc_counts, now I guess you're just using what is in
>>> tip/perf/core, no local changes, right?
>>>
>> I am using:
>> git://git.eu.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip.git
>>
>>> Next step: there are anonymous structs inside anonymous unions, what
>>> compiler/distro?
>> Yes, I am looking at those right now.
>>>
>> gcc 4.4.3 or gcc 4.2.4 (ubuntu hardy or 10.04).
>>
>>> - Arnaldo
>>>
>>>> On Tue, Jan 4, 2011 at 3:27 PM, Arnaldo Carvalho de Melo
>>>> <acme@...radead.org> wrote:
>>>> > Em Tue, Jan 04, 2011 at 12:19:58PM -0200, Arnaldo Carvalho de Melo escreveu:
>>>> >> Em Tue, Jan 04, 2011 at 03:09:08PM +0100, Stephane Eranian escreveu:
>>>> >> > Arnaldo,
>>>> >> > Looks like what's wrong is not ps but count:
>>>> >> >
>>>> >> > Program received signal SIGSEGV, Segmentation fault.
>>>> >> > [Switching to Thread 0x7f96967fd6e0 (LWP 5156)]
>>>> >> > 0x0000000000412b58 in read_counter_aggr (counter=0x7d4820) at builtin-stat.c:206
>>>> >> > 206 update_stats(&ps->res_stats[i], count[i]);
>>>> >> > (gdb) print ps
>>>> >> > $1 = (struct perf_stat *) 0x7d48a0
>>>> >> > (gdb) print *ps
>>>> >> > $2 = {res_stats = {{n = 0, mean = 0, M2 = 0}, {n = 0, mean = 0, M2 =
>>>> >> > 0}, {n = 0, mean = 0, M2 = 0}}}
>>>> >> > (gdb) print count
>>>> >> > $3 = (u64 *) 0x12
>>>> >> > (gdb) print *count
>>>> >> > Cannot access memory at address 0x12
>>>> >> > (gdb) print count
>>>> >> > $4 = (u64 *) 0x12
>>>> >>
>>>> >> Count is:
>>>> >>
>>>> >> u64 *count = counter->counts->aggr.values;
>>>> >
>>>> > Can you try with this patch?
>>>> >
>>>> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
>>>> > index 02b2d80..7876b11 100644
>>>> > --- a/tools/perf/builtin-stat.c
>>>> > +++ b/tools/perf/builtin-stat.c
>>>> > @@ -196,12 +196,14 @@ static inline int nsec_counter(struct perf_evsel *evsel)
>>>> > static int read_counter_aggr(struct perf_evsel *counter)
>>>> > {
>>>> > struct perf_stat *ps = counter->priv;
>>>> > - u64 *count = counter->counts->aggr.values;
>>>> > + u64 *count;
>>>> > int i;
>>>> >
>>>> > if (__perf_evsel__read(counter, cpus->nr, threads->nr, scale) < 0)
>>>> > return -1;
>>>> >
>>>> > + count = counter->counts->aggr.values;
>>>> > +
>>>> > for (i = 0; i < 3; i++)
>>>> > update_stats(&ps->res_stats[i], count[i]);
>>>> >
>>>> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>>>> > index d337761..26962ea 100644
>>>> > --- a/tools/perf/util/evsel.c
>>>> > +++ b/tools/perf/util/evsel.c
>>>> > @@ -89,8 +89,12 @@ int __perf_evsel__read(struct perf_evsel *evsel,
>>>> > {
>>>> > size_t nv = scale ? 3 : 1;
>>>> > int cpu, thread;
>>>> > - struct perf_counts_values *aggr = &evsel->counts->aggr, count;
>>>> > + struct perf_counts_values *aggr, count;
>>>> >
>>>> > + if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, ncpus) < 0)
>>>> > + return -ENOMEM;
>>>> > +
>>>> > + aggr = &evsel->counts->aggr;
>>>> > aggr->val = 0;
>>>> >
>>>> > for (cpu = 0; cpu < ncpus; cpu++) {
>>>> >
>>>
>>
>
--
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