New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 920735 link

Starred by 1 user

Issue metadata

Status: Unconfirmed
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug
Build-Toolchain



Sign in to add a comment

perf in host SDK segfaults

Project Member Reported by cjmcdonald@chromium.org, Jan 10

Issue description

Running `perf record <command>` in the host chroot results in perf segfaulting. Possibly due to perf being built against kernel 4.14 headers and my workstation being on a 4.18 kernel?
 
Cc: gmx@chromium.org llozano@chromium.org
Hmm, perf is theoretically supposed to be forward compatible too,  but might not be.    We mostly run perf on the DUTs, and not in the chroot, but it should work.  Also, we should be running this version of perf on CrOS DUTs running 4.19 kernels, right now also -- I will test that.


I can pretty easily replicate perf record segfaulting inside the chroot:
sudo perf record ls 
[ perf record: Woken up 1 times to write data ]
perf: Segmentation fault
Obtained 16 stack frames.
perf(sighandler_dump_stack+0x40) [0x4da7f0]
perf() [0x4375d1]
/lib64/libc.so.6(+0x35db0) [0x7f4c9b018db0]
perf(unwind__prepare_access+0x173) [0x543583]
perf(thread__insert_map+0x24) [0x4e9074]
perf(machine__process_mmap2_event+0xfd) [0x4dd0ad]
perf(perf_event__process_mmap2+0x1d) [0x4a66dd]
perf() [0x4e39ff]
perf() [0x4e2681]
perf(ordered_events__flush+0x25e) [0x4e735e]
perf(perf_session__process_events+0x483) [0x4e4a43]
perf() [0x437ec2]
perf(cmd_record+0xd48) [0x436698]
perf() [0x497f25]
perf() [0x497cb2]
perf(main+0x428) [0x497338]
Segmentation fault

I tested a caroline running 4.19 and perf record works on that device, so I don't think this is just a kernel version issue.
Cc: vapier@chromium.org chirantan@chromium.org mka@chromium.org
It looks like this broke with the most recent change to the perf ebuild:
9fd67b584922 perf: Depend on llvm-libunwind instead of libunwind

If I revert that change, unmerge llvm-libunwind and emerge perf, then perf record works again.

I don't know enough about libunwind to say why this is broken
Components: Tools>ChromeOS-Toolchain
Owner: llozano@chromium.org
afaik, the two libs are supposed to be compatible

bounce to Luis for triage
The issue seems to be somewhere in perf build detecting libunwind:

With llvm-libunwind:
with libunwind:
Auto-detecting system features:
...                     libunwind: [ off ]

with libunwind:
Auto-detecting system features:
...                     libunwind: [ on ]
Also from build.log when using llvm-libunwind:
Makefile.config:445: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR

So, seems like some problem in perf's detection of llvm's libunwind.
Components: -Infra>Client>ChromeOS>Build
looks like the build really wants the extended unwind lib names:
    LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
    $(call detected,CONFIG_X86_64)

afaik, libunwind-llvm doesn't provide the libunwind-$ARCH libs.

so whoever manages the perf tool now (kernel?) can debug it.

Comment 8 by lloz...@google.com, Jan 16 (6 days ago)

Cc: manojgupta@chromium.org tcwang@chromium.org
can we disable the use of unwind in perf? 
This is a use flag and currently enabled by default.
As I understand, that functionality is only used for "-g dwarf". 
Chatted with Gabriel and CWP does not need that. We have enabled frame-pointer for x86. And for ARM we don't generate stack traces from perf.

cjmcdonald@, what are you trying to use perf on? 
could you use perf outside the chroot as a workaround?

Comment 9 by lloz...@google.com, Jan 17 (5 days ago)

Owner: tcwang@chromium.org
Tiancong is using perf for a project we have and he may need to modify it.
I will assign to him for further analysis. Not using unwind should be a possibility.

Sign in to add a comment