Skip to contentSkip to conversation

perf script: perf script hangs forever in linux-next

DISCUSSION Applied Thomas Richter 2 participants 5 messages Feb 13, 2025 – Feb 19, 2025 perf events

lore
Share & tools
lore
#0 lore raw

Command 'perf script report flamegraph' hangs for ever as can be seen with these commands:

  # perf record -- dd if=/dev/zero of=/dev/null bs=1M count=10K > /dev/null
  10240+0 records in
  10240+0 records out
  10737418240 bytes (11 GB, 10 GiB) copied, 0.387818 s, 27.7 GB/s
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.074 MB perf.data (1520 samples) ]
  #
  # time perf script report flamegraph
  ^C
  real  0m53.506s
  user  0m0.017s
  sys   0m0.012s

#

Control-C interrupt is needed to terminate the command.

If I revert commit 23e0a63c6dd3f69cb7ee18411e5f6857cca55b30
Author: Anubhav Shelat <[email protected]>
Date: Fri Jan 31 09:57:05 2025 -0500

perf script: force stdin for flamegraph in live mode

then everythings works fine again:

# PERF_EXEC_PATH=/root/mirror-linux-next/tools/perf ./perf script report flamegraph

 # dumping data to flamegraph.html
 # 

Can you fix this so above invocation works again or revert that patch?

Thanks a lot
~
~
~

Signature · 9 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
maintainer
#1 lore raw
Quoted 26 lines · Thomas Richter

Command 'perf script report flamegraph' hangs for ever as can be seen with these commands:

  # perf record -- dd if=/dev/zero of=/dev/null bs=1M count=10K > /dev/null
  10240+0 records in
  10240+0 records out
  10737418240 bytes (11 GB, 10 GiB) copied, 0.387818 s, 27.7 GB/s
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.074 MB perf.data (1520 samples) ]
  #
  # time perf script report flamegraph
  ^C
  real  0m53.506s
  user  0m0.017s
  sys   0m0.012s

#

Control-C interrupt is needed to terminate the command.

If I revert commit 23e0a63c6dd3f69cb7ee18411e5f6857cca55b30
Author: Anubhav Shelat <[email protected]>
Date: Fri Jan 31 09:57:05 2025 -0500

perf script: force stdin for flamegraph in live mode

Quoted 7 lines

then everythings works fine again:

# PERF_EXEC_PATH=/root/mirror-linux-next/tools/perf ./perf script report flamegraph

 # dumping data to flamegraph.html
 # 

Can you fix this so above invocation works again or revert that patch?

Hmm.. it seems the patch fixes one problem but create another. :(

IIUC the report script should be invoked with "-i -" already, that means flamegraph-report should see it instead of adding its own. I think it's because of the "--" before "$@" so that it cannot pass the input file to perf script and give it to flamegraph.py instead.

Can you please test if the below fixes the problem both for your use case and the live mode (perf script flamegraph -a -F 99 sleep 1)?

Thanks,
Namhyung

---8<---

tools/perf/scripts/python/bin/flamegraph-report +1 -1
index 83d5738c75ca4726..453a6918afbe8f72 100755
@@ -1,3 +1,3 @@
 #!/bin/bash
 # description: create flame graphs
-perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -i - -- "$@"
+perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py "$@"

---8<---

author Tested-by
#2 lore raw
Quoted 1 line · Namhyung Kim

perf script flamegraph -a -F 99 sleep 1

Thanks Namhyung,

i have tested your patch and both invocations of the perf script command work again as can be seen here:

# perf script flamegraph -a -- sleep 1
dumping data to flamegraph.html
#  perf record -- dd if=/dev/zero of=/dev/null bs=1M count=10K > /dev/null
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 0.294051 s, 36.5 GB/s
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.060 MB perf.data (1177 samples) ]
#  perf script report flamegraph
dumping data to flamegraph.html
# 
Signature · 9 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
author Tested-by
#3 lore raw

PING perf script: perf script hangs forever in linux-next

Hi all,

just a friendly ping as reminder that this issue still exist...

Thanks for your help.

-------- Forwarded Message --------
Subject: Re: perf script: perf script hangs forever in linux-next
Date: Fri, 14 Feb 2025 11:21:56 +0100
From: Thomas Richter <[email protected]>
Organization: IBM
To: Namhyung Kim <[email protected]>
CC: linux-perf-use. <[email protected]>, [email protected], Michael Petlan <[email protected]>

Quoted 1 line · Namhyung Kim

perf script flamegraph -a -F 99 sleep 1

Thanks Namhyung,

i have tested your patch and both invocations of the perf script command work again as can be seen here:

# perf script flamegraph -a -- sleep 1
dumping data to flamegraph.html
#  perf record -- dd if=/dev/zero of=/dev/null bs=1M count=10K > /dev/null
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 0.294051 s, 36.5 GB/s
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.060 MB perf.data (1177 samples) ]
#  perf script report flamegraph
dumping data to flamegraph.html
# 
Signature · 21 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294


-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
maintainer Applied
#4 lore raw
In reply to Thomas Richter
Quoted 20 lines · Thomas Richter
Quoted 1 line · Namhyung Kim

perf script flamegraph -a -F 99 sleep 1

Thanks Namhyung,

i have tested your patch and both invocations of the perf script command work again as can be seen here:

# perf script flamegraph -a -- sleep 1
dumping data to flamegraph.html
#  perf record -- dd if=/dev/zero of=/dev/null bs=1M count=10K > /dev/null
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 0.294051 s, 36.5 GB/s
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.060 MB perf.data (1177 samples) ]
#  perf script report flamegraph
dumping data to flamegraph.html
# 
Quoted 1 line

Applied to perf-tools-next, thanks!

Best Regards,
Namhyung