Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCHv3 0/5] perf, tool: Fix endian issues

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


jolsa at redhat

May 7, 2012, 4:29 AM

Post #1 of 6 (107 views)
Permalink
[PATCHv3 0/5] perf, tool: Fix endian issues

hi,
sending fixies to properly handle perf.data endians.

v3 changes:
- added patch 5 to fix addons bitmask handling

v2 changes:
- added patches 3 and 4 to handle sample_id_all header endianity


Attached patches:
1/5 perf, tool: Handle different endians properly during symbol load
2/5 perf, tool: Carry perf_event_attr bitfield throught different endians
3/5 perf, tool: Handle endianity swap on sample_id_all header data
4/5 perf, tool: Fix 32 bit values endianity swap for sample_id_all header
5/5 perf, tool: Fix endianity trick for adds_features bitmask


Tested by running following usecase:
- origin system:
# perf record -a -- sleep 10 (any perf record will do)
# perf report > report.origin
# perf archive perf.data

- copy the perf.data, report.origin and perf.data.tar.bz2
to a target system and run:
# tar xjvf perf.data.tar.bz2 -C ~/.debug
# perf report > report.target
# diff -u report.origin report.target

- the diff should produce no output
(besides some white space stuff and possibly different
date/TZ output)

Tested by above usecase cross following architectures:
i386, x86_64, s390x, ppc64

Big thank to Caspar Zhang who verified this within RH QE testsuites.

thanks,
jirka

CC: Caspar Zhang <czhang [at] redhat>
---
tools/perf/util/evsel.c | 32 ++++++++--
tools/perf/util/header.c | 20 +++++--
tools/perf/util/include/linux/bitops.h | 1 +
tools/perf/util/session.c | 101 ++++++++++++++++++++++++++++----
tools/perf/util/symbol.c | 33 ++++++++++-
tools/perf/util/symbol.h | 30 +++++++++
6 files changed, 192 insertions(+), 25 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


dsahern at gmail

May 7, 2012, 7:12 PM

Post #2 of 6 (138 views)
Permalink
Re: [PATCHv3 0/5] perf, tool: Fix endian issues [In reply to]

On 5/7/12 5:29 AM, Jiri Olsa wrote:
> Tested by running following usecase:
> - origin system:
> # perf record -a -- sleep 10 (any perf record will do)
> # perf report> report.origin
> # perf archive perf.data
>
> - copy the perf.data, report.origin and perf.data.tar.bz2
> to a target system and run:
> # tar xjvf perf.data.tar.bz2 -C ~/.debug
> # perf report> report.target
> # diff -u report.origin report.target
>
> - the diff should produce no output
> (besides some white space stuff and possibly different
> date/TZ output)
>
> Tested by above usecase cross following architectures:
> i386, x86_64, s390x, ppc64

What version of ppc64? I'm getting 2 compile failures using Fedora 12
PPC, 32-bit. I sent a patch for the easy one with perf-report. I'm a bit
stumped on this one:

LINK /tmp/pbuild/perf
/tmp/pbuild/libperf.a(pmu.o): In function `pmu_format_parse':
/mnt/src/tools/perf/util/pmu.c:47: undefined reference to `perf_pmu_in'
/mnt/src/tools/perf/util/pmu.c:47: undefined reference to `perf_pmu_in'
/tmp/pbuild/libperf.a(pmu-bison.o): In function `perf_pmu_parse':
/tmp/pbuild/util/pmu-bison.c:1287: undefined reference to `perf_pmu_lex'
collect2: ld returned 1 exit status
make: *** [/tmp/pbuild/perf] Error 1

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


dsahern at gmail

May 7, 2012, 8:37 PM

Post #3 of 6 (109 views)
Permalink
Re: [PATCHv3 0/5] perf, tool: Fix endian issues [In reply to]

On 5/7/12 8:12 PM, David Ahern wrote:
>
> LINK /tmp/pbuild/perf
> /tmp/pbuild/libperf.a(pmu.o): In function `pmu_format_parse':
> /mnt/src/tools/perf/util/pmu.c:47: undefined reference to `perf_pmu_in'
> /mnt/src/tools/perf/util/pmu.c:47: undefined reference to `perf_pmu_in'
> /tmp/pbuild/libperf.a(pmu-bison.o): In function `perf_pmu_parse':
> /tmp/pbuild/util/pmu-bison.c:1287: undefined reference to `perf_pmu_lex'
> collect2: ld returned 1 exit status
> make: *** [/tmp/pbuild/perf] Error 1

