linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@amd.com>
To: Andreas Gerstmayr <agerstmayr@redhat.com>,
	linux-perf-users@vger.kernel.org
Cc: Martin Spier <mspier@netflix.com>,
	Brendan Gregg <bgregg@netflix.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf script: add flamegraph.py script
Date: Thu, 26 Mar 2020 14:04:30 -0500	[thread overview]
Message-ID: <05e0d633-54b4-fb3b-3d08-8963271017ea@amd.com> (raw)
In-Reply-To: <21c81775-876a-4dd2-f52f-42645963350f@redhat.com>

On 3/24/20 2:05 PM, Andreas Gerstmayr wrote:
> On 24.03.20 17:16, Kim Phillips wrote:
>> On Ubuntu 19.10, where python 2.7 is still the default, I get:
>>
>> $ perf script report flamegraph
>>    File "/usr/libexec/perf-core/scripts/python/flamegraph.py", line 46
>>      print(f"Flame Graph template {self.args.template} does not " +
>>                                                                 ^
>> SyntaxError: invalid syntax
>> Error running python script /usr/libexec/perf-core/scripts/python/flamegraph.py
>>
>> Installing libpython3-dev doesn't help.
> 
> Hmm, I was hoping that I can drop support for Python 2 in 2020 ;) (it's officially EOL since Jan 1, 2020)
> 
> The Ubuntu 18.04 release notes mention that "Python 2 is no longer installed by default. Python 3 has been updated to 3.6. This is the last LTS release to include Python 2 in main." (https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes) - so imho it should be fine to drop Python 2 support.
> 
> I tested it with a Ubuntu VM, and by default the Python bindings aren't enabled in perf (see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1707875).
> 
> But you can compile perf and select Python 3:
> 
> $ make -j2 PYTHON=python3
> 
> in the perf source directory (libpython3-dev must be installed).
> 
> 
> Does this work for you?

Not on Ubuntu 18.04.4 LTS, but it does on 19.10.

On 19.10 however, when specifying dwarf on the record, e.g.:

sudo perf record -a -g -C2,4 --call-graph=dwarf -- sleep 10

I now get a SIGSEGV when executing perf script report flamegraph.

Here's a trace:

#0  0x000055555590a9b2 in regs_map (regs=0x7fffffffbfc8, mask=16715775, 
    bf=0x7fffffffba60 "", size=512) at util/scripting-engines/trace-event-python.c:696
#1  0x000055555590ab03 in set_regs_in_dict (dict=0x7ffff61dd500, sample=0x7fffffffbf20, 
    evsel=0x555555d7a700) at util/scripting-engines/trace-event-python.c:718
#2  0x000055555590af1f in get_perf_sample_dict (sample=0x7fffffffbf20, 
    evsel=0x555555d7a700, al=0x7fffffffbdd0, callchain=0x7ffff625b780)
    at util/scripting-engines/trace-event-python.c:787
#3  0x000055555590ce3e in python_process_general_event (sample=0x7fffffffbf20, 
    evsel=0x555555d7a700, al=0x7fffffffbdd0)
    at util/scripting-engines/trace-event-python.c:1301
#4  0x000055555590cf94 in python_process_event (event=0x7ffff60b0a48, 
    sample=0x7fffffffbf20, evsel=0x555555d7a700, al=0x7fffffffbdd0)
    at util/scripting-engines/trace-event-python.c:1328
#5  0x000055555577375c in process_sample_event (tool=0x7fffffffcf30, 
    event=0x7ffff60b0a48, sample=0x7fffffffbf20, evsel=0x555555d7a700, 
    machine=0x555555d73168) at builtin-script.c:2072
#6  0x000055555585f3d9 in perf_evlist__deliver_sample (evlist=0x555555d79c60, 
    tool=0x7fffffffcf30, event=0x7ffff60b0a48, sample=0x7fffffffbf20, 
    evsel=0x555555d7a700, machine=0x555555d73168) at util/session.c:1389
#7  0x000055555585f588 in machines__deliver_event (machines=0x555555d73168, 
    evlist=0x555555d79c60, event=0x7ffff60b0a48, sample=0x7fffffffbf20, 
    tool=0x7fffffffcf30, file_offset=3037768) at util/session.c:1426
#8  0x000055555585fa32 in perf_session__deliver_event (session=0x555555d72fe0, 
    event=0x7ffff60b0a48, tool=0x7fffffffcf30, file_offset=3037768)
    at util/session.c:1499
#9  0x000055555585bf5e in ordered_events__deliver_event (oe=0x555555d79b20, 
    event=0x555556446588) at util/session.c:183
#10 0x0000555555864010 in do_flush (oe=0x555555d79b20, show_progress=false)
    at util/ordered-events.c:244
