Skip to content

Commit 76ccd23

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tooling fixes from Ingo Molnar: "A handful of tooling fixes all across the map, no kernel changes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: tools headers uapi: Update linux/in.h copy perf probe: Do not depend on dwfl_module_addrsym() perf probe: Fix to delete multiple probe event perf parse-events: Fix reading of invalid memory in event parsing perf python: Fix clang detection when using CC=clang-version perf map: Fix off by one in strncpy() size argument tools: Let O= makes handle a relative path with -C option
2 parents 3f3ee43 + 564200e commit 76ccd23

File tree

8 files changed

+46
-34
lines changed

8 files changed

+46
-34
lines changed

tools/include/uapi/linux/in.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ enum {
7474
#define IPPROTO_UDPLITE IPPROTO_UDPLITE
7575
IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */
7676
#define IPPROTO_MPLS IPPROTO_MPLS
77+
IPPROTO_ETHERNET = 143, /* Ethernet-within-IPv6 Encapsulation */
78+
#define IPPROTO_ETHERNET IPPROTO_ETHERNET
7779
IPPROTO_RAW = 255, /* Raw IP packets */
7880
#define IPPROTO_RAW IPPROTO_RAW
7981
IPPROTO_MPTCP = 262, /* Multipath TCP connection */

tools/perf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ endif
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ static int config_attr(struct perf_event_attr *attr,
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,
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 { \
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,
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,19 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod,
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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
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 @@ def finalize_options(self):
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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),)

0 commit comments

Comments
 (0)