Bug 5846

Summary: perf report command hangs or crashes on arm targets
Product: [Yocto Project Subprojects] Kernel Reporter: Alexandra Safta <alexandra.safta>
Component: kernel-toolingAssignee: Bruce Ashfield <bruce.ashfield>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: Medium CC: dvhart, sgw, tom.zanussi, yp.kernel.watcher, yp.watcher
Version: 1.5.1   
Target Milestone: Future   
Hardware: Other   
OS: arm   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Alexandra Safta 2014-02-18 15:14:28 UTC
Scenario:
On an arm target (including qemuarm): 

Run : perf record ls 
Perf.data file is generated. 
      perf report perf.data

An interactive menu is open, when browsing through it we got the following choices:
Run scripts for all samples
Switch to another data file in PWD
Exit

when selecting: 
- Run scripts for all segment: the application crashes with the following message: "perf: Segmentation fault"
- Switch to another data file ... and choosing any perf.data file makes the console freeze.
Comment 1 Alexandra Safta 2014-02-18 17:00:29 UTC
I've checked the perf code and noticed that the problem for the first segmentation fault is in the script_browse function (ui/browsers/scripts.c) where is no check for NULL script_opt.
Comment 2 Darren Hart 2014-02-20 16:01:09 UTC
Alexandra, targeting for 1.5.2, but can you tell us if you observe the same behavior on master?
Comment 3 Alexandra Safta 2014-02-20 16:22:18 UTC
Yes, the same behavior is on master.
Comment 4 Darren Hart 2014-02-20 17:02:34 UTC
Tom, leaving assigned to Bruce, but if you have any thoughts here, please chime in.
Comment 5 Tom Zanussi 2014-02-20 17:13:30 UTC
Sounds like just a standard userspace debugging effort, nothing special about it being perf.

By default, you'll get the text-based TUI, which may be where the problem lies - you can try the stdio version by using the --stdio param to 'perf report', which may help narrow down the problem.

I would say that reading and analyzing a perf .data file on an underpowered target system doesn't really make sense in general, you might want to try reading the same perf.data file on a host system with more memory, just something else to try.
Comment 6 Bruce Ashfield 2014-05-21 14:54:19 UTC
The problem isn't being seen on the new perf and kernel in the Yocto 1.6 release.

Can we get confirmation that this isn't a problem with yocto 1.6 / master. Since this
is built from the kernel tree, there are no plans to backport any changes to fix this
in 1.5, but it would be nice to have a confirmation that this is indeed fixed.
Comment 7 Stephen K Jolley 2014-06-18 17:38:19 UTC
Assigned to person we are requesting info from per RP.
Comment 8 Alexandra Safta 2014-06-24 11:12:43 UTC
Hi, 
I've just retested on master. The behavior has changed, now an error appears:
- when choosing Run scripts for all samples:
/usr/libexec/perf-core/scripts/python/event_analyzing_sample.py
Traceback (most recent call last):                                             ♦
  File "/usr/libexec/perf-core/scripts/python/event_analyzing_sample.py", line ▒
    import sqlite3                                                             ▒
ImportError: No module named sqlite3                                           ▒
Error running python script /usr/libexec/perf-core/scripts/python/event_analyzi

- when choosing Switch to another data file ... and choosing any perf.data file:
┌Processing events...──────────────────────────────────────────────────────────┐
│                                                                     *** Error in `perf': free(): invalid next size (fast): 0x00475108 ***──────────────────────────────┘
Aborted
Comment 9 Stephen K Jolley 2014-06-30 19:20:41 UTC
Response given by user.
Comment 10 Bruce Ashfield 2015-02-17 21:05:52 UTC
Someone else will need to look into this. I'll have no time in the 1.8 cycle to look
into it.
Comment 11 Bruce Ashfield 2016-03-23 18:27:21 UTC
root@qemuarm:~# uname -a
Linux qemuarm 4.4.3-yocto-standard #1 PREEMPT Wed Mar 23 13:30:10 EDT 2016 armv5tejl GNU/Linux

% perf record -a -F 1000 sleep 5
% perf report

All scripts can be executed, no segfaults.

With the latest kernel, and perf python packaging fixes, this now works.

Given that this is not something we can easily bisect, or backport, I'm closing this as "won't fixed", knowing that it will in fact be working for the 4.4 kernel on.