perf fixes
Subsystems (3)
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
# HEAD: cf230918cda19532e4a5cc4f0d5c82fa7e5e94f6 Merge branch 'perf/core' into perf/urgent, to pick up the latest fixes
This is larger than usual: the main reason are the ARM symbol lookup speedups that came in late and were hard to resist. If it's not acceptable then I'll restructure it without those bits.
There's also a kprobes fix and various tooling fixes, plus the minimal re-enablement of the mmap2 support interface.
Thanks,
Ingo
------------------>
Arnaldo Carvalho de Melo (2):
perf tools: Emit more precise message for missing glibc static library perf tests: Show the inner make output when an error happens
Don Zickus (6):
perf tools: Update mmap2 interface with protection and flag bits Revert "perf: Disable PERF_RECORD_MMAP2 support"
perf report: Add mem-mode documentation to report command perf tools: Add cpumode to struct hist_entry
perf tools: Add support to dynamically get cacheline size perf tools: Add dcacheline sort
Jiri Olsa (15):
perf tools: Fix pipe check regression in attr event callback perf tools: Prettify the tags/TAGS/cscope targets output perf tools: Cache register accesses for unwind processing perf tools: Separate dso data related variables
perf tools: Add data_fd into dso object
perf tools: Add global list of opened dso objects perf tools: Add global count of opened dso objects perf tools: Cache dso data file descriptor
perf tools: Add file size check and factor dso__data_read_offset perf tools: Allow to close dso fd in case of open failure perf tools: Add dso__data_* interface descriptons perf tests: Spawn child for each test
perf tests: Allow reuse of test_file function
perf tests: Add test for caching dso file descriptors perf tests: Add test for closing dso objects on EMFILE error
Masami Hiramatsu (5):
perf probe: Improve error message for unknown member of data structure perf probe: Show error code and description in verbose mode perf probe: Improve an error message of perf probe --vars mode perf probe: Improve error messages in --line option x86/kprobes: Fix build errors and blacklist context_track_user
Namhyung Kim (2):
perf script/python: Print array argument as string perf record: Fix to honor user freq/interval properly
Peter Zijlstra (1):
perf: Pass protection and flags bits through mmap2 interface
Stanislav Fomichev (1):
perf timechart: Reflow documentation
Steven Rostedt (1):
tools lib traceevent: Add options to plugins
Steven Rostedt (Red Hat) (3):
tools lib traceevent: Add flag to not load event plugins tools lib traceevent: Add options to function plugin tools lib traceevent: Added support for __get_bitmask() macro
arch/x86/kernel/traps.c | 7 +- include/uapi/linux/perf_event.h | 1 + kernel/context_tracking.c | 3 + kernel/events/core.c | 37 ++- tools/lib/traceevent/event-parse.c | 113 +++++++++ tools/lib/traceevent/event-parse.h | 25 +- tools/lib/traceevent/event-plugin.c | 203 ++++++++++++++- tools/lib/traceevent/plugin_function.c | 43 +++- tools/perf/Documentation/perf-report.txt | 23 ++ tools/perf/Documentation/perf-timechart.txt | 41 ++- tools/perf/Makefile.perf | 6 +- tools/perf/builtin-inject.c | 2 +- tools/perf/builtin-probe.c | 23 +- tools/perf/config/Makefile | 6 +- tools/perf/perf.c | 1 + tools/perf/tests/builtin-test.c | 42 +++- tools/perf/tests/dso-data.c | 214 +++++++++++++++- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/make | 7 +- tools/perf/tests/tests.h | 2 + tools/perf/util/dso.c | 279 +++++++++++++++++++-- tools/perf/util/dso.h | 50 +++- tools/perf/util/event.c | 57 +++-- tools/perf/util/event.h | 7 + tools/perf/util/evsel.c | 5 +- tools/perf/util/hist.c | 9 +- tools/perf/util/hist.h | 1 + tools/perf/util/machine.c | 4 +- tools/perf/util/map.c | 4 +- tools/perf/util/map.h | 4 +- tools/perf/util/perf_regs.c | 10 +- tools/perf/util/perf_regs.h | 4 +- tools/perf/util/probe-event.c | 13 +- tools/perf/util/probe-finder.c | 11 +- .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 2 + tools/perf/util/sort.c | 107 ++++++++ tools/perf/util/sort.h | 2 + tools/perf/util/unwind-libunwind.c | 2 - tools/perf/util/util.c | 1 + tools/perf/util/util.h | 1 + 41 files changed, 1249 insertions(+), 126 deletions(-)
arch/x86/kernel/traps.c +4 -3
@@ -343,6 +343,7 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)if (poke_int3_handler (regs))return ; + prev_state =exception_enter ();#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP if (kgdb_ll_trap (DIE_INT3 ,"int3" , regs, error_code,X86_TRAP_BP ,SIGTRAP ) ==NOTIFY_STOP )
@@ -351,9 +352,8 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)#ifdef CONFIG_KPROBES if (kprobe_int3_handler (regs)) -return ; + goto exit;#endif - prev_state =exception_enter ();if (notify_die (DIE_INT3 ,"int3" , regs, error_code,X86_TRAP_BP ,SIGTRAP ) ==NOTIFY_STOP )
@@ -433,6 +433,8 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)unsigned long dr6;int si_code; + prev_state =exception_enter (); +get_debugreg (dr6,6 );/* Filter out all the reserved bits which are preset to 1 */
@@ -465,7 +467,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)if (kprobe_debug_handler (regs)) goto exit;#endif - prev_state =exception_enter ();if (notify_die (DIE_DEBUG ,"debug" , regs, (long )&dr6, error_code,SIGTRAP ) ==NOTIFY_STOP )
include/uapi/linux/perf_event.h +1 -0
@@ -705,6 +705,7 @@ enum perf_event_type {* u32 min; * u64 ino; * u64 ino_generation; +* u32 prot, flags; * char filename[]; * struct sample_id sample_id; * };
kernel/context_tracking.c +3 -0
@@ -19,6 +19,7 @@#include <linux/sched.h> #include <linux/hardirq.h> #include <linux/export.h> +#include <linux/kprobes.h> #define CREATE_TRACE_POINTS #include <trace/events/context_tracking.h>
@@ -104,6 +105,7 @@ void context_tracking_user_enter(void) }local_irq_restore (flags); } +NOKPROBE_SYMBOL (context_tracking_user_enter);#ifdef CONFIG_PREEMPT /**
@@ -181,6 +183,7 @@ void context_tracking_user_exit(void) }local_irq_restore (flags); } +NOKPROBE_SYMBOL (context_tracking_user_exit);/** * __context_tracking_task_switch - context switch the syscall callbacks
kernel/events/core.c +33 -4
@@ -40,6 +40,7 @@#include <linux/mm_types.h> #include <linux/cgroup.h> #include <linux/module.h> +#include <linux/mman.h> #include "internal.h"
@@ -5128,6 +5129,7 @@ struct perf_mmap_event {int maj, min;u64 ino;u64 ino_generation; +u32 prot, flags;struct {struct perf_event_header header;
@@ -5169,6 +5171,8 @@ static void perf_event_mmap_output(struct perf_event *event, mmap_event->event_id.header.size +=sizeof (mmap_event->min); mmap_event->event_id.header.size +=sizeof (mmap_event->ino); mmap_event->event_id.header.size +=sizeof (mmap_event->ino_generation); + mmap_event->event_id.header.size +=sizeof (mmap_event->prot); + mmap_event->event_id.header.size +=sizeof (mmap_event->flags); }perf_event_header__init_id (&mmap_event->event_id.header, &sample, event);
@@ -5187,6 +5191,8 @@ static void perf_event_mmap_output(struct perf_event *event,perf_output_put (&handle, mmap_event->min);perf_output_put (&handle, mmap_event->ino);perf_output_put (&handle, mmap_event->ino_generation); +perf_output_put (&handle, mmap_event->prot); +perf_output_put (&handle, mmap_event->flags); } __output_copy(&handle, mmap_event->file_name,
@@ -5205,6 +5211,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)struct file *file = vma->vm_file;int maj =0 , min =0 ;u64 ino =0 , gen =0 ; +u32 prot =0 , flags =0 ;unsigned int size;char tmp[16 ];char *buf =NULL ;
@@ -5235,6 +5242,28 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) gen = inode->i_generation; maj =MAJOR (dev); min =MINOR (dev); + +if (vma->vm_flags &VM_READ ) + prot |=PROT_READ ; +if (vma->vm_flags &VM_WRITE ) + prot |=PROT_WRITE ; +if (vma->vm_flags &VM_EXEC ) + prot |=PROT_EXEC ; + +if (vma->vm_flags &VM_MAYSHARE ) + flags =MAP_SHARED ; +else + flags =MAP_PRIVATE ; + +if (vma->vm_flags &VM_DENYWRITE ) + flags |=MAP_DENYWRITE ; +if (vma->vm_flags &VM_MAYEXEC ) + flags |=MAP_EXECUTABLE ; +if (vma->vm_flags &VM_LOCKED ) + flags |=MAP_LOCKED ; +if (vma->vm_flags &VM_HUGETLB ) + flags |=MAP_HUGETLB ; + goto got_name; }else { name = (char *)arch_vma_name (vma);
@@ -5275,6 +5304,8 @@ got_name: mmap_event->min = min; mmap_event->ino = ino; mmap_event->ino_generation = gen; + mmap_event->prot = prot; + mmap_event->flags = flags;if (!(vma->vm_flags &VM_EXEC )) mmap_event->event_id.header.misc |=PERF_RECORD_MISC_MMAP_DATA ;
@@ -5315,6 +5346,8 @@ void perf_event_mmap(struct vm_area_struct *vma)/* .min (attr_mmap2 only) */ /* .ino (attr_mmap2 only) */ /* .ino_generation (attr_mmap2 only) */ +/* .prot (attr_mmap2 only) */ +/* .flags (attr_mmap2 only) */ };perf_event_mmap_event (&mmap_event);
@@ -6897,10 +6930,6 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,if (ret)return -EFAULT ; -/* disabled for now */ -if (attr->mmap2) -return -EINVAL ; -if (attr->__reserved_1)return -EINVAL ;
tools/lib/traceevent/event-parse.c +113 -0
167 lines not on this page · raw message
tools/lib/traceevent/event-parse.h +22 -3
@@ -107,8 +107,8 @@ typedef int (*pevent_event_handler_func)(struct trace_seq *s,typedef int (*pevent_plugin_load_func )(struct pevent *pevent);typedef int (*pevent_plugin_unload_func )(struct pevent *pevent); -struct plugin_option { -struct plugin_option *next; +struct pevent_plugin_option { +struct pevent_plugin_option *next;void *handle;char *file;char *name;
@@ -135,7 +135,7 @@ struct plugin_option {* PEVENT_PLUGIN_OPTIONS: (optional) * Plugin options that can be set before loading * -* struct plugin_option PEVENT_PLUGIN_OPTIONS[] = { +* struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { * { * .name = "option-name", * .plugin_alias = "overide-file-name", (optional)
@@ -208,6 +208,11 @@ struct print_arg_string {int offset; }; +struct print_arg_bitmask { +char *bitmask; +int offset; +}; +struct print_arg_field {char *name;struct format_field *field;
@@ -274,6 +279,7 @@ enum print_arg_type {PRINT_DYNAMIC_ARRAY ,PRINT_OP ,PRINT_FUNC , + PRINT_BITMASK, }; struct print_arg {
@@ -288,6 +294,7 @@ struct print_arg {struct print_arg_hex hex;struct print_arg_func func;struct print_arg_string string; +struct print_arg_bitmask bitmask;struct print_arg_op op;struct print_arg_dynarray dynarray; };
@@ -354,6 +361,8 @@ enum pevent_func_arg_type {enum pevent_flag {PEVENT_NSEC_OUTPUT =1 ,/* output in NSECS */ +PEVENT_DISABLE_SYS_PLUGINS =1 <<1 , +PEVENT_DISABLE_PLUGINS =1 <<2 , };#define PEVENT_ERRORS \
@@ -410,9 +419,19 @@ enum pevent_errno {struct plugin_list ; +#define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1)) +struct plugin_list *traceevent_load_plugins (struct pevent *pevent);void traceevent_unload_plugins (struct plugin_list *plugin_list,struct pevent *pevent); +char **traceevent_plugin_list_options (void ); +void traceevent_plugin_free_options_list (char **list); +int traceevent_plugin_add_options (const char *name, +struct pevent_plugin_option *options); +void traceevent_plugin_remove_options (struct pevent_plugin_option *options); +void traceevent_print_plugins (struct trace_seq *s, +const char *prefix,const char *suffix, +const struct plugin_list *list);struct cmdline ;struct cmdline_list ;
tools/lib/traceevent/event-plugin.c +202 -1
232 lines not on this page · raw message
tools/lib/traceevent/plugin_function.c +37 -6
73 lines not on this page · raw message
tools/perf/Documentation/perf-report.txt +23 -0
@@ -117,6 +117,22 @@ OPTIONS By default, every sort keys not specified in -F will be appended automatically. + If --mem-mode option is used, following sort keys are also available + (incompatible with --branch-stack): + symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline. + + - symbol_daddr: name of data symbol being executed on at the time of sample + - dso_daddr: name of library or module containing the data being executed + on at the time of sample + - locked: whether the bus was locked at the time of sample + - tlb: type of tlb access for the data at the time of sample + - mem: type of memory access for the data at the time of sample + - snoop: type of snoop (if any) for the data at the time of sample + - dcacheline: the cacheline the data address is on at the time of sample + + And default sort keys are changed to local_weight, mem, sym, dso, + symbol_daddr, dso_daddr, snoop, tlb, locked, see '--mem-mode'. + -p:: --parent=<regex>:: A regex filter to identify parent. The parent is a caller of this
@@ -260,6 +276,13 @@ OPTIONS Demangle symbol names to human readable form. It's enabled by default, disable with --no-demangle. +--mem-mode:: + Use the data addresses of samples in addition to instruction addresses + to build the histograms. To generate meaningful output, the perf.data + file must have been obtained using perf record -d -W and using a + special event -e cpu/mem-loads/ or -e cpu/mem-stores/. See + 'perf mem' for simpler access. + --percent-limit:: Do not show entries which have an overhead under that percent. (Default: 0).
tools/perf/Documentation/perf-timechart.txt +20 -21
53 lines not on this page · raw message
tools/perf/Makefile.perf +3 -3
@@ -819,15 +819,15 @@ TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol TAG_FILES= ../../include/uapi/linux/perf_event.h TAGS: - $(RM) TAGS + $(QUIET_GEN)$(RM) TAGS; \ $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES) tags: - $(RM) tags + $(QUIET_GEN)$(RM) tags; \ $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES) cscope: - $(RM) cscope* + $(QUIET_GEN)$(RM) cscope*; \ $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES) ### Detect prefix changes
tools/perf/builtin-inject.c +1 -1
@@ -72,7 +72,7 @@ static int perf_event__repipe_attr(struct perf_tool *tool,if (ret)return ret; -if (&inject->output.is_pipe) +if (!inject->output.is_pipe)return 0 ;return perf_event__repipe_synth (tool, event);
tools/perf/builtin-probe.c +14 -9
@@ -288,6 +288,13 @@ static void cleanup_params(void)memset (¶ms,0 ,sizeof (params)); } +static void pr_err_with_code (const char *msg,int err) +{ +pr_err ("%s" , msg); +pr_debug (" Reason: %s (Code: %d)" ,strerror (-err), err); +pr_err ("\n" ); +} +static int __cmd_probe (int argc,const char **argv,const char *prefix__maybe_unused ) {
@@ -379,7 +386,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) } ret =parse_probe_event_argv (argc, argv);if (ret <0 ) { -pr_err (" Error: Parse Error. (%d)\n" , ret); +pr_err_with_code (" Error: Command Parse Error." , ret);return ret; } }
@@ -419,8 +426,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) } ret =show_perf_probe_events ();if (ret <0 ) -pr_err (" Error: Failed to show event list. (%d)\n" , - ret); +pr_err_with_code (" Error: Failed to show event list." , ret);return ret; }if (params.show_funcs) {
@@ -445,8 +451,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)strfilter__delete (params.filter); params.filter =NULL ;if (ret <0 ) -pr_err (" Error: Failed to show functions." -" (%d)\n" , ret); +pr_err_with_code (" Error: Failed to show functions." , ret);return ret; }
@@ -464,7 +469,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) ret =show_line_range (¶ms.line_range, params.target);if (ret <0 ) -pr_err (" Error: Failed to show lines. (%d)\n" , ret); +pr_err_with_code (" Error: Failed to show lines." , ret);return ret; }if (params.show_vars) {
@@ -485,7 +490,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)strfilter__delete (params.filter); params.filter =NULL ;if (ret <0 ) -pr_err (" Error: Failed to show vars. (%d)\n" , ret); +pr_err_with_code (" Error: Failed to show vars." , ret); return ret; }#endif
@@ -493,7 +498,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)if (params.dellist) { ret =del_perf_probe_events (params.dellist);if (ret <0 ) { -pr_err (" Error: Failed to delete events. (%d)\n" , ret); +pr_err_with_code (" Error: Failed to delete events." , ret);return ret; } }
@@ -504,7 +509,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) params.target, params.force_add);if (ret <0 ) { -pr_err (" Error: Failed to add events. (%d)\n" , ret); +pr_err_with_code (" Error: Failed to add events." , ret);return ret; } }
tools/perf/config/Makefile +5 -1
@@ -299,7 +299,11 @@ else NO_LIBUNWIND := 1 NO_LIBDW_DWARF_UNWIND := 1 else - msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); + ifneq ($(filter s% -static%,$(LDFLAGS),),) + msg := $(error No static glibc found, please install glibc-static); + else + msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); + endif endif else ifndef NO_LIBDW_DWARF_UNWIND
tools/perf/perf.c +1 -0
@@ -458,6 +458,7 @@ int main(int argc, const char **argv)/* The page_size is placed in util object. */ page_size =sysconf (_SC_PAGE_SIZE); + cacheline_size =sysconf (_SC_LEVEL1_DCACHE_LINESIZE); cmd =perf_extract_argv0_path (argv[0 ]);if (!cmd)
tools/perf/tests/builtin-test.c +40 -2
69 lines not on this page · raw message
tools/perf/tests/dso-data.c +210 -4
235 lines not on this page · raw message
tools/perf/tests/dwarf-unwind.c +1 -1
@@ -15,7 +15,7 @@ static int mmap_handler(struct perf_tool *tool __maybe_unused,struct perf_sample *sample__maybe_unused , struct machine *machine) { - return machine__process_mmap_event(machine, event, NULL); + return machine__process_mmap2_event(machine, event, NULL); }static int init_live_machine (struct machine *machine)
tools/perf/tests/make +2 -5
@@ -205,8 +205,7 @@ $(run): ( eval $$cmd ) >> $@ 2>&1; \ echo " test: $(call test,$@)" >> $@ 2>&1; \ $(call test,$@) && \ - rm -f $@ \ - rm -rf $$TMP_DEST + rm -rf $@ $$TMP_DEST || (cat $@ ; false) $(run_O): $(call clean)
@@ -217,9 +216,7 @@ $(run_O): ( eval $$cmd ) >> $@ 2>&1 && \ echo " test: $(call test_O,$@)" >> $@ 2>&1; \ $(call test_O,$@) && \ - rm -f $@ && \ - rm -rf $$TMP_O \ - rm -rf $$TMP_DEST + rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) tarpkg: @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
tools/perf/tests/tests.h +2 -0
@@ -28,6 +28,8 @@ int test__syscall_open_tp_fields(void);int test__pmu (void );int test__attr (void );int test__dso_data (void ); +int test__dso_data_cache (void ); +int test__dso_data_reopen (void );int test__parse_events (void );int test__hists_link (void );int test__python_use (void );
tools/perf/util/dso.c +254 -25
379 lines not on this page · raw message
tools/perf/util/dso.h +49 -1
69 lines not on this page · raw message
tools/perf/util/event.c +41 -16
106 lines not on this page · raw message
tools/perf/util/event.h +7 -0
@@ -7,6 +7,7 @@#include "../perf.h" #include "map.h" #include "build-id.h" +#include "perf_regs.h" struct mmap_event {struct perf_event_header header;
@@ -27,6 +28,8 @@ struct mmap2_event {u32 min;u64 ino;u64 ino_generation; +u32 prot; +u32 flags;char filename[PATH_MAX ]; };
@@ -87,6 +90,10 @@ struct regs_dump {u64 abi;u64 mask;u64 *regs; + +/* Cached values/mask filled by first register access. */ +u64 cache_regs[PERF_REGS_MAX ]; +u64 cache_mask; };struct stack_dump {
tools/perf/util/evsel.c +3 -2
@@ -589,10 +589,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) }/* -* We default some events to a 1 default interval. But keep +* We default some events to have a default interval. But keep * it a weak assumption overridable by the user. */ -if (!attr->sample_period || (opts->user_freq !=UINT_MAX && +if (!attr->sample_period || (opts->user_freq !=UINT_MAX || opts->user_interval !=ULLONG_MAX )) {if (opts->freq) {perf_evsel__set_sample_bit (evsel,PERIOD );
@@ -659,6 +659,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)perf_evsel__set_sample_bit (evsel,WEIGHT ); attr->mmap = track; + attr->mmap2 = track && !perf_missing_features.mmap2; attr->comm = track;if (opts->sample_transaction)
tools/perf/util/hist.c +6 -3
@@ -128,6 +128,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) + unresolved_col_width +2 ;hists__new_col_len (hists,HISTC_MEM_DADDR_SYMBOL , symlen); +hists__new_col_len (hists,HISTC_MEM_DCACHELINE , + symlen +1 ); }else { symlen = unresolved_col_width +4 +2 ; hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
@@ -439,9 +441,10 @@ struct hist_entry *__hists__add_entry(struct hists *hists, .map = al->map, .sym = al->sym, }, - .cpu = al->cpu, - .ip = al->addr, - .level = al->level, + .cpu = al->cpu, + .cpumode = al->cpumode, + .ip = al->addr, + .level = al->level, .stat = { .nr_events = 1, .period = period,
tools/perf/util/hist.h +1 -0
@@ -72,6 +72,7 @@ enum hist_column {HISTC_MEM_TLB ,HISTC_MEM_LVL ,HISTC_MEM_SNOOP , +HISTC_MEM_DCACHELINE ,HISTC_TRANSACTION , HISTC_NR_COLS, /* Last entry */ };
tools/perf/util/machine.c +3 -1
@@ -1060,6 +1060,8 @@ int machine__process_mmap2_event(struct machine *machine, event->mmap2.pid, event->mmap2.maj, event->mmap2.min, event->mmap2.ino, event->mmap2.ino_generation, + event->mmap2.prot, + event->mmap2.flags, event->mmap2.filename, type);if (map ==NULL )
@@ -1105,7 +1107,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event map =map__new (&machine->user_dsos, event->mmap.start, event->mmap.len, event->mmap.pgoff, - event->mmap.pid,0 ,0 ,0 ,0 , + event->mmap.pid,0 ,0 ,0 ,0 ,0 ,0 , event->mmap.filename, type);
tools/perf/util/map.c +3 -1
@@ -138,7 +138,7 @@ void map__init(struct map *map, enum map_type type,struct map *map__new (struct list_head *dsos__list,u64 start,u64 len,u64 pgoff,u32 pid,u32 d_maj,u32 d_min,u64 ino, -u64 ino_gen,char *filename, +u64 ino_gen,u32 prot,u32 flags,char *filename,enum map_type type) {struct map *map =malloc (sizeof (*map));
@@ -157,6 +157,8 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, map->min = d_min; map->ino = ino; map->ino_generation = ino_gen; + map->prot = prot; + map->flags = flags;if ((anon || no_dso) && type ==MAP__FUNCTION ) {snprintf (newfilename,sizeof (newfilename),"/tmp/perf-%d.map" , pid);
tools/perf/util/map.h +3 -1
@@ -35,6 +35,8 @@ struct map {bool referenced;bool erange_warned;u32 priv; +u32 prot; +u32 flags;u64 pgoff;u64 reloc;u32 maj, min;/* only valid for MMAP2 record */
@@ -118,7 +120,7 @@ void map__init(struct map *map, enum map_type type, u64 start, u64 end, u64 pgoff, struct dso *dso);struct map *map__new (struct list_head *dsos__list,u64 start,u64 len,u64 pgoff,u32 pid,u32 d_maj,u32 d_min,u64 ino, -u64 ino_gen, +u64 ino_gen,u32 prot,u32 flags,char *filename,enum map_type type);struct map *map__new2 (u64 start,struct dso *dso,enum map_type type);void map__delete (struct map *map);
tools/perf/util/perf_regs.c +9 -1
@@ -1,11 +1,15 @@#include <errno.h> #include "perf_regs.h" +#include "event.h" int perf_reg_value (u64 *valp,struct regs_dump *regs,int id) {int i, idx =0 ;u64 mask = regs->mask; +if (regs->cache_mask & (1 << id)) + goto out; +if (!(mask & (1 << id)))return -EINVAL ;
@@ -14,6 +18,10 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) idx++; } - *valp = regs->regs[idx]; + regs->cache_mask |= (1 << id); + regs->cache_regs[id] = regs->regs[idx]; + +out: + *valp = regs->cache_regs[id];return 0 ; }
tools/perf/util/perf_regs.h +3 -1
@@ -2,7 +2,8 @@#define __PERF_REGS_H#include <linux/types.h> -#include "event.h" + +struct regs_dump ;#ifdef HAVE_PERF_REGS_SUPPORT #include <perf_regs.h>
@@ -11,6 +12,7 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);#else #define PERF_REGS_MASK 0 +#define PERF_REGS_MAX 0static inline const char *perf_reg_name (int id__maybe_unused ) {
tools/perf/util/probe-event.c +9 -4
@@ -628,11 +628,11 @@ static int __show_line_range(struct line_range *lr, const char *module) ret =debuginfo__find_line_range (dinfo, lr);debuginfo__delete (dinfo); -if (ret ==0 ) { +if (ret ==0 || ret == -ENOENT ) {pr_warning ("Specified source line is not found.\n" );return -ENOENT ; }else if (ret <0 ) { -pr_warning ("Debuginfo analysis failed. (%d)\n" , ret); +pr_warning ("Debuginfo analysis failed.\n" );return ret; }
@@ -641,7 +641,7 @@ static int __show_line_range(struct line_range *lr, const char *module) ret =get_real_path (tmp, lr->comp_dir, &lr->path);free (tmp);/* Free old path */ if (ret <0 ) { -pr_warning ("Failed to find source file. (%d)\n" , ret); +pr_warning ("Failed to find source file path.\n" );return ret; }
@@ -721,9 +721,14 @@ static int show_available_vars_at(struct debuginfo *dinfo, ret =debuginfo__find_available_vars_at (dinfo, pev, &vls, max_vls, externs);if (ret <=0 ) { -pr_err ("Failed to find variables at %s (%d)\n" , buf, ret); +if (ret ==0 || ret == -ENOENT ) { +pr_err ("Failed to find the address of %s\n" , buf); + ret = -ENOENT ; + }else +pr_warning ("Debuginfo analysis failed.\n" ); goto end; } +/* Some variables are found */ fprintf (stdout,"Available variables at %s\n" , buf);for (i =0 ; i < ret; i++) {
tools/perf/util/probe-finder.c +7 -4
@@ -573,14 +573,13 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)if (!die_find_variable_at (sc_die, pf->pvar->var, pf->addr, &vr_die)) {/* Search again in global variables */ if (!die_find_variable_at (&pf->cu_die, pf->pvar->var,0 , &vr_die)) +pr_warning ("Failed to find '%s' in this function.\n" , + pf->pvar->var); ret = -ENOENT ; }if (ret >=0 ) ret =convert_variable (&vr_die, pf); -if (ret <0 ) -pr_warning ("Failed to find '%s' in this function.\n" , - pf->pvar->var);return ret; }
@@ -1281,7 +1280,11 @@ out:return ret; } -/* Find available variables at given probe point */ +/* +* Find available variables at given probe point +* Return the number of found probe points. Return 0 if there is no +* matched probe point. Return <0 if an error occurs. +*/ int debuginfo__find_available_vars_at(struct debuginfo *dbg, struct perf_probe_event *pev, struct variable_list **vls,
tools/perf/util/scripting-engines/trace-event-perl.c +1 -0
@@ -215,6 +215,7 @@ static void define_event_symbols(struct event_format *event,case PRINT_BSTRING :case PRINT_DYNAMIC_ARRAY :case PRINT_STRING : +case PRINT_BITMASK :break ;case PRINT_TYPE :define_event_symbols (event, ev_name, args->typecast.item);
tools/perf/util/scripting-engines/trace-event-python.c +2 -0
@@ -197,6 +197,7 @@ static void define_event_symbols(struct event_format *event,case PRINT_BSTRING :case PRINT_DYNAMIC_ARRAY :case PRINT_FUNC : +case PRINT_BITMASK :/* we should warn... */ return ; }
@@ -622,6 +623,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)fprintf (ofp,"%s=" , f->name);if (f->flags &FIELD_IS_STRING || f->flags &FIELD_IS_FLAG || + f->flags &FIELD_IS_ARRAY || f->flags &FIELD_IS_SYMBOLIC )fprintf (ofp,"%%s" );else if (f->flags &FIELD_IS_SIGNED )
tools/perf/util/sort.c +107 -0
128 lines not on this page · raw message
tools/perf/util/sort.h +2 -0
@@ -89,6 +89,7 @@ struct hist_entry {u64 ip;u64 transaction;s32 cpu; +u8 cpumode;struct hist_entry_diff diff;
@@ -185,6 +186,7 @@ enum sort_type {SORT_MEM_TLB ,SORT_MEM_LVL ,SORT_MEM_SNOOP , + SORT_MEM_DCACHELINE, };/*
tools/perf/util/unwind-libunwind.c +0 -2
@@ -250,7 +250,6 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,/* Check the .eh_frame section for unwinding info */ offset =elf_section_offset (fd,".eh_frame_hdr" ); -close (fd);if (offset) ret = unwind_spec_ehframe(dso, machine, offset,
@@ -271,7 +270,6 @@ static int read_unwind_spec_debug_frame(struct dso *dso,/* Check the .debug_frame section for unwinding info */ *offset =elf_section_offset (fd,".debug_frame" ); -close (fd);if (*offset)return 0 ;
tools/perf/util/util.c +1 -0
@@ -17,6 +17,7 @@* XXX We need to find a better place for these things... */ unsigned int page_size; +int cacheline_size;bool test_attr__enabled;
tools/perf/util/util.h +1 -0
@@ -304,6 +304,7 @@ char *rtrim(char *s);void dump_stack (void );extern unsigned int page_size; +extern int cacheline_size;void get_term_dimensions (struct winsize *ws);