Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf script cs_etm: Add map_pgoff to python dictionary

Extract map_pgoff parameter from the dictionary, and adjust start/end
range passed to objdump based on the value.

A zero start_addr is filtered to prevent output of dso address range
check failures. This script repeatedly sees a zero value passed
in for
      start_addr = cpu_data[str(cpu) + 'addr']

These zero values are not a new problem. The start_addr/stop_addr warning
clutters the instruction trace output, hence this change.

Signed-off-by: Steve Clevenger <scclevenger@os.amperecomputing.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Cc: suzuki.poulose@arm.com
Cc: james.clark@linaro.org
Cc: mike.leach@linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Cc: ilkka@os.amperecomputing.com
Link: https://lore.kernel.org/r/8d9a1142dc58ffa34a000cb7b7a26055df0a37ec.1731027120.git.scclevenger@os.amperecomputing.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Steve Clevenger and committed by
Namhyung Kim
26ec3d7c 62a6d092

+6 -3
+6 -3
tools/perf/util/scripting-engines/trace-event-python.c
··· 793 793 static void set_sym_in_dict(PyObject *dict, struct addr_location *al, 794 794 const char *dso_field, const char *dso_bid_field, 795 795 const char *dso_map_start, const char *dso_map_end, 796 - const char *sym_field, const char *symoff_field) 796 + const char *sym_field, const char *symoff_field, 797 + const char *map_pgoff) 797 798 { 798 799 char sbuild_id[SBUILD_ID_SIZE]; 799 800 ··· 810 809 PyLong_FromUnsignedLong(map__start(al->map))); 811 810 pydict_set_item_string_decref(dict, dso_map_end, 812 811 PyLong_FromUnsignedLong(map__end(al->map))); 812 + pydict_set_item_string_decref(dict, map_pgoff, 813 + PyLong_FromUnsignedLongLong(map__pgoff(al->map))); 813 814 } 814 815 if (al->sym) { 815 816 pydict_set_item_string_decref(dict, sym_field, ··· 898 895 pydict_set_item_string_decref(dict, "comm", 899 896 _PyUnicode_FromString(thread__comm_str(al->thread))); 900 897 set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end", 901 - "symbol", "symoff"); 898 + "symbol", "symoff", "map_pgoff"); 902 899 903 900 pydict_set_item_string_decref(dict, "callchain", callchain); 904 901 ··· 923 920 PyBool_FromLong(1)); 924 921 set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid", 925 922 "addr_dso_map_start", "addr_dso_map_end", 926 - "addr_symbol", "addr_symoff"); 923 + "addr_symbol", "addr_symoff", "addr_map_pgoff"); 927 924 } 928 925 929 926 if (sample->flags)