nevermind. This one is a weird side effect of not having flex and bison
installed the first time I tried compiling it. After nuking the build
directory, installing flex and bison, perf compiled fine.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


dsahern at gmail

May 7, 2012, 8:49 PM

Post #4 of 6 (103 views)
Permalink
Re: [PATCHv3 0/5] perf, tool: Fix endian issues [In reply to]

On 5/7/12 5:29 AM, Jiri Olsa wrote:
> Tested by running following usecase:
> - origin system:
> # perf record -a -- sleep 10 (any perf record will do)
> # perf report> report.origin
> # perf archive perf.data
>
> - copy the perf.data, report.origin and perf.data.tar.bz2
> to a target system and run:
> # tar xjvf perf.data.tar.bz2 -C ~/.debug
> # perf report> report.target
> # diff -u report.origin report.target
>
> - the diff should produce no output
> (besides some white space stuff and possibly different
> date/TZ output)
>
> Tested by above usecase cross following architectures:
> i386, x86_64, s390x, ppc64

Short answer: Now that I have perf compiling in a 32-bit PPC VM, applied
the patchset and rebuilding -- it does not work for me.

Long answer to reproduce:

In the PPC VM:
1. build perf without your patches

2. perf record -ag -fo /tmp/perf.data -- sleep 1


In the host (x86_64) using the same code base:
1. build perf without your patches

2. mount ppc filesystem (e.g.,
sshfs root [at] 172:/ /tmp/f12-ppc/ -o direct_io)

3. analyze ppc file. Verify life is good:
/tmp/jiri/perf script --symfs /tmp/f12-ppc \
-I -i /tmp/f12-ppc/tmp/perf.data \
--kallsyms /tmp/f12-ppc/proc/kallsyms


# ========
# captured on: Mon May 7 21:32:15 2012
# hostname : f12-ppc
# os release : 2.6.32.26-175.fc12.ppc
# perf version : 3.4.0-rc2
# arch : ppc
# nrcpus online : 1
# nrcpus avail : 1
# cpudesc : 740/750
# cpuid : 8,769
# total memory : 1024572 kB
# cmdline : /tmp/pbuild/perf record -ag -fo /tmp/perf.data -v -e
cpu-clock -- sleep 5
# event : name = cpu-clock, type = 1, config = 0x0, config1 = 0x0,
config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 6 }
# ========
#
...

Apply your patches and rebuild the host (x86_64 version). Life is not so
good:

/tmp/jiri/perf script --symfs /tmp/f12-ppc \
-I -i /tmp/f12-ppc/tmp/perf.data \
--kallsyms /tmp/f12-ppc/proc/kallsyms

# ========
# captured on: Mon May 7 21:32:15 2012
# ========
#


i.e, all the feature data has gone missing.

David

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


jolsa at redhat

May 10, 2012, 3:38 AM

Post #5 of 6 (101 views)
Permalink
Re: [PATCHv3 0/5] perf, tool: Fix endian issues [In reply to]

On Mon, May 07, 2012 at 09:49:17PM -0600, David Ahern wrote:
> On 5/7/12 5:29 AM, Jiri Olsa wrote:
> >Tested by running following usecase:
> > - origin system:
> > # perf record -a -- sleep 10 (any perf record will do)
> > # perf report> report.origin
> > # perf archive perf.data
> >
> > - copy the perf.data, report.origin and perf.data.tar.bz2
> > to a target system and run:
> > # tar xjvf perf.data.tar.bz2 -C ~/.debug
> > # perf report> report.target
> > # diff -u report.origin report.target
> >
> > - the diff should produce no output
> > (besides some white space stuff and possibly different
> > date/TZ output)
> >
> >Tested by above usecase cross following architectures:
> > i386, x86_64, s390x, ppc64
>
> Short answer: Now that I have perf compiling in a 32-bit PPC VM,
> applied the patchset and rebuilding -- it does not work for me.

