Jin Yao
8adc0a06d6
perf script: Fix overrun issue for dynamically-allocated PMU type number
...
When unpacking the event which is from dynamic PMU, the array
output[OUTPUT_TYPE_MAX] may be overrun. For example, type number of SKL
uncore_imc is 10, but OUTPUT_TYPE_MAX is 7 now (OUTPUT_TYPE_MAX =
PERF_TYPE_MAX + 1).
/* In builtin-script.c */
process_event()
{
unsigned int type = output_type(attr->type);
if (output[type].fields == 0)
return;
}
output[10] is overrun.
Create a type OUTPUT_TYPE_OTHER for dynamic PMU events, then
output_type(attr->type) will return OUTPUT_TYPE_OTHER here.
Note that if PERF_TYPE_MAX ever changed, then there would be a conflict
between old perf.data files that had a dynamicaliy allocated PMU number
that would then be the same as a fixed PERF_TYPE.
Example:
# perf record --switch-events -C 0 -e "{cpu-clock,uncore_imc/data_reads/,uncore_imc/data_writes/}:SD" -a -- sleep 1
# perf script
Before:
swapper 0 [000] 1479253.987551: 277766 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.987797: 246709 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.988127: 329883 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.988273: 146393 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.988523: 249977 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.988877: 354090 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.989023: 145940 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.989383: 359856 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1479253.989523: 140082 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
After:
swapper 0 [000] 1397040.402011: 272384 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1397040.402011: 5396 uncore_imc/data_reads/:
swapper 0 [000] 1397040.402011: 967 uncore_imc/data_writes/:
swapper 0 [000] 1397040.402259: 249153 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1397040.402259: 7231 uncore_imc/data_reads/:
swapper 0 [000] 1397040.402259: 1297 uncore_imc/data_writes/:
swapper 0 [000] 1397040.402508: 249108 cpu-clock: ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
swapper 0 [000] 1397040.402508: 5333 uncore_imc/data_reads/:
swapper 0 [000] 1397040.402508: 1008 uncore_imc/data_writes/:
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Link: https://lore.kernel.org/r/20201209005828.21302-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-01-21 17:25:33 -03:00
..
2020-12-24 09:24:20 -03:00
2020-11-12 17:55:41 -03:00
2020-12-19 17:52:24 -03:00
2021-01-15 16:31:46 -03:00
2020-02-18 10:13:28 -03:00
2020-05-29 16:51:38 -03:00
2020-12-17 14:36:17 -03:00
2020-12-08 23:30:04 +09:00
2020-09-23 12:58:53 -03:00
2021-01-15 16:31:46 -03:00
2020-12-24 09:24:19 -03:00
2020-11-30 15:01:08 -03:00
2021-01-21 17:25:33 -03:00
2020-03-25 11:50:48 +01:00
2020-11-30 15:00:12 -03:00
2020-10-13 10:59:42 -03:00
2020-10-14 08:46:22 -03:00
2019-09-20 15:58:11 -03:00
2020-11-11 12:27:06 -03:00
2019-09-20 09:19:20 -03:00
2020-08-06 09:43:37 -03:00
2020-11-30 15:18:48 -03:00
2020-12-17 14:36:17 -03:00
2020-11-30 14:56:52 -03:00
2019-08-31 19:10:19 -03:00
2020-11-30 08:56:55 -03:00
2019-08-31 22:24:10 -03:00
2020-11-30 09:48:07 -03:00
2020-11-30 15:15:30 -03:00
2020-09-09 11:12:10 -03:00
2020-11-12 17:55:41 -03:00
2020-12-19 17:53:29 -03:00
2020-05-28 10:03:24 -03:00
2020-12-17 14:36:16 -03:00
2020-12-17 14:36:17 -03:00
2020-11-30 09:48:07 -03:00
2021-01-21 17:25:33 -03:00
2020-12-24 10:05:25 -03:00
2020-05-28 10:03:27 -03:00
2020-11-30 15:15:30 -03:00
2020-11-30 15:15:30 -03:00
2020-11-04 09:42:40 -03:00
2020-12-24 09:24:20 -03:00
2020-04-16 12:19:08 -03:00
2020-03-06 17:08:28 -03:00
2020-11-03 08:24:54 -03:00
2020-11-11 12:18:22 -08:00
2020-01-06 11:46:09 -03:00
2020-09-10 11:55:37 -03:00
2019-09-25 09:51:49 -03:00