#11 0x000055555586435f in __ordered_events__flush (oe=0x555555d79b20, 
    how=OE_FLUSH__ROUND, timestamp=0) at util/ordered-events.c:323
#12 0x0000555555864447 in ordered_events__flush (oe=0x555555d79b20, how=OE_FLUSH__ROUND)
    at util/ordered-events.c:341
#13 0x000055555585e2b1 in process_finished_round (tool=0x7fffffffcf30, 
    event=0x7ffff60ec040, oe=0x555555d79b20) at util/session.c:997
#14 0x000055555585fcea in perf_session__process_user_event (session=0x555555d72fe0, 
    event=0x7ffff60ec040, file_offset=3280960) at util/session.c:1546
#15 0x000055555586055d in perf_session__process_event (session=0x555555d72fe0, 
    event=0x7ffff60ec040, file_offset=3280960) at util/session.c:1706
#16 0x0000555555861973 in process_simple (session=0x555555d72fe0, event=0x7ffff60ec040, 
    file_offset=3280960) at util/session.c:2202
#17 0x0000555555861792 in reader__process_events (rd=0x7fffffffcd70, 
    session=0x555555d72fe0, prog=0x7fffffffcd90) at util/session.c:2168
#18 0x0000555555861a68 in __perf_session__process_events (session=0x555555d72fe0)
    at util/session.c:2225
#19 0x0000555555861b9d in perf_session__process_events (session=0x555555d72fe0)
    at util/session.c:2258
#20 0x0000555555774d02 in __cmd_script (script=0x7fffffffcf30) at builtin-script.c:2557
#21 0x0000555555779988 in cmd_script (argc=0, argv=0x7fffffffebd0)
    at builtin-script.c:3926
#22 0x00005555557f2a93 in run_builtin (p=0x555555bb44d8 <commands+408>, argc=4, 
    argv=0x7fffffffebd0) at perf.c:312
#23 0x00005555557f2d18 in handle_internal_command (argc=4, argv=0x7fffffffebd0)
    at perf.c:364
#24 0x00005555557f2e6b in run_argv (argcp=0x7fffffffea2c, argv=0x7fffffffea20)
    at perf.c:408
#25 0x00005555557f326e in main (argc=4, argv=0x7fffffffebd0) at perf.c:538

This is on today's acme's perf/urgent branch.

Thanks,

Kim

  parent reply	other threads:[~2020-03-26 19:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 15:13 [PATCH] perf script: add flamegraph.py script Andreas Gerstmayr
2020-03-24 16:16 ` Kim Phillips
2020-03-24 19:05   ` Andreas Gerstmayr
2020-03-24 21:26     ` Arnaldo Melo
2020-03-26 19:04     ` Kim Phillips [this message]
2020-04-02 12:43       ` [PATCH] perf script: fix invalid read Andreas Gerstmayr
2020-04-02 15:15         ` Arnaldo Carvalho de Melo
2020-04-04  8:41         ` [tip: perf/urgent] perf script: Fix invalid read of directory entry after closedir() tip-bot2 for Andreas Gerstmayr
2020-04-02 12:54       ` [PATCH] perf script report: fix segfault when using DWARF mode Andreas Gerstmayr
2020-04-02 15:16         ` Arnaldo Carvalho de Melo
2020-04-02 19:07         ` Kim Phillips
2020-04-03 12:40           ` Arnaldo Carvalho de Melo
2020-04-03 13:16             ` Andreas Gerstmayr
2020-04-06  9:30               ` Andreas Gerstmayr
2020-04-06 12:59                 ` Arnaldo Carvalho de Melo
2020-04-06 14:28                   ` Kim Phillips
2020-04-04  8:41         ` [tip: perf/urgent] perf script report: Fix SEGFAULT " tip-bot2 for Andreas Gerstmayr
2020-04-02 13:04       ` [PATCH] perf script: add flamegraph.py script Andreas Gerstmayr
2020-04-06 14:27         ` Kim Phillips
2020-04-06 15:11 ` Arnaldo Carvalho de Melo
2020-04-09 16:57   ` [PATCH] perf script flamegraph: python2 support, update cli args Andreas Gerstmayr
2020-04-13 13:59     ` Arnaldo Carvalho de Melo
2020-04-09 17:14   ` [PATCH] perf script: add flamegraph.py script Andreas Gerstmayr
2020-04-22 12:17 ` [tip: perf/core] perf script: Add " tip-bot2 for Andreas Gerstmayr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05e0d633-54b4-fb3b-3d08-8963271017ea@amd.com \
    --to=kim.phillips@amd.com \
    --cc=acme@kernel.org \
    --cc=agerstmayr@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bgregg@netflix.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=mspier@netflix.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).