History

Merge tag 'perf-urgent-for-mingo-5.6-20200309' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Pull perf/urgent fixes from Arnaldo Carvalho de Melo: perf probe: Masami Hiramatsu: - Fix deletion of multiple probe events. - Fix userspace libraries handling by not depending on dwfl_module_addrsym(). Event parsing: Ian Rogers: - Fix reading of invalid memory in event parsing. python binding: Ilie Halip: - Fix clang detection when using CC=clang-version. build: Masami Hiramatsu: - Fix O= use with relative paths. Android: Dominik b. Czarnota: - Fix off by one in strncpy() size argument when handling Android libraries.

Ingo Molnar committed 6 years ago

Commit db5d85c2 parents ac309e7 1efde277 files · +44 −34Browse files

Unified · Split

7 files
  1. tools/perf/Makefile +1 −1
  2. tools/perf/util/map.c +1 −1
  3. tools/perf/util/parse-events.c +23 −23
  4. tools/perf/util/probe-file.c +3 −0
  5. tools/perf/util/probe-finder.c +8 −3
  6. tools/perf/util/setup.py +6 −4
  7. tools/scripts/Makefile.include +2 −2
tools/perf/Makefile+1−1
@@ -35,7 +35,7 @@ endif · 34 unmodified lines
3535 # Only pass canonical directory names as the output directory:
3636 #
3737 ifneq ($(O),)
38− FULL_O := $(shell readlink -f $(O) || echo $(O))
38+ FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))
3939 endif
4040
4141 #
tools/perf/util/map.c+1−1
@@ -89,7 +89,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename) · 88 unmodified lines
8989 return true;
9090 }
9191
92− if (!strncmp(filename, "/system/lib/", 11)) {
92+ if (!strncmp(filename, "/system/lib/", 12)) {
9393 char *ndk, *app;
9494 const char *arch;
9595 size_t ndk_length;
tools/perf/util/parse-events.c+23−23
@@ -1213,7 +1213,7 @@ static int config_attr(struct perf_event_attr *attr, · 1212 unmodified lines
12131213 static int get_config_terms(struct list_head *head_config,
12141214 struct list_head *head_terms __maybe_unused)
12151215 {
1216−#define ADD_CONFIG_TERM(__type) \
1216+#define ADD_CONFIG_TERM(__type, __weak) \
12171217 struct perf_evsel_config_term *__t; \
12181218 \
12191219 __t = zalloc(sizeof(*__t)); \
@@ -1222,18 +1222,18 @@ static int get_config_terms(struct list_head *head_config, · 2 unmodified lines
12221222 \
12231223 INIT_LIST_HEAD(&__t->list); \
12241224 __t->type = PERF_EVSEL__CONFIG_TERM_ ## __type; \
1225− __t->weak = term->weak; \
1225+ __t->weak = __weak; \
12261226 list_add_tail(&__t->list, head_terms)
12271227
1228−#define ADD_CONFIG_TERM_VAL(__type, __name, __val) \
1228+#define ADD_CONFIG_TERM_VAL(__type, __name, __val, __weak) \
12291229 do { \
1230− ADD_CONFIG_TERM(__type); \
1230+ ADD_CONFIG_TERM(__type, __weak); \
12311231 __t->val.__name = __val; \
12321232 } while (0)
12331233
1234−#define ADD_CONFIG_TERM_STR(__type, __val) \
1234+#define ADD_CONFIG_TERM_STR(__type, __val, __weak) \
12351235 do { \
1236− ADD_CONFIG_TERM(__type); \
1236+ ADD_CONFIG_TERM(__type, __weak); \
12371237 __t->val.str = strdup(__val); \
12381238 if (!__t->val.str) { \
12391239 zfree(&__t); \
@@ -1247,62 +1247,62 @@ do { \ · 7 unmodified lines
12471247 list_for_each_entry(term, head_config, list) {
12481248 switch (term->type_term) {
12491249 case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
1250− ADD_CONFIG_TERM_VAL(PERIOD, period, term->val.num);
1250+ ADD_CONFIG_TERM_VAL(PERIOD, period, term->val.num, term->weak);
12511251 break;
12521252 case PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ:
1253− ADD_CONFIG_TERM_VAL(FREQ, freq, term->val.num);
1253+ ADD_CONFIG_TERM_VAL(FREQ, freq, term->val.num, term->weak);
12541254 break;
12551255 case PARSE_EVENTS__TERM_TYPE_TIME:
1256− ADD_CONFIG_TERM_VAL(TIME, time, term->val.num);
1256+ ADD_CONFIG_TERM_VAL(TIME, time, term->val.num, term->weak);
12571257 break;
12581258 case PARSE_EVENTS__TERM_TYPE_CALLGRAPH:
1259− ADD_CONFIG_TERM_STR(CALLGRAPH, term->val.str);
1259+ ADD_CONFIG_TERM_STR(CALLGRAPH, term->val.str, term->weak);
12601260 break;
12611261 case PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE:
1262− ADD_CONFIG_TERM_STR(BRANCH, term->val.str);
1262+ ADD_CONFIG_TERM_STR(BRANCH, term->val.str, term->weak);
12631263 break;
12641264 case PARSE_EVENTS__TERM_TYPE_STACKSIZE:
12651265 ADD_CONFIG_TERM_VAL(STACK_USER, stack_user,
1266− term->val.num);
1266+ term->val.num, term->weak);
12671267 break;
12681268 case PARSE_EVENTS__TERM_TYPE_INHERIT:
12691269 ADD_CONFIG_TERM_VAL(INHERIT, inherit,
1270− term->val.num ? 1 : 0);
1270+ term->val.num ? 1 : 0, term->weak);
12711271 break;
12721272 case PARSE_EVENTS__TERM_TYPE_NOINHERIT:
12731273 ADD_CONFIG_TERM_VAL(INHERIT, inherit,
1274− term->val.num ? 0 : 1);
1274+ term->val.num ? 0 : 1, term->weak);
12751275 break;
12761276 case PARSE_EVENTS__TERM_TYPE_MAX_STACK:
12771277 ADD_CONFIG_TERM_VAL(MAX_STACK, max_stack,
1278− term->val.num);
1278+ term->val.num, term->weak);
12791279 break;
12801280 case PARSE_EVENTS__TERM_TYPE_MAX_EVENTS:
12811281 ADD_CONFIG_TERM_VAL(MAX_EVENTS, max_events,
1282− term->val.num);
1282+ term->val.num, term->weak);
12831283 break;
12841284 case PARSE_EVENTS__TERM_TYPE_OVERWRITE:
12851285 ADD_CONFIG_TERM_VAL(OVERWRITE, overwrite,
1286− term->val.num ? 1 : 0);
1286+ term->val.num ? 1 : 0, term->weak);
12871287 break;
12881288 case PARSE_EVENTS__TERM_TYPE_NOOVERWRITE:
12891289 ADD_CONFIG_TERM_VAL(OVERWRITE, overwrite,
1290− term->val.num ? 0 : 1);
1290+ term->val.num ? 0 : 1, term->weak);
12911291 break;
12921292 case PARSE_EVENTS__TERM_TYPE_DRV_CFG:
1293− ADD_CONFIG_TERM_STR(DRV_CFG, term->val.str);
1293+ ADD_CONFIG_TERM_STR(DRV_CFG, term->val.str, term->weak);
12941294 break;
12951295 case PARSE_EVENTS__TERM_TYPE_PERCORE:
12961296 ADD_CONFIG_TERM_VAL(PERCORE, percore,
1297− term->val.num ? true : false);
1297+ term->val.num ? true : false, term->weak);
12981298 break;
12991299 case PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT:
13001300 ADD_CONFIG_TERM_VAL(AUX_OUTPUT, aux_output,
1301− term->val.num ? 1 : 0);
1301+ term->val.num ? 1 : 0, term->weak);
13021302 break;
13031303 case PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE:
13041304 ADD_CONFIG_TERM_VAL(AUX_SAMPLE_SIZE, aux_sample_size,
1305− term->val.num);
1305+ term->val.num, term->weak);
13061306 break;
13071307 default:
13081308 break;
@@ -1339,7 +1339,7 @@ static int get_config_chgs(struct perf_pmu *pmu, struct list_head *head_config, · 30 unmodified lines
13391339 }
13401340
13411341 if (bits)
1342− ADD_CONFIG_TERM_VAL(CFG_CHG, cfg_chg, bits);
1342+ ADD_CONFIG_TERM_VAL(CFG_CHG, cfg_chg, bits, false);
13431343
13441344 #undef ADD_CONFIG_TERM
13451345 return 0;
tools/perf/util/probe-file.c+3−0
@@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group) · 205 unmodified lines
206206 } else
207207 ret = strlist__add(sl, tev.event);
208208 clear_probe_trace_event(&tev);
209+ /* Skip if there is same name multi-probe event in the list */
210+ if (ret == -EEXIST)
211+ ret = 0;
209212 if (ret < 0)
210213 break;
211214 }
tools/perf/util/probe-finder.c+8−3
@@ -637,14 +637,19 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, · 636 unmodified lines
637637 return -EINVAL;
638638 }
639639
640− /* Try to get actual symbol name from symtab */
641− symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
640+ if (dwarf_entrypc(sp_die, &eaddr) == 0) {
641+ /* If the DIE has entrypc, use it. */
642+ symbol = dwarf_diename(sp_die);
643+ } else {
644+ /* Try to get actual symbol name and address from symtab */
645+ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
646+ eaddr = sym.st_value;
647+ }
642648 if (!symbol) {
643649 pr_warning("Failed to find symbol at 0x%lx\n",
644650 (unsigned long)paddr);
645651 return -ENOENT;
646652 }
647− eaddr = sym.st_value;
648653
649654 tp->offset = (unsigned long)(paddr - eaddr);
650655 tp->address = (unsigned long)paddr;
tools/perf/util/setup.py+6−4
@@ -2,11 +2,13 @@ from os import getenv · 1 unmodified line
22 from subprocess import Popen, PIPE
33 from re import sub
44
5+cc = getenv("CC")
6+cc_is_clang = b"clang version" in Popen([cc, "-v"], stderr=PIPE).stderr.readline()
7+
58 def clang_has_option(option):
6− return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
9+ return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]
710
8−cc = getenv("CC")
9−if cc == "clang":
11+if cc_is_clang:
1012 from distutils.sysconfig import get_config_vars
1113 vars = get_config_vars()
1214 for var in ('CFLAGS', 'OPT'):
@@ -40,7 +42,7 @@ class install_lib(_install_lib): · 27 unmodified lines
4042 cflags = getenv('CFLAGS', '').split()
4143 # switch off several checks (need to be at the end of cflags list)
4244 cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ]
43−if cc != "clang":
45+if not cc_is_clang:
4446 cflags += ['-Wno-cast-function-type' ]
4547
4648 src_perf = getenv('srctree') + '/tools/perf'
tools/scripts/Makefile.include+2−2
@@ -1,8 +1,8 @@
11 # SPDX-License-Identifier: GPL-2.0
22 ifneq ($(O),)
33 ifeq ($(origin O), command line)
4− dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
5− ABSOLUTE_O := $(shell cd $(O) ; pwd)
4+ dummy := $(if $(shell cd $(PWD); test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
5+ ABSOLUTE_O := $(shell cd $(PWD); cd $(O) ; pwd)
66 OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
77 COMMAND_O := O=$(ABSOLUTE_O)
88 ifeq ($(objtree),)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t