Jiri Olsa
753e8a597d
perf python scripting: Fix printable strings in python3 scripts
commit 6fcd5ddc3b upstream.
Hagen reported broken strings in python3 tracepoint scripts:
make PYTHON=python3
perf record -e sched:sched_switch -a -- sleep 5
perf script --gen-script py
perf script -s ./perf-script.py
[..]
sched__sched_switch 7 563231.759525792 0 swapper prev_comm=bytearray(b'swapper/7\x00\x00\x00\x00\x00\x00\x00'), prev_pid=0, prev_prio=120, prev_state=, next_comm=bytearray(b'mutex-thread-co\x00'),
The problem is in the is_printable_array function that does not take the
zero byte into account and claim such string as not printable, so the
code will create byte array instead of string.
Committer testing:
After this fix:
sched__sched_switch 3 484522.497072626 1158680 kworker/3:0-eve prev_comm=kworker/3:0, prev_pid=1158680, prev_prio=120, prev_state=I, next_comm=swapper/3, next_pid=0, next_prio=120
Sample: {addr=0, cpu=3, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744071841817196, period=1, phys_addr=0, pid=1158680, tid=1158680, time=484522497072626, transaction=0, values=[(0, 0)], weight=0}
sched__sched_switch 4 484522.497085610 1225814 perf prev_comm=perf, prev_pid=1225814, prev_prio=120, prev_state=, next_comm=migration/4, next_pid=30, next_prio=0
Sample: {addr=0, cpu=4, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744071841817196, period=1, phys_addr=0, pid=1225814, tid=1225814, time=484522497085610, transaction=0, values=[(0, 0)], weight=0}
Fixes: 249de6e074 ("perf script python: Fix string vs byte array resolving")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: http://lore.kernel.org/lkml/20200928201135.3633850-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-05 11:08:52 +01:00
..
2018-06-25 11:59:37 -03:00
2018-07-31 10:57:56 -03:00
2017-11-02 11:10:55 +01:00
2020-08-21 11:05:34 +02:00
2017-11-02 11:10:55 +01:00
2019-04-05 22:33:14 +02:00
2019-11-06 13:05:44 +01:00
2018-08-30 15:51:54 -03:00
2018-01-17 10:23:31 -03:00
2018-01-17 10:23:31 -03:00
2018-01-17 10:23:31 -03:00
2018-01-17 10:23:31 -03:00
2019-03-23 20:10:11 +01:00
2019-03-23 20:10:11 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-08-08 15:55:58 -03:00
2018-08-08 15:55:58 -03:00
2018-06-15 18:10:01 -03:00
2017-11-02 11:10:55 +01:00
2017-07-18 23:14:40 -03:00
2017-07-25 22:46:35 -03:00
2018-08-03 10:34:18 -03:00
2019-04-20 09:15:57 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-05-06 13:00:43 -03:00
2016-05-06 13:00:43 -03:00
2019-02-20 10:25:39 +01:00
2019-02-20 10:25:39 +01:00
2018-06-04 10:28:50 -03:00
2018-03-07 10:22:26 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-07-24 14:54:03 -03:00
2017-11-02 11:10:55 +01:00
2018-08-20 08:54:59 -03:00
2019-04-20 09:15:57 +02:00
2018-05-16 16:11:09 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-01 13:14:39 +02:00
2017-11-02 11:10:55 +01:00
2020-10-17 10:12:56 +02:00
2020-10-17 10:12:56 +02:00
2017-11-02 11:10:55 +01:00
2019-06-22 08:15:18 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-01-23 09:48:20 -03:00
2017-11-07 10:30:18 +01:00
2018-04-27 10:47:06 -03:00
2016-05-06 13:00:53 -03:00
2018-03-16 16:39:02 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-04-19 13:01:51 -03:00
2016-09-22 12:19:41 -03:00
2020-06-22 09:05:30 +02:00
2020-06-22 09:05:30 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-12-31 16:36:37 +01:00
2019-12-31 16:36:37 +01:00
2017-11-02 11:10:55 +01:00
2019-01-09 17:38:43 +01:00
2018-05-22 10:52:49 -03:00
2019-01-09 17:38:42 +01:00
2018-05-23 10:26:39 -03:00
2019-01-26 09:32:41 +01:00
2018-05-21 14:40:54 -03:00
2017-11-07 10:30:18 +01:00
2020-10-01 13:14:46 +02:00
2018-08-08 15:55:47 -03:00
2017-11-02 11:10:55 +01:00
2017-08-22 12:19:08 -03:00
2017-11-02 11:10:55 +01:00
2017-06-19 15:27:07 -03:00
2018-04-30 12:02:03 -03:00
2017-11-02 11:10:55 +01:00
2018-04-12 10:33:31 -03:00
2017-11-02 11:10:55 +01:00
2019-10-11 18:21:28 +02:00
2018-07-30 13:15:03 -03:00
2017-11-02 11:10:55 +01:00
2015-12-14 12:30:37 -03:00
2019-11-12 19:20:37 +01:00
2020-01-23 08:21:30 +01:00
2018-11-21 09:19:19 +01:00
2015-08-21 11:34:10 -03:00
2020-10-30 10:38:19 +01:00
2016-09-29 11:17:05 -03:00
2013-10-14 10:28:48 -03:00
2017-11-02 11:10:55 +01:00
2017-11-07 10:30:18 +01:00
2019-10-17 13:45:15 -07:00
2016-10-24 11:07:39 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-10-17 13:45:14 -07:00
2018-08-20 08:54:58 -03:00
2018-08-20 08:54:59 -03:00
2020-01-27 14:49:53 +01:00
2019-08-16 10:12:41 +02:00
2020-04-02 15:28:24 +02:00
2018-08-08 15:56:00 -03:00
2020-10-01 13:14:43 +02:00
2018-03-16 13:52:37 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-01 13:14:46 +02:00
2018-07-24 14:49:37 -03:00
2018-08-20 08:54:59 -03:00
2018-08-20 08:54:59 -03:00
2018-12-17 09:24:33 +01:00
2018-12-17 09:24:33 +01:00
2017-11-17 12:14:09 -03:00
2017-11-17 12:14:09 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-01 13:14:49 +02:00
2018-05-30 10:40:44 -03:00
2018-06-06 12:52:04 -03:00
2018-06-07 15:50:14 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:48 -03:00
2017-12-27 12:15:48 -03:00
2017-11-02 11:10:55 +01:00
2020-01-04 19:13:14 +01:00
2016-11-29 12:13:27 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-09-23 12:11:00 +02:00
2020-09-23 12:11:00 +02:00
2012-03-16 14:29:35 -03:00
2013-02-14 16:12:34 -03:00
2020-11-05 11:08:52 +01:00
2017-11-07 10:30:18 +01:00
2020-06-22 09:05:30 +02:00
2017-11-02 11:10:55 +01:00
2019-02-12 19:47:11 +01:00
2017-11-02 11:10:55 +01:00
2020-08-26 10:30:58 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:56 -03:00
2019-02-12 19:47:18 +01:00
2017-11-07 10:30:18 +01:00
2017-12-05 10:24:31 -03:00
2017-12-05 10:24:31 -03:00
2018-03-05 11:52:41 -03:00
2017-09-21 13:28:06 -03:00
2017-09-21 13:28:06 -03:00
2018-08-08 15:26:48 -03:00
2019-04-05 22:33:07 +02:00
2018-08-03 10:34:18 -03:00
2017-11-02 11:10:55 +01:00
2019-07-31 07:27:06 +02:00
2017-11-18 08:59:27 +01:00
2017-07-18 23:14:08 -03:00
2018-10-05 11:11:55 -03:00
2017-08-22 12:09:04 -03:00
2017-08-22 12:09:04 -03:00
2020-10-01 13:14:46 +02:00
2018-08-10 15:29:35 -03:00
2020-07-22 09:31:58 +02:00
2018-01-08 11:11:57 -03:00
2020-03-05 16:42:22 +01:00
2020-07-22 09:32:06 +02:00
2019-10-11 18:21:29 +02:00
2020-01-04 19:13:24 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:55 -03:00
2017-12-27 12:15:55 -03:00
2017-04-24 13:43:33 -03:00
2017-11-02 11:10:55 +01:00
2019-01-26 09:32:40 +01:00
2017-11-02 11:10:55 +01:00
2018-04-27 10:47:06 -03:00
2020-10-01 13:14:47 +02:00
2018-04-27 10:47:06 -03:00
2020-06-22 09:05:30 +02:00
2019-08-16 10:12:41 +02:00
2018-07-24 14:53:01 -03:00
2017-11-02 11:10:55 +01:00
2016-07-29 11:54:35 -03:00
2017-12-27 12:15:47 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-27 11:29:21 -03:00
2018-02-27 11:29:21 -03:00
2018-11-21 09:19:19 +01:00
2018-11-21 09:19:19 +01:00
2019-08-16 10:12:41 +02:00
2019-01-09 17:38:42 +01:00
2018-01-17 10:23:36 -03:00
2018-01-17 10:23:36 -03:00
2018-01-10 12:00:55 -03:00
2013-12-19 14:43:45 -03:00
2018-06-04 10:28:52 -03:00
2018-11-13 11:08:22 -08:00
2018-11-13 11:08:22 -08:00
2018-11-13 11:08:22 -08:00
2018-08-10 15:29:35 -03:00
2018-08-13 15:22:18 -03:00
2018-08-13 15:21:43 -03:00
2018-03-06 11:31:14 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-11-27 16:12:59 +01:00
2017-11-02 11:10:55 +01:00
2018-07-24 14:53:11 -03:00
2017-12-27 12:15:52 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-17 16:31:32 -03:00
2018-05-17 16:31:32 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-26 13:47:15 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-10-05 13:09:47 +02:00
2018-08-20 08:54:59 -03:00