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

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

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

perf annotate:

Ivan Krylov:

- Pass filename to objdump via execl, fixing usage with filenames
with special characters.

perf report:

Jin Yao:

Fix wrong iteration count in --branch-history

perf stat:

Jin Yao:

- Fix endless wait for child process

perf test:

Arnaldo Carvalho de Melo:

- Use a fallback to get the pathname in vfs_getname in

tools build:

Jiri Olsa:

- Allow overriding CFLAGS assignments.

Misc:

Arnaldo Carvalho de Melo:

- Syncronize UAPI headers

Mattias Jacobsson:

- Remove redundant va_end() in strbuf_addv()

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

+89 -28
+2
tools/arch/x86/include/asm/cpufeatures.h
··· 281 281 #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ 282 282 #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ 283 283 #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ 284 + #define X86_FEATURE_WBNOINVD (13*32+ 9) /* WBNOINVD instruction */ 284 285 #define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ 285 286 #define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ 286 287 #define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ 288 + #define X86_FEATURE_AMD_STIBP_ALWAYS_ON (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */ 287 289 #define X86_FEATURE_AMD_SSBD (13*32+24) /* "" Speculative Store Bypass Disable */ 288 290 #define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ 289 291 #define X86_FEATURE_AMD_SSB_NO (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */
+7 -1
tools/arch/x86/include/asm/disabled-features.h
··· 16 16 # define DISABLE_MPX (1<<(X86_FEATURE_MPX & 31)) 17 17 #endif 18 18 19 + #ifdef CONFIG_X86_SMAP 20 + # define DISABLE_SMAP 0 21 + #else 22 + # define DISABLE_SMAP (1<<(X86_FEATURE_SMAP & 31)) 23 + #endif 24 + 19 25 #ifdef CONFIG_X86_INTEL_UMIP 20 26 # define DISABLE_UMIP 0 21 27 #else ··· 74 68 #define DISABLED_MASK6 0 75 69 #define DISABLED_MASK7 (DISABLE_PTI) 76 70 #define DISABLED_MASK8 0 77 - #define DISABLED_MASK9 (DISABLE_MPX) 71 + #define DISABLED_MASK9 (DISABLE_MPX|DISABLE_SMAP) 78 72 #define DISABLED_MASK10 0 79 73 #define DISABLED_MASK11 0 80 74 #define DISABLED_MASK12 0
+3 -1
tools/include/uapi/asm-generic/unistd.h
··· 738 738 __SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents) 739 739 #define __NR_rseq 293 740 740 __SYSCALL(__NR_rseq, sys_rseq) 741 + #define __NR_kexec_file_load 294 742 + __SYSCALL(__NR_kexec_file_load, sys_kexec_file_load) 741 743 742 744 #undef __NR_syscalls 743 - #define __NR_syscalls 294 745 + #define __NR_syscalls 295 744 746 745 747 /* 746 748 * 32 bit systems traditionally used different
+8
tools/include/uapi/drm/i915_drm.h
··· 412 412 int irq_seq; 413 413 } drm_i915_irq_wait_t; 414 414 415 + /* 416 + * Different modes of per-process Graphics Translation Table, 417 + * see I915_PARAM_HAS_ALIASING_PPGTT 418 + */ 419 + #define I915_GEM_PPGTT_NONE 0 420 + #define I915_GEM_PPGTT_ALIASING 1 421 + #define I915_GEM_PPGTT_FULL 2 422 + 415 423 /* Ioctl to query kernel params: 416 424 */ 417 425 #define I915_PARAM_IRQ_ACTIVE 1
+7 -3
tools/include/uapi/linux/in.h
··· 266 266 267 267 #define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) 268 268 #define IN_MULTICAST(a) IN_CLASSD(a) 269 - #define IN_MULTICAST_NET 0xF0000000 269 + #define IN_MULTICAST_NET 0xe0000000 270 270 271 - #define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) 272 - #define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) 271 + #define IN_BADCLASS(a) ((((long int) (a) ) == 0xffffffff) 272 + #define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) 273 + 274 + #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) 275 + #define IN_CLASSE_NET 0xffffffff 276 + #define IN_CLASSE_NSHIFT 0 273 277 274 278 /* Address to accept any incoming messages. */ 275 279 #define INADDR_ANY ((unsigned long int) 0x00000000)
+19
tools/include/uapi/linux/kvm.h
··· 492 492 }; 493 493 }; 494 494 495 + /* for KVM_CLEAR_DIRTY_LOG */ 496 + struct kvm_clear_dirty_log { 497 + __u32 slot; 498 + __u32 num_pages; 499 + __u64 first_page; 500 + union { 501 + void __user *dirty_bitmap; /* one bit per page */ 502 + __u64 padding2; 503 + }; 504 + }; 505 + 495 506 /* for KVM_SET_SIGNAL_MASK */ 496 507 struct kvm_signal_mask { 497 508 __u32 len; ··· 986 975 #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163 987 976 #define KVM_CAP_EXCEPTION_PAYLOAD 164 988 977 #define KVM_CAP_ARM_VM_IPA_SIZE 165 978 + #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 979 + #define KVM_CAP_HYPERV_CPUID 167 989 980 990 981 #ifdef KVM_CAP_IRQ_ROUTING 991 982 ··· 1433 1420 /* Available with KVM_CAP_NESTED_STATE */ 1434 1421 #define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state) 1435 1422 #define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state) 1423 + 1424 + /* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT */ 1425 + #define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log) 1426 + 1427 + /* Available with KVM_CAP_HYPERV_CPUID */ 1428 + #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2) 1436 1429 1437 1430 /* Secure Encrypted Virtualization command */ 1438 1431 enum sev_cmd_id {
+8
tools/include/uapi/linux/prctl.h
··· 220 220 # define PR_SPEC_DISABLE (1UL << 2) 221 221 # define PR_SPEC_FORCE_DISABLE (1UL << 3) 222 222 223 + /* Reset arm64 pointer authentication keys */ 224 + #define PR_PAC_RESET_KEYS 54 225 + # define PR_PAC_APIAKEY (1UL << 0) 226 + # define PR_PAC_APIBKEY (1UL << 1) 227 + # define PR_PAC_APDAKEY (1UL << 2) 228 + # define PR_PAC_APDBKEY (1UL << 3) 229 + # define PR_PAC_APGAKEY (1UL << 4) 230 + 223 231 #endif /* _LINUX_PRCTL_H */
+3 -1
tools/perf/Makefile.perf
··· 524 524 525 525 all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) 526 526 527 + # Create python binding output directory if not already present 528 + _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') 529 + 527 530 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) 528 531 $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ 529 532 CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \ 530 533 $(PYTHON_WORD) util/setup.py \ 531 534 --quiet build_ext; \ 532 - mkdir -p $(OUTPUT)python && \ 533 535 cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ 534 536 535 537 please_set_SHELL_PATH_to_a_more_modern_shell:
+2 -1
tools/perf/builtin-stat.c
··· 561 561 break; 562 562 } 563 563 } 564 - wait4(child_pid, &status, 0, &stat_config.ru_data); 564 + if (child_pid != -1) 565 + wait4(child_pid, &status, 0, &stat_config.ru_data); 565 566 566 567 if (workload_exec_errno) { 567 568 const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg));
+2 -1
tools/perf/tests/shell/lib/probe_vfs_getname.sh
··· 13 13 local verbose=$1 14 14 if [ $had_vfs_getname -eq 1 ] ; then 15 15 line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/') 16 - perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string" 16 + perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \ 17 + perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string" 17 18 fi 18 19 } 19 20
+1 -1
tools/perf/trace/beauty/prctl_option.sh
··· 4 4 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 5 5 6 6 printf "static const char *prctl_options[] = {\n" 7 - regex='^#define[[:space:]]+PR_([GS]ET\w+)[[:space:]]*([[:xdigit:]]+).*' 7 + regex='^#define[[:space:]]+PR_(\w+)[[:space:]]*([[:xdigit:]]+).*' 8 8 egrep $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \ 9 9 sed -r "s/$regex/\2 \1/g" | \ 10 10 sort -n | xargs printf "\t[%s] = \"%s\",\n"
+4 -4
tools/perf/util/annotate.c
··· 1723 1723 err = asprintf(&command, 1724 1724 "%s %s%s --start-address=0x%016" PRIx64 1725 1725 " --stop-address=0x%016" PRIx64 1726 - " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", 1726 + " -l -d %s %s -C \"$1\" 2>/dev/null|grep -v \"$1:\"|expand", 1727 1727 opts->objdump_path ?: "objdump", 1728 1728 opts->disassembler_style ? "-M " : "", 1729 1729 opts->disassembler_style ?: "", 1730 1730 map__rip_2objdump(map, sym->start), 1731 1731 map__rip_2objdump(map, sym->end), 1732 1732 opts->show_asm_raw ? "" : "--no-show-raw", 1733 - opts->annotate_src ? "-S" : "", 1734 - symfs_filename, symfs_filename); 1733 + opts->annotate_src ? "-S" : ""); 1735 1734 1736 1735 if (err < 0) { 1737 1736 pr_err("Failure allocating memory for the command to run\n"); ··· 1755 1756 close(stdout_fd[0]); 1756 1757 dup2(stdout_fd[1], 1); 1757 1758 close(stdout_fd[1]); 1758 - execl("/bin/sh", "sh", "-c", command, NULL); 1759 + execl("/bin/sh", "sh", "-c", command, "--", symfs_filename, 1760 + NULL); 1759 1761 perror(command); 1760 1762 exit(-1); 1761 1763 }
+20 -12
tools/perf/util/callchain.c
··· 766 766 cnode->cycles_count += node->branch_flags.cycles; 767 767 cnode->iter_count += node->nr_loop_iter; 768 768 cnode->iter_cycles += node->iter_cycles; 769 + cnode->from_count++; 769 770 } 770 771 } 771 772 ··· 1346 1345 static int branch_from_str(char *bf, int bfsize, 1347 1346 u64 branch_count, 1348 1347 u64 cycles_count, u64 iter_count, 1349 - u64 iter_cycles) 1348 + u64 iter_cycles, u64 from_count) 1350 1349 { 1351 1350 int printed = 0, i = 0; 1352 - u64 cycles; 1351 + u64 cycles, v = 0; 1353 1352 1354 1353 cycles = cycles_count / branch_count; 1355 1354 if (cycles) { ··· 1358 1357 bf + printed, bfsize - printed); 1359 1358 } 1360 1359 1361 - if (iter_count) { 1362 - printed += count_pri64_printf(i++, "iter", 1363 - iter_count, 1364 - bf + printed, bfsize - printed); 1360 + if (iter_count && from_count) { 1361 + v = iter_count / from_count; 1362 + if (v) { 1363 + printed += count_pri64_printf(i++, "iter", 1364 + v, bf + printed, bfsize - printed); 1365 1365 1366 - printed += count_pri64_printf(i++, "avg_cycles", 1367 - iter_cycles / iter_count, 1368 - bf + printed, bfsize - printed); 1366 + printed += count_pri64_printf(i++, "avg_cycles", 1367 + iter_cycles / iter_count, 1368 + bf + printed, bfsize - printed); 1369 + } 1369 1370 } 1370 1371 1371 1372 if (i) ··· 1380 1377 u64 branch_count, u64 predicted_count, 1381 1378 u64 abort_count, u64 cycles_count, 1382 1379 u64 iter_count, u64 iter_cycles, 1380 + u64 from_count, 1383 1381 struct branch_type_stat *brtype_stat) 1384 1382 { 1385 1383 int printed; ··· 1393 1389 predicted_count, abort_count, brtype_stat); 1394 1390 } else { 1395 1391 printed = branch_from_str(bf, bfsize, branch_count, 1396 - cycles_count, iter_count, iter_cycles); 1392 + cycles_count, iter_count, iter_cycles, 1393 + from_count); 1397 1394 } 1398 1395 1399 1396 if (!printed) ··· 1407 1402 u64 branch_count, u64 predicted_count, 1408 1403 u64 abort_count, u64 cycles_count, 1409 1404 u64 iter_count, u64 iter_cycles, 1405 + u64 from_count, 1410 1406 struct branch_type_stat *brtype_stat) 1411 1407 { 1412 1408 char str[256]; 1413 1409 1414 1410 counts_str_build(str, sizeof(str), branch_count, 1415 1411 predicted_count, abort_count, cycles_count, 1416 - iter_count, iter_cycles, brtype_stat); 1412 + iter_count, iter_cycles, from_count, brtype_stat); 1417 1413 1418 1414 if (fp) 1419 1415 return fprintf(fp, "%s", str); ··· 1428 1422 u64 branch_count, predicted_count; 1429 1423 u64 abort_count, cycles_count; 1430 1424 u64 iter_count, iter_cycles; 1425 + u64 from_count; 1431 1426 1432 1427 branch_count = clist->branch_count; 1433 1428 predicted_count = clist->predicted_count; ··· 1436 1429 cycles_count = clist->cycles_count; 1437 1430 iter_count = clist->iter_count; 1438 1431 iter_cycles = clist->iter_cycles; 1432 + from_count = clist->from_count; 1439 1433 1440 1434 return callchain_counts_printf(fp, bf, bfsize, branch_count, 1441 1435 predicted_count, abort_count, 1442 1436 cycles_count, iter_count, iter_cycles, 1443 - &clist->brtype_stat); 1437 + from_count, &clist->brtype_stat); 1444 1438 } 1445 1439 1446 1440 static void free_callchain_node(struct callchain_node *node)
+1
tools/perf/util/callchain.h
··· 118 118 bool has_children; 119 119 }; 120 120 u64 branch_count; 121 + u64 from_count; 121 122 u64 predicted_count; 122 123 u64 abort_count; 123 124 u64 cycles_count;
+1 -1
tools/perf/util/machine.c
··· 2005 2005 { 2006 2006 int i; 2007 2007 2008 - iter->nr_loop_iter = nr; 2008 + iter->nr_loop_iter++; 2009 2009 iter->cycles = 0; 2010 2010 2011 2011 for (i = 0; i < nr; i++)
-1
tools/perf/util/strbuf.c
··· 109 109 return ret; 110 110 } 111 111 len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved); 112 - va_end(ap_saved); 113 112 if (len > strbuf_avail(sb)) { 114 113 pr_debug("this should not happen, your vsnprintf is broken"); 115 114 va_end(ap_saved);
+1 -1
tools/thermal/tmon/Makefile
··· 6 6 7 7 BINDIR=usr/bin 8 8 WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int 9 - override CFLAGS+= -O1 ${WARNFLAGS} 9 + override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS} 10 10 # Add "-fstack-protector" only if toolchain supports it. 11 11 override CFLAGS+= $(call cc-option,-fstack-protector-strong) 12 12 CC?= $(CROSS_COMPILE)gcc