hi,
Could I ask what VM did you use? My qemu setup does not seem
to offer this one.

so it's [32 bits big endian] into [64 bits small endian]

I tested i386 to ppc64. The endianity is the other way round,
I wonder whats wrong with your tested direction.

hunting testing machine ;)

Also I did not test older versions.

thanks,
jirka

>
> Long answer to reproduce:
>
> In the PPC VM:
> 1. build perf without your patches
>
> 2. perf record -ag -fo /tmp/perf.data -- sleep 1
>
>
> In the host (x86_64) using the same code base:
> 1. build perf without your patches
>
> 2. mount ppc filesystem (e.g.,
> sshfs root [at] 172:/ /tmp/f12-ppc/ -o direct_io)
>
> 3. analyze ppc file. Verify life is good:
> /tmp/jiri/perf script --symfs /tmp/f12-ppc \
> -I -i /tmp/f12-ppc/tmp/perf.data \
> --kallsyms /tmp/f12-ppc/proc/kallsyms
>
>
> # ========
> # captured on: Mon May 7 21:32:15 2012
> # hostname : f12-ppc
> # os release : 2.6.32.26-175.fc12.ppc
> # perf version : 3.4.0-rc2
> # arch : ppc
> # nrcpus online : 1
> # nrcpus avail : 1
> # cpudesc : 740/750
> # cpuid : 8,769
> # total memory : 1024572 kB
> # cmdline : /tmp/pbuild/perf record -ag -fo /tmp/perf.data -v -e
> cpu-clock -- sleep 5
> # event : name = cpu-clock, type = 1, config = 0x0, config1 = 0x0,
> config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 6 }
> # ========
> #
> ...
>
> Apply your patches and rebuild the host (x86_64 version). Life is
> not so good:
>
> /tmp/jiri/perf script --symfs /tmp/f12-ppc \
> -I -i /tmp/f12-ppc/tmp/perf.data \
> --kallsyms /tmp/f12-ppc/proc/kallsyms
>
> # ========
> # captured on: Mon May 7 21:32:15 2012
> # ========
> #
>
>
> i.e, all the feature data has gone missing.
>
> David
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


jolsa at redhat

May 10, 2012, 9:30 AM

Post #6 of 6 (103 views)
Permalink
Re: [PATCHv3 0/5] perf, tool: Fix endian issues [In reply to]

On Thu, May 10, 2012 at 12:38:25PM +0200, Jiri Olsa wrote:
> On Mon, May 07, 2012 at 09:49:17PM -0600, David Ahern wrote:
> > On 5/7/12 5:29 AM, Jiri Olsa wrote:
> > >Tested by running following usecase:
> > > - origin system:
> > > # perf record -a -- sleep 10 (any perf record will do)
> > > # perf report> report.origin
> > > # perf archive perf.data
> > >
> > > - copy the perf.data, report.origin and perf.data.tar.bz2
> > > to a target system and run:
> > > # tar xjvf perf.data.tar.bz2 -C ~/.debug
> > > # perf report> report.target
> > > # diff -u report.origin report.target
> > >
> > > - the diff should produce no output
> > > (besides some white space stuff and possibly different
> > > date/TZ output)
> > >
> > >Tested by above usecase cross following architectures:
> > > i386, x86_64, s390x, ppc64
> >
> > Short answer: Now that I have perf compiling in a 32-bit PPC VM,
> > applied the patchset and rebuilding -- it does not work for me.
>
> hi,
> Could I ask what VM did you use? My qemu setup does not seem
> to offer this one.
>
> so it's [32 bits big endian] into [64 bits small endian]
>
> I tested i386 to ppc64. The endianity is the other way round,
> I wonder whats wrong with your tested direction.
>
> hunting testing machine ;)

reproduced ;) working on fix

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.