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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf tool fixes from Thomas Gleixner:
"A couple of fixes for perf tools:

- Build system updates

- Plug a memory leak in an error path of perf probe

- Tear down probes correctly when adding fails

- Fixes to the perf symbol handling

- Fix ordering of event processing in buildid-list

- Fix per DSO filtering in the histogram browser"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf probe: Clear probe_trace_event when add_probe_trace_event() fails
perf probe: Fix memory leaking on failure by clearing all probe_trace_events
perf inject: Also re-pipe lost_samples event
perf buildid-list: Requires ordered events
perf symbols: Fix dso lookup by long name and missing buildids
perf symbols: Allow forcing reading of non-root owned files by root
perf hists browser: The dso can be obtained from popup_action->ms.map->dso
perf hists browser: Fix 'd' hotkey action to filter by DSO
perf symbols: Rebuild rbtree when adjusting symbols for kcore
tools: Add a "make all" rule
tools: Actually install tmon in the install rule

+69 -35
+10 -1
tools/Makefile
··· 32 32 @echo ' from the kernel command line to build and install one of' 33 33 @echo ' the tools above' 34 34 @echo '' 35 + @echo ' $$ make tools/all' 36 + @echo '' 37 + @echo ' builds all tools.' 38 + @echo '' 35 39 @echo ' $$ make tools/install' 36 40 @echo '' 37 41 @echo ' installs all tools.' ··· 81 77 freefall: FORCE 82 78 $(call descend,laptop/$@) 83 79 80 + all: acpi cgroup cpupower hv firewire lguest \ 81 + perf selftests turbostat usb \ 82 + virtio vm net x86_energy_perf_policy \ 83 + tmon freefall 84 + 84 85 acpi_install: 85 86 $(call descend,power/$(@:_install=),install) 86 87 ··· 110 101 install: acpi_install cgroup_install cpupower_install hv_install firewire_install lguest_install \ 111 102 perf_install selftests_install turbostat_install usb_install \ 112 103 virtio_install vm_install net_install x86_energy_perf_policy_install \ 113 - tmon freefall_install 104 + tmon_install freefall_install 114 105 115 106 acpi_clean: 116 107 $(call descend,power/acpi,clean)
+1
tools/perf/builtin-inject.c
··· 675 675 .fork = perf_event__repipe, 676 676 .exit = perf_event__repipe, 677 677 .lost = perf_event__repipe, 678 + .lost_samples = perf_event__repipe, 678 679 .aux = perf_event__repipe, 679 680 .itrace_start = perf_event__repipe, 680 681 .context_switch = perf_event__repipe,
+3 -3
tools/perf/builtin-report.c
··· 44 44 struct report { 45 45 struct perf_tool tool; 46 46 struct perf_session *session; 47 - bool force, use_tui, use_gtk, use_stdio; 47 + bool use_tui, use_gtk, use_stdio; 48 48 bool hide_unresolved; 49 49 bool dont_use_callchains; 50 50 bool show_full_info; ··· 678 678 "file", "vmlinux pathname"), 679 679 OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, 680 680 "file", "kallsyms pathname"), 681 - OPT_BOOLEAN('f', "force", &report.force, "don't complain, do it"), 681 + OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"), 682 682 OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules, 683 683 "load module symbols - WARNING: use only with -k and LIVE kernel"), 684 684 OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, ··· 832 832 } 833 833 834 834 file.path = input_name; 835 - file.force = report.force; 835 + file.force = symbol_conf.force; 836 836 837 837 repeat: 838 838 session = perf_session__new(&file, false, &report.tool);
+1 -6
tools/perf/ui/browsers/hists.c
··· 1430 1430 1431 1431 struct popup_action { 1432 1432 struct thread *thread; 1433 - struct dso *dso; 1434 1433 struct map_symbol ms; 1435 1434 int socket; 1436 1435 ··· 1564 1565 return 0; 1565 1566 1566 1567 act->ms.map = map; 1567 - act->dso = map->dso; 1568 1568 act->fn = do_zoom_dso; 1569 1569 return 1; 1570 1570 } ··· 1825 1827 1826 1828 while (1) { 1827 1829 struct thread *thread = NULL; 1828 - struct dso *dso = NULL; 1829 1830 struct map *map = NULL; 1830 1831 int choice = 0; 1831 1832 int socked_id = -1; ··· 1836 1839 if (browser->he_selection != NULL) { 1837 1840 thread = hist_browser__selected_thread(browser); 1838 1841 map = browser->selection->map; 1839 - if (map) 1840 - dso = map->dso; 1841 1842 socked_id = browser->he_selection->socket; 1842 1843 } 1843 1844 switch (key) { ··· 1869 1874 hist_browser__dump(browser); 1870 1875 continue; 1871 1876 case 'd': 1872 - actions->dso = dso; 1877 + actions->ms.map = map; 1873 1878 do_zoom_dso(browser, actions); 1874 1879 continue; 1875 1880 case 'V':
+1
tools/perf/util/build-id.c
··· 76 76 .exit = perf_event__exit_del_thread, 77 77 .attr = perf_event__process_attr, 78 78 .build_id = perf_event__process_build_id, 79 + .ordered_events = true, 79 80 }; 80 81 81 82 int build_id__sprintf(const u8 *build_id, int len, char *bf)
+17
tools/perf/util/dso.c
··· 933 933 /* Add new node and rebalance tree */ 934 934 rb_link_node(&dso->rb_node, parent, p); 935 935 rb_insert_color(&dso->rb_node, root); 936 + dso->root = root; 936 937 } 937 938 return NULL; 938 939 } ··· 946 945 947 946 void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated) 948 947 { 948 + struct rb_root *root = dso->root; 949 + 949 950 if (name == NULL) 950 951 return; 951 952 952 953 if (dso->long_name_allocated) 953 954 free((char *)dso->long_name); 954 955 956 + if (root) { 957 + rb_erase(&dso->rb_node, root); 958 + /* 959 + * __dso__findlink_by_longname() isn't guaranteed to add it 960 + * back, so a clean removal is required here. 961 + */ 962 + RB_CLEAR_NODE(&dso->rb_node); 963 + dso->root = NULL; 964 + } 965 + 955 966 dso->long_name = name; 956 967 dso->long_name_len = strlen(name); 957 968 dso->long_name_allocated = name_allocated; 969 + 970 + if (root) 971 + __dso__findlink_by_longname(root, dso, NULL); 958 972 } 959 973 960 974 void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated) ··· 1062 1046 dso->kernel = DSO_TYPE_USER; 1063 1047 dso->needs_swap = DSO_SWAP__UNSET; 1064 1048 RB_CLEAR_NODE(&dso->rb_node); 1049 + dso->root = NULL; 1065 1050 INIT_LIST_HEAD(&dso->node); 1066 1051 INIT_LIST_HEAD(&dso->data.open_entry); 1067 1052 pthread_mutex_init(&dso->lock, NULL);
+1
tools/perf/util/dso.h
··· 135 135 pthread_mutex_t lock; 136 136 struct list_head node; 137 137 struct rb_node rb_node; /* rbtree node sorted by long name */ 138 + struct rb_root *root; /* root of rbtree that rb_node is in */ 138 139 struct rb_root symbols[MAP__NR_TYPES]; 139 140 struct rb_root symbol_names[MAP__NR_TYPES]; 140 141 struct {
+1
tools/perf/util/machine.c
··· 91 91 92 92 list_for_each_entry_safe(pos, n, &dsos->head, node) { 93 93 RB_CLEAR_NODE(&pos->rb_node); 94 + pos->root = NULL; 94 95 list_del_init(&pos->node); 95 96 dso__put(pos); 96 97 }
+17 -7
tools/perf/util/probe-finder.c
··· 1183 1183 container_of(pf, struct trace_event_finder, pf); 1184 1184 struct perf_probe_point *pp = &pf->pev->point; 1185 1185 struct probe_trace_event *tev; 1186 - struct perf_probe_arg *args; 1186 + struct perf_probe_arg *args = NULL; 1187 1187 int ret, i; 1188 1188 1189 1189 /* Check number of tevs */ ··· 1198 1198 ret = convert_to_trace_point(&pf->sp_die, tf->mod, pf->addr, 1199 1199 pp->retprobe, pp->function, &tev->point); 1200 1200 if (ret < 0) 1201 - return ret; 1201 + goto end; 1202 1202 1203 1203 tev->point.realname = strdup(dwarf_diename(sc_die)); 1204 - if (!tev->point.realname) 1205 - return -ENOMEM; 1204 + if (!tev->point.realname) { 1205 + ret = -ENOMEM; 1206 + goto end; 1207 + } 1206 1208 1207 1209 pr_debug("Probe point found: %s+%lu\n", tev->point.symbol, 1208 1210 tev->point.offset); 1209 1211 1210 1212 /* Expand special probe argument if exist */ 1211 1213 args = zalloc(sizeof(struct perf_probe_arg) * MAX_PROBE_ARGS); 1212 - if (args == NULL) 1213 - return -ENOMEM; 1214 + if (args == NULL) { 1215 + ret = -ENOMEM; 1216 + goto end; 1217 + } 1214 1218 1215 1219 ret = expand_probe_args(sc_die, pf, args); 1216 1220 if (ret < 0) ··· 1238 1234 } 1239 1235 1240 1236 end: 1237 + if (ret) { 1238 + clear_probe_trace_event(tev); 1239 + tf->ntevs--; 1240 + } 1241 1241 free(args); 1242 1242 return ret; 1243 1243 } ··· 1254 1246 struct trace_event_finder tf = { 1255 1247 .pf = {.pev = pev, .callback = add_probe_trace_event}, 1256 1248 .max_tevs = probe_conf.max_probes, .mod = dbg->mod}; 1257 - int ret; 1249 + int ret, i; 1258 1250 1259 1251 /* Allocate result tevs array */ 1260 1252 *tevs = zalloc(sizeof(struct probe_trace_event) * tf.max_tevs); ··· 1266 1258 1267 1259 ret = debuginfo__find_probes(dbg, &tf.pf); 1268 1260 if (ret < 0) { 1261 + for (i = 0; i < tf.ntevs; i++) 1262 + clear_probe_trace_event(&tf.tevs[i]); 1269 1263 zfree(tevs); 1270 1264 return ret; 1271 1265 }
+16 -18
tools/perf/util/symbol.c
··· 654 654 struct map_groups *kmaps = map__kmaps(map); 655 655 struct map *curr_map; 656 656 struct symbol *pos; 657 - int count = 0, moved = 0; 657 + int count = 0; 658 + struct rb_root old_root = dso->symbols[map->type]; 658 659 struct rb_root *root = &dso->symbols[map->type]; 659 660 struct rb_node *next = rb_first(root); 660 661 661 662 if (!kmaps) 662 663 return -1; 663 664 665 + *root = RB_ROOT; 666 + 664 667 while (next) { 665 668 char *module; 666 669 667 670 pos = rb_entry(next, struct symbol, rb_node); 668 671 next = rb_next(&pos->rb_node); 672 + 673 + rb_erase_init(&pos->rb_node, &old_root); 669 674 670 675 module = strchr(pos->name, '\t'); 671 676 if (module) ··· 679 674 curr_map = map_groups__find(kmaps, map->type, pos->start); 680 675 681 676 if (!curr_map || (filter && filter(curr_map, pos))) { 682 - rb_erase_init(&pos->rb_node, root); 683 677 symbol__delete(pos); 684 - } else { 685 - pos->start -= curr_map->start - curr_map->pgoff; 686 - if (pos->end) 687 - pos->end -= curr_map->start - curr_map->pgoff; 688 - if (curr_map->dso != map->dso) { 689 - rb_erase_init(&pos->rb_node, root); 690 - symbols__insert( 691 - &curr_map->dso->symbols[curr_map->type], 692 - pos); 693 - ++moved; 694 - } else { 695 - ++count; 696 - } 678 + continue; 697 679 } 680 + 681 + pos->start -= curr_map->start - curr_map->pgoff; 682 + if (pos->end) 683 + pos->end -= curr_map->start - curr_map->pgoff; 684 + symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); 685 + ++count; 698 686 } 699 687 700 688 /* Symbols have been adjusted */ 701 689 dso->adjust_symbols = 1; 702 690 703 - return count + moved; 691 + return count; 704 692 } 705 693 706 694 /* ··· 1436 1438 if (lstat(dso->name, &st) < 0) 1437 1439 goto out; 1438 1440 1439 - if (st.st_uid && (st.st_uid != geteuid())) { 1441 + if (!symbol_conf.force && st.st_uid && (st.st_uid != geteuid())) { 1440 1442 pr_warning("File %s not owned by current user or root, " 1441 - "ignoring it.\n", dso->name); 1443 + "ignoring it (use -f to override).\n", dso->name); 1442 1444 goto out; 1443 1445 } 1444 1446
+1
tools/perf/util/symbol.h
··· 84 84 unsigned short priv_size; 85 85 unsigned short nr_events; 86 86 bool try_vmlinux_path, 87 + force, 87 88 ignore_vmlinux, 88 89 ignore_vmlinux_buildid, 89 90 show_kernel_path,