perf/urgent fixes
Subsystems (2)
Arnaldo Carvalho de Melo
maintainerFrom: Arnaldo Carvalho de Melo <[email protected]>
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 72906f38934a49faf4d2d38ea9ae32adcf7d5d0c:
Merge branch 'x86-hyperv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2018-01-30 13:04:50 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo-4.16-20180205
for you to fetch changes up to 2fe2230d4183d2c311bbb7b426491ac486216a16:
perf tools: Add trace/beauty/generated/ into .gitignore (2018-02-05 13:58:02 -0300)
----------------------------------------------------------------
perf/urgent fixes:
- 'period' and 'freq' handling fixes for 'perf record', also
related: add Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS in the x86 perf kernel driver (Jiri Olsa)
- Fix 'perf trace -i perf.data' callgraph handling (Ravi Bangoria)
- Synchronize tooling headers for asound, s390 and powerpc KVM, sched and x86 features (Arnaldo Carvalho de Melo)
----------------------------------------------------------------
Arnaldo Carvalho de Melo (5):
tools headers: Synchronize sound/asound.h
tooling headers: Synchronize updated s390 kvm UAPI headers tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.h tools headers: Synchronize uapi/linux/sched.h
tools headers: Synchoronize x86 features UAPI headers
Jiri Olsa (3):
perf evsel: Fix period/freq terms setup
perf record: Fix period option handling x86/events/intel/ds: Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS
Ravi Bangoria (2):
perf trace: Fix call-graph output
perf tools: Add trace/beauty/generated/ into .gitignore
arch/x86/events/perf_event.h | 3 ++- tools/arch/powerpc/include/uapi/asm/kvm.h | 25 +++++++++++++++++++++++++ tools/arch/s390/include/uapi/asm/kvm.h | 5 ++++- tools/arch/x86/include/asm/cpufeatures.h | 24 ++++++++++++++++++++---- tools/arch/x86/include/asm/disabled-features.h | 3 ++- tools/arch/x86/include/asm/required-features.h | 3 ++- tools/include/uapi/linux/kvm.h | 4 ++++ tools/include/uapi/linux/sched.h | 5 +++++ tools/include/uapi/sound/asound.h | 9 +++++++++ tools/perf/.gitignore | 1 + tools/perf/builtin-record.c | 3 ++- tools/perf/builtin-trace.c | 5 ++++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 13 ++++++++++--- 14 files changed, 91 insertions(+), 13 deletions(-)
Test results:
The first ones are container (docker) based builds of tools/perf with and without libelf support. Where clang is available, it is also used to build perf with/without libelf.
The objtool and samples/bpf/ builds are disabled now that I'm switching from using the sources in a local volume to fetching them from a http server to build it inside the container, to make it easier to build in a container cluster. Those will come back later.
Several are cross builds, the ones with -x-ARCH and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}.
The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests.
Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place.
# dm 1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0 2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822 3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0 4 alpine:edge : Ok gcc (Alpine 6.4.0) 6.4.0 5 amazonlinux:1 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) 6 amazonlinux:2 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) 7 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 8 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 9 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55) 10 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) 11 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) 12 debian:7 : Ok gcc (Debian 4.7.2-5) 4.7.2 13 debian:8 : Ok gcc (Debian 4.9.2-10) 4.9.2 14 debian:9 : Ok gcc (Debian 6.3.0-18) 6.3.0 20170516 15 debian:experimental : Ok gcc (Debian 7.2.0-17) 7.2.1 20171205 16 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 17 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 18 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 7.2.0-11) 7.2.0 19 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 20 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7) 21 fedora:21 : Ok gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6) 22 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) 23 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) 24 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) 25 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 26 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) 27 fedora:26 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) 28 fedora:27 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) 29 fedora:rawhide : Ok gcc (GCC) 7.2.1 20170829 (Red Hat 7.2.1-1) 30 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 6.4.0-r1 p1.3) 6.4.0 31 mageia:5 : Ok gcc (GCC) 4.9.2 32 mageia:6 : Ok gcc (Mageia 5.4.0-5.mga6) 5.4.0 33 opensuse:42.1 : Ok gcc (SUSE Linux) 4.8.5 34 opensuse:42.2 : Ok gcc (SUSE Linux) 4.8.5 35 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5 36 opensuse:tumbleweed : Ok gcc (SUSE Linux) 7.3.0 37 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) 38 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) 39 ubuntu:12.04.5 : Ok gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 40 ubuntu:14.04.4 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 41 ubuntu:14.04.4-x-linaro-arm64 : Ok aarch64-linux-gnu-gcc (Linaro GCC 5.4-2017.05) 5.4.1 20170404 42 ubuntu:15.04 : Ok gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2 43 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609 44 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 45 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 46 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 47 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609 48 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 49 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 50 ubuntu:16.10 : Ok gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005 51 ubuntu:17.04 : Ok gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406 52 ubuntu:17.10 : Ok gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0 53 ubuntu:18.04 : Ok gcc (Ubuntu 7.2.0-16ubuntu1) 7.2.0
# uname -a Linux jouet 4.15.0-rc9+ #7 SMP Mon Jan 22 18:16:36 -03 2018 x86_64 x86_64 x86_64 GNU/Linux # perf test 1: vmlinux symtab matches kallsyms : Ok 2: Detect openat syscall event : Ok 3: Detect openat syscall event on all cpus : Ok 4: Read samples using the mmap interface : Ok 5: Test data source output : Ok 6: Parse event definition strings : Ok 7: Simple expression parser : Ok 8: PERF_RECORD_* events & perf_sample fields : Ok 9: Parse perf pmu format : Ok 10: DSO data read : Ok 11: DSO data cache : Ok 12: DSO data reopen : Ok 13: Roundtrip evsel->name : Ok 14: Parse sched tracepoints fields : Ok 15: syscalls:sys_enter_openat event fields : Ok 16: Setup struct perf_event_attr : Ok 17: Match and link multiple hists : Ok 18: 'import perf' in python : Ok 19: Breakpoint overflow signal handler : Ok 20: Breakpoint overflow sampling : Ok 21: Number of exit events of a simple workload : Ok 22: Software clock events period values : Ok 23: Object code reading : Ok 24: Sample parsing : Ok 25: Use a dummy software event to keep tracking : Ok 26: Parse with no sample_id_all bit set : Ok 27: Filter hist entries : Ok 28: Lookup mmap thread : Ok 29: Share thread mg : Ok 30: Sort output of hist entries : Ok 31: Cumulate child hist entries : Ok 32: Track with sched_switch : Ok 33: Filter fds with revents mask in a fdarray : Ok 34: Add fd to a fdarray, making it autogrow : Ok 35: kmod_path__parse : Ok 36: Thread map : Ok 37: LLVM search and compile : 37.1: Basic BPF llvm compile : Ok 37.2: kbuild searching : Ok 37.3: Compile source for BPF prologue generation : Ok 37.4: Compile source for BPF relocation : Ok 38: Session topology : Ok 39: BPF filter : 39.1: Basic BPF filtering : Ok 39.2: BPF pinning : Ok 39.3: BPF prologue generation : Ok 39.4: BPF relocation checker : Ok 40: Synthesize thread map : Ok 41: Remove thread map : Ok 42: Synthesize cpu map : Ok 43: Synthesize stat config : Ok 44: Synthesize stat : Ok 45: Synthesize stat round : Ok 46: Synthesize attr update : Ok 47: Event times : Ok 48: Read backward ring buffer : Ok 49: Print cpu map : Ok 50: Probe SDT events : Ok 51: is_printable_array : Ok 52: Print bitmap : Ok 53: perf hooks : Ok 54: builtin clang support : Skip (not compiled in) 55: unit_number__scnprintf : Ok 56: x86 rdpmc : Ok 57: Convert perf time to TSC : Ok 58: DWARF unwind : Ok 59: x86 instruction decoder - new instructions : Ok 60: Use vfs_getname probe to get syscall args filenames : Ok 61: probe libc's inet_pton & backtrace it with ping : Ok 62: Check open filename arg using perf trace + vfs_getname: Ok 63: Add vfs_getname probe to get syscall args filenames : Ok #
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/perf/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_no_libaudit_O: make NO_LIBAUDIT=1
make_no_demangle_O: make NO_DEMANGLE=1
make_static_O: make LDFLAGS=-static
make_install_prefix_O: make install prefix=/tmp/krava
make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
make_help_O: make help
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_doc_O: make doc
make_no_libunwind_O: make NO_LIBUNWIND=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_libelf_O: make NO_LIBELF=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_util_map_o_O: make util/map.o
make_install_O: make install
make_no_libperl_O: make NO_LIBPERL=1
make_install_bin_O: make install-bin
make_perf_o_O: make perf.o
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_slang_O: make NO_SLANG=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_newt_O: make NO_NEWT=1
make_clean_all_O: make clean all
make_no_libbpf_O: make NO_LIBBPF=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_debug_O: make DEBUG=1
make_tags_O: make tags
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_pure_O: make
make_no_gtk2_O: make NO_GTK2=1
OK
make: Leaving directory '/home/acme/git/perf/tools/perf'
$Arnaldo Carvalho de Melo
maintainerPATCH 1/10 tools headers: Synchronize sound/asound.h
From: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes from this cset:
823dbb6eb08a ("ALSA: pcm: add SNDRV_PCM_FORMAT_{S,U}20")
It doesn't affect how the tools are built, this os done just to silence this perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/sound/asound.h' differs from latest version at 'include/uapi/sound/asound.h'
Right now tools/perf uses this header to generate string tables to translate ioctl commands in 'perf trace', see tools/perf/trace/beauty/sndrv_pcm_ioctl.sh, here is an example of a strace like system wide session, for one second:
# perf trace -a -e ioctl sleep 1
0.000 ( 0.019 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
0.081 ( 0.006 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
0.092 ( 0.006 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_STATUS_EXT, arg: 0x7f6745ec4ae0) = 0
10.178 ( 0.013 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
10.229 ( 0.005 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
10.238 ( 0.013 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_STATUS_EXT, arg: 0x7f6745ec4ae0) = 0
10.368 ( 0.009 ms): threaded-ml/26440 ioctl(fd: 141<socket:[111353]>, cmd: TIOCLINUX, arg: 0x7f8f70d2e1a4) = 0
10.495 ( 0.018 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
10.526 ( 0.005 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
19.695 ( 0.018 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
19.757 ( 0.006 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_HWSYNC, arg: 0x107b) = 0
19.767 ( 0.005 ms): alsa-sink-HDMI/4219 ioctl(fd: 47</dev/snd/pcmC0D8p>, cmd: SNDRV_PCM_STATUS_EXT, arg: 0x7f6745ec4ae0) = 0
<BIG SNIP>
#--- tools/include/uapi/sound/asound.h | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/include/uapi/sound/asound.h +9 -0
@@ -214,6 +214,11 @@ typedef int __bitwise snd_pcm_format_t;#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) +#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25)/* in four bytes, LSB justified */ +#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26)/* in four bytes, LSB justified */ +#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27)/* in four bytes, LSB justified */ +#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28)/* in four bytes, LSB justified */ +/* gap in the numbering for a future standard linear format */ #define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32)/* in three bytes */ #define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33)/* in three bytes */
@@ -248,6 +253,8 @@ typedef int __bitwise snd_pcm_format_t;#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE +#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE +#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE#endif #ifdef SNDRV_BIG_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
@@ -259,6 +266,8 @@ typedef int __bitwise snd_pcm_format_t;#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE +#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE +#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE#endif typedef int __bitwise snd_pcm_subformat_t ;
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 2/10 tooling headers: Synchronize updated s390 kvm UAPI headers
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The 35b3fde6203b ("KVM: s390: wire up bpb feature") was noticed by the perf build process:
Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h'
The changes in this cset don't cause or require changes in tools/perf/, so just update the copy to silence the build warning.
--- tools/arch/s390/include/uapi/asm/kvm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/arch/s390/include/uapi/asm/kvm.h +4 -1
@@ -224,6 +224,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_RICCB (1UL << 7)#define KVM_SYNC_FPRS (1UL << 8)#define KVM_SYNC_GSCB (1UL << 9) +#define KVM_SYNC_BPBC (1UL << 10)/* length and alignment of the sdnx as a power of two */ #define SDNXC 8#define SDNXL (1UL << SDNXC)
@@ -247,7 +248,9 @@ struct kvm_sync_regs { };__u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ -__u8 padding1[52 ];/* riccb needs to be 64byte aligned */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; +__u8 padding1[51 ];/* riccb needs to be 64byte aligned */ __u8 riccb[64 ];/* runtime instrumentation controls block */ __u8 padding2[192 ];/* sdnx needs to be 256byte aligned */ union {
Signature · 1 line
2.14.3
Re: [PATCH 02/10] tooling headers: Synchronize updated s390 kvm UAPI headers
Arnaldo
what is the proposed way of forwarding kvm uapi changes to the perf copy? Are you going to detect and fixup that yourself? Do you want to be notified? Or do you even want to have a patch?
Quoted 47 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
The
35b3fde6203b("KVM: s390: wire up bpb feature") was noticed by the perf build process:Warning: Kernel ABI header at '
tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h'The changes in this cset don't cause or require changes in
tools/perf/, so just update the copy to silence the build warning.Cc Adrian Hunter <[email protected]>Cc Christian Borntraeger <[email protected]>Cc David Ahern <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Cc Radim Krčmář <[email protected]>Cc Wang Nan <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>--- tools/arch/s390/include/uapi/asm/kvm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/arch/s390/include/uapi/asm/kvm.h +4
-1@@ -224,6 +224,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_RICCB (1UL << 7)#define KVM_SYNC_FPRS (1UL << 8)#define KVM_SYNC_GSCB (1UL << 9) +#define KVM_SYNC_BPBC (1UL << 10)/* length and alignment of the sdnx as a power of two */ #define SDNXC 8#define SDNXL (1UL << SDNXC)@@ -247,7 +248,9 @@ struct kvm_sync_regs { };__u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ -__u8 padding1[52 ];/* riccb needs to be 64byte aligned */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; +__u8 padding1[51 ];/* riccb needs to be 64byte aligned */ __u8 riccb[64 ];/* runtime instrumentation controls block */ __u8 padding2[192 ];/* sdnx needs to be 256byte aligned */ union {
Re: [PATCH 02/10] tooling headers: Synchronize updated s390 kvm UAPI headers
Quoted 5 lines · Christian Borntraeger
Arnaldo
what is the proposed way of forwarding kvm uapi changes to the perf copy? Are you going to detect and fixup that yourself? Do you want to be notified? Or do you even want to have a patch?
Yes, that's the normal flow: you can just ignore any warnings, we are syncing the headers up at around -rc1. (Many of them are already synced up.)
I.e. there's no constraint on kernel development and there's no need for you to deal with tooling details.
Thanks,
Ingo
Arnaldo Carvalho de Melo
maintainerPATCH 3/10 tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The changes in the 3214d01f139b ("KVM: PPC: Book3S: Provide information about hardware/firmware CVE workarounds") commit right now will not produce any change in the tools, but that is because we still need to improve tools/perf/trace/beauty/kvm_ioctl.sh to build per arch string tables, so that we avoid assigning multiple times to the same command string entry, i.e. multiple defines, for different arches, have the same value, causing this:
In file included from trace/beauty/ioctl.c:82:0:
/tmp/build/perf/trace/beauty/generated/ioctl/kvm_ioctl_array.c: In function ‘ioctl__scnprintf_kvm_cmd’:
/tmp/build/perf/trace/beauty/generated/ioctl/kvm_ioctl_array.c:76:11: error: initialized field overwritten [-Werror=override-init] /tmp/build/perf/trace/beauty/generated/ioctl/kvm_ioctl_array.c:88:11: note: (near initialization for ‘kvm_ioctl_cmds[165]’) /tmp/build/perf/trace/beauty/generated/ioctl/kvm_ioctl_array.c:90:11: error: initialized field overwritten [-Werror=override-init]
[0xa6] = "PPC_GET_SMMU_INFO",
^~~~~~~~~~~~~~~~~~~So the onlye effect of updating the tools/ copy of ppc's kvm.h header is to silence these perf build warnings:
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/kvm.h' differs from latest version at 'arch/powerpc/include/uapi/asm/kvm.h'
At some point we should do what we did for the errno tables and create per-arch string translation tables for the KVM ioctl commands for the architectures supporting KVM, such as s/390, PowerPC, x86_64 and ARM.
--- tools/arch/powerpc/include/uapi/asm/kvm.h | 25 +++++++++++++++++++++++++ tools/include/uapi/linux/kvm.h | 4 ++++ 2 files changed, 29 insertions(+)
tools/arch/powerpc/include/uapi/asm/kvm.h +25 -0
@@ -443,6 +443,31 @@ struct kvm_ppc_rmmu_info {__u32 ap_encodings[8 ]; }; +/* For KVM_PPC_GET_CPU_CHAR */ +struct kvm_ppc_cpu_char { +__u64 character;/* characteristics of the CPU */ +__u64 behaviour;/* recommended software behaviour */ +__u64 character_mask;/* valid bits in character */ +__u64 behaviour_mask;/* valid bits in behaviour */ +}; + +/* +* Values for character and character_mask. +* These are identical to the values used by H_GET_CPU_CHARACTERISTICS. +*/ +#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) +#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) +#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) +#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) +#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) +#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) + +#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) +#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) +#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) +/* Per-vcpu XICS interrupt controller state */ #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c)
tools/include/uapi/linux/kvm.h +4 -0
@@ -932,6 +932,8 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_HYPERV_SYNIC2 148#define KVM_CAP_HYPERV_VP_INDEX 149#define KVM_CAP_S390_AIS_MIGRATION 150 +#define KVM_CAP_PPC_GET_CPU_CHAR 151 +#define KVM_CAP_S390_BPB 152#ifdef KVM_CAP_IRQ_ROUTING
@@ -1261,6 +1263,8 @@ struct kvm_s390_ucas_mapping {#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)/* Available with KVM_CAP_PPC_RADIX_MMU */ #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) +/* Available with KVM_CAP_PPC_GET_CPU_CHAR */ +#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)/* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 4/10 tools headers: Synchronize uapi/linux/sched.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To get the tools copy updated with the changes in 34be39305a77 ("sched/deadline: Implement "runtime overrun signal" support"), that cause no effect on the tools, will be used when we start copying the sched_attr struct argument to the sched_get/setattr syscalls.
--- tools/include/uapi/linux/sched.h | 5 +++++ 1 file changed, 5 insertions(+)
tools/include/uapi/linux/sched.h +5 -0
@@ -49,5 +49,10 @@*/ #define SCHED_FLAG_RESET_ON_FORK 0x01#define SCHED_FLAG_RECLAIM 0x02 +#define SCHED_FLAG_DL_OVERRUN 0x04 + +#define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ + SCHED_FLAG_RECLAIM | \ + SCHED_FLAG_DL_OVERRUN)#endif /* _UAPI_LINUX_SCHED_H */
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 5/10 tools headers: Synchoronize x86 features UAPI headers
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Sync tools/arch/x86/include/asm/{cpu,disabled-,required-}features.h with the changes in:
2961298efe1e ("x86/cpufeatures: Clean up Spectre v2 related CPUID flags") 20ffa1caecca ("x86/speculation: Add basic IBPB (Indirect Branch Prediction Barrier) support") 5d10cbc91d9e ("x86/cpufeatures: Add AMD feature bits for Speculation Control") fc67dd70adb7 ("x86/cpufeatures: Add Intel feature bits for Speculation Control") 95ca0ee86360 ("x86/cpufeatures: Add CPUID_7_EDX CPUID leaf")
a511e7935378 ("x86/intel_rdt: Enumerate L2 Code and Data Prioritization (CDP) feature") 4fdec2034b75 ("x86/cpufeature: Move processor tracing out of scattered features") c995efd5a740 ("x86/retpoline: Fill RSB on context switch for affected CPUs") 76b043848fd2 ("x86/retpoline: Add initial retpoline support")
99c6fa2511d8 ("x86/cpufeatures: Add X86_BUG_SPECTRE_V[12]")
de791821c295 ("x86/pti: Rename BUG_CPU_INSECURE to BUG_CPU_MELTDOWN") 6cff64b86aaa ("x86/mm: Use INVPCID for __native_flush_tlb_single()")
None will entail changes in the tools/perf/, synchronizing to elliminate these perf build warnings:
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/required-features.h' differs from latest version at 'arch/x86/include/asm/required-features.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
--- tools/arch/x86/include/asm/cpufeatures.h | 24 ++++++++++++++++++++---- tools/arch/x86/include/asm/disabled-features.h | 3 ++- tools/arch/x86/include/asm/required-features.h | 3 ++- 3 files changed, 24 insertions(+), 6 deletions(-)
tools/arch/x86/include/asm/cpufeatures.h +20 -4
@@ -13,7 +13,7 @@/* * Defines x86 CPU feature bits */ -#define NCAPINTS 18/* N 32-bit words worth of info */ +#define NCAPINTS 19/* N 32-bit words worth of info */ #define NBUGINTS 1/* N 32-bit bug flags */ /*
@@ -203,12 +203,15 @@#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ #define X86_FEATURE_SME ( 7*32+10)/* AMD Secure Memory Encryption */ #define X86_FEATURE_PTI ( 7*32+11)/* Kernel Page Table Isolation enabled */ +#define X86_FEATURE_RETPOLINE ( 7*32+12)/* "" Generic Retpoline mitigation for Spectre variant 2 */ +#define X86_FEATURE_RETPOLINE_AMD ( 7*32+13)/* "" AMD Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ -#define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ -#define X86_FEATURE_AVX512_4VNNIW ( 7*32+16)/* AVX-512 Neural Network Instructions */ -#define X86_FEATURE_AVX512_4FMAPS ( 7*32+17)/* AVX-512 Multiply Accumulation Single precision */ +#define X86_FEATURE_CDP_L2 ( 7*32+15)/* Code and Data Prioritization L2 */ #define X86_FEATURE_MBA ( 7*32+18)/* Memory Bandwidth Allocation */ +#define X86_FEATURE_RSB_CTXSW ( 7*32+19)/* "" Fill RSB on context switches */ + +#define X86_FEATURE_USE_IBPB ( 7*32+21)/* "" Indirect Branch Prediction Barrier enabled */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0)/* Intel TPR Shadow */
@@ -243,6 +246,7 @@#define X86_FEATURE_AVX512IFMA ( 9*32+21)/* AVX-512 Integer Fused Multiply-Add instructions */ #define X86_FEATURE_CLFLUSHOPT ( 9*32+23)/* CLFLUSHOPT instruction */ #define X86_FEATURE_CLWB ( 9*32+24)/* CLWB instruction */ +#define X86_FEATURE_INTEL_PT ( 9*32+25)/* Intel Processor Trace */ #define X86_FEATURE_AVX512PF ( 9*32+26)/* AVX-512 Prefetch */ #define X86_FEATURE_AVX512ER ( 9*32+27)/* AVX-512 Exponential and Reciprocal */ #define X86_FEATURE_AVX512CD ( 9*32+28)/* AVX-512 Conflict Detection */
@@ -268,6 +272,9 @@#define X86_FEATURE_CLZERO (13*32+ 0)/* CLZERO instruction */ #define X86_FEATURE_IRPERF (13*32+ 1)/* Instructions Retired Count */ #define X86_FEATURE_XSAVEERPTR (13*32+ 2)/* Always save/restore FP error pointers */ +#define X86_FEATURE_IBPB (13*32+12)/* Indirect Branch Prediction Barrier */ +#define X86_FEATURE_IBRS (13*32+14)/* Indirect Branch Restricted Speculation */ +#define X86_FEATURE_STIBP (13*32+15)/* Single Thread Indirect Branch Predictors */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0)/* Digital Thermal Sensor */
@@ -316,6 +323,13 @@#define X86_FEATURE_SUCCOR (17*32+ 1)/* Uncorrectable error containment and recovery */ #define X86_FEATURE_SMCA (17*32+ 3)/* Scalable MCA */ +/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ +#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2)/* AVX-512 Neural Network Instructions */ +#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3)/* AVX-512 Multiply Accumulation Single precision */ +#define X86_FEATURE_SPEC_CTRL (18*32+26)/* "" Speculation Control (IBRS + IBPB) */ +#define X86_FEATURE_INTEL_STIBP (18*32+27)/* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_ARCH_CAPABILITIES (18*32+29)/* IA32_ARCH_CAPABILITIES MSR (Intel) */ +/* * BUG word(s) */
@@ -342,5 +356,7 @@#define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ #define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ #define X86_BUG_CPU_MELTDOWN X86_BUG(14)/* CPU is affected by meltdown attack and needs kernel page table isolation */ +#define X86_BUG_SPECTRE_V1 X86_BUG(15)/* CPU is affected by Spectre variant 1 attack with conditional branches */ +#define X86_BUG_SPECTRE_V2 X86_BUG(16)/* CPU is affected by Spectre variant 2 attack with indirect branches */ #endif /* _ASM_X86_CPUFEATURES_H */
tools/arch/x86/include/asm/disabled-features.h +2 -1
@@ -77,6 +77,7 @@#define DISABLED_MASK15 0#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP)#define DISABLED_MASK17 0 -#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) +#define DISABLED_MASK18 0 +#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)#endif /* _ASM_X86_DISABLED_FEATURES_H */
tools/arch/x86/include/asm/required-features.h +2 -1
@@ -106,6 +106,7 @@#define REQUIRED_MASK15 0#define REQUIRED_MASK16 (NEED_LA57)#define REQUIRED_MASK17 0 -#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) +#define REQUIRED_MASK18 0 +#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)#endif /* _ASM_X86_REQUIRED_FEATURES_H */
Signature · 1 line
2.14.3
Re: [PATCH 05/10] tools headers: Synchoronize x86 features UAPI headers
Quoted 7 lines · Arnaldo Carvalho de Melo
None will entail changes in the
tools/perf/, synchronizing to elliminate these perf build warnings:Warning: Kernel ABI header at '
tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/required-features.h' differs from latest version at 'arch/x86/include/asm/required-features.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Ick. Have we considered just using a symlink? Why have copies of the same header file in different places in the tree, and tooling to complain i̶f̶when they get out of sync?
Re: [PATCH 05/10] tools headers: Synchoronize x86 features UAPI headers
Quoted 7 lines · David Woodhouse
Quoted 4 lines · Arnaldo Carvalho de Melo
None will entail changes in the
tools/perf/, synchronizing to elliminate these perf build warnings:
Quoted 7 lines
Quoted 3 lines
Warning: Kernel ABI header at '
tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/required-features.h' differs from latest version at 'arch/x86/include/asm/required-features.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'Ick. Have we considered just using a symlink? Why have copies of the same header file in different places in the tree, and tooling to complain i̶f̶when they get out of sync?
In the past we had incidents where kernel changes broke tooling and vice versa.
This is basically a soft-COW mechanism that decouples tooling source code from the kernel source code, while still having a technological mechanism in place that encourages the syncing of header files.
Thanks,
Ingo
Arnaldo Carvalho de Melo
maintainerPATCH 6/10 perf evsel: Fix period/freq terms setup
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Stephane reported that we don't set properly PERIOD sample type for events with period term defined.
Before:
$ perf record -e cpu/cpu-cycles,period=1000/u ls $ perf evlist -v cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME|PERIOD, ...
After:
$ perf record -e cpu/cpu-cycles,period=1000/u ls $ perf evlist -v cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME, ...
Setting PERIOD sample type based on period term setup.
Committer note:
When we use -c or a period=N term in the event definition, then we don't need to ask the kernel, for this event, via perf_event_attr.sample_type |= PERF_SAMPLE_PERIOD, to put the event period in each sample for this event, as we know it already, it is in perf_event_attr.sample_period.
--- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evsel.c +2 -0
@@ -745,12 +745,14 @@ static void apply_config_terms(struct perf_evsel *evsel,if (!(term->weak && opts->user_interval !=ULLONG_MAX )) { attr->sample_period = term->val.period; attr->freq =0 ; +perf_evsel__reset_sample_bit (evsel,PERIOD ); }break ;case PERF_EVSEL__CONFIG_TERM_FREQ :if (!(term->weak && opts->user_freq !=UINT_MAX )) { attr->sample_freq = term->val.freq; attr->freq =1 ; +perf_evsel__set_sample_bit (evsel,PERIOD ); }break ;case PERF_EVSEL__CONFIG_TERM_TIME :
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 7/10 perf record: Fix period option handling
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Stephan reported we don't unset PERIOD sample type when --no-period is specified. Adding the unset check and reset PERIOD if --no-period is specified.
Committer notes:
Check the sample_type, it shouldn't have PERF_SAMPLE_PERIOD there when --no-period is used.
Before:
# perf record --no-period sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.018 MB perf.data (7 samples) ]
# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
#After:
[root@jouet ~]# perf record --no-period sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.019 MB perf.data (17 samples) ]
[root@jouet ~]# perf evlist -v
cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1 [root@jouet ~]#
--- tools/perf/builtin-record.c | 3 ++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 11 ++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +2 -1
@@ -1566,7 +1566,8 @@ static struct option __record_options[] = {OPT_BOOLEAN_SET ('T' ,"timestamp" , &record.opts.sample_time, &record.opts.sample_time_set,"Record the sample timestamps" ), -OPT_BOOLEAN ('P' ,"period" , &record.opts.period,"Record the sample period" ), +OPT_BOOLEAN_SET ('P' ,"period" , &record.opts.period, &record.opts.period_set, +"Record the sample period" ),OPT_BOOLEAN ('n' ,"no-samples" , &record.opts.no_samples,"don't sample" ), OPT_BOOLEAN_SET('N', "no-buildid-cache", &record.no_buildid_cache,
tools/perf/perf.h +1 -0
@@ -50,6 +50,7 @@ struct record_opts {bool sample_time_set;bool sample_cpu;bool period; +bool period_set;bool running_time;bool full_auxtrace;bool auxtrace_snapshot_mode;
tools/perf/util/evsel.c +8 -3
@@ -971,9 +971,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,if (target__has_cpu (&opts->target) || opts->sample_cpu)perf_evsel__set_sample_bit (evsel,CPU ); -if (opts->period) -perf_evsel__set_sample_bit (evsel,PERIOD ); -/* * When the user explicitly disabled time don't force it here. */
@@ -1075,6 +1072,14 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,apply_config_terms (evsel, opts, track); evsel->ignore_missing_thread = opts->ignore_missing_thread; + +/* The --period option takes the precedence. */ +if (opts->period_set) { +if (opts->period) +perf_evsel__set_sample_bit (evsel,PERIOD ); +else +perf_evsel__reset_sample_bit (evsel,PERIOD ); + } }static int perf_evsel__alloc_fd (struct perf_evsel *evsel,int ncpus,int nthreads)
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 8/10 x86/events/intel/ds: Add PERF_SAMPLE_PERIOD into PEBS_FREERUNNING_FLAGS
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Stephane reported that we don't support period for enabling large PEBS data, which there's no reason for. Adding PERF_SAMPLE_PERIOD into freerunning flags.
Tested it with:
# perf record -e cycles:P -c 100 --no-timestamp -C 0 --period
--- arch/x86/events/perf_event.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/perf_event.h +2 -1
@@ -93,7 +93,8 @@ struct amd_nb { PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_STREAM_ID | \ PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \ PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \ - PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER) + PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ + PERF_SAMPLE_PERIOD)#define PEBS_REGS \ (PERF_REG_X86_AX | \
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 9/10 perf trace: Fix call-graph output
In reply to Arnaldo Carvalho de MeloFrom: Ravi Bangoria <[email protected]>
Recently, Arnaldo fixed global vs event specific --max-stack usage with commit bd3dda9ab0fb ("perf trace: Allow overriding global --max-stack per event"). This commit is having a regression when we don't use --max-stack at all with perf trace. Ex,
$ ./perf trace record -g ls
$ ./perf trace -i perf.data
0.076 ( 0.002 ms): ls/9109 brk(
0.196 ( 0.008 ms): ls/9109 access(filename: 0x9f998b70, mode: R
0.209 ( 0.031 ms): ls/9109 open(filename: 0x9f998978, flags: CLOEXECThis is missing call-traces.
After patch:
$ ./perf trace -i perf.data
0.076 ( 0.002 ms): ls/9109 brk(
do_syscall_trace_leave ([kernel.kallsyms])
[0] ([unknown])
syscall_exit_work ([kernel.kallsyms])
brk (/usr/lib64/ld-2.17.so)
_dl_sysdep_start (/usr/lib64/ld-2.17.so)
_dl_start_final (/usr/lib64/ld-2.17.so)
_dl_start (/usr/lib64/ld-2.17.so)
_start (/usr/lib64/ld-2.17.so)
0.196 ( 0.008 ms): ls/9109 access(filename: 0x9f998b70, mode: R
do_syscall_trace_leave ([kernel.kallsyms])
[0] ([unknown])--- tools/perf/builtin-trace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +4 -1
@@ -1661,9 +1661,12 @@ static int trace__resolve_callchain(struct trace *trace, struct perf_evsel *evse struct callchain_cursor *cursor) {struct addr_location al; +int max_stack = evsel->attr.sample_max_stack ? + evsel->attr.sample_max_stack : + trace->max_stack;if (machine__resolve (trace->host, &al, sample) <0 || -thread__resolve_callchain (al.thread, cursor, evsel, sample,NULL ,NULL , evsel->attr.sample_max_stack)) +thread__resolve_callchain (al.thread, cursor, evsel, sample,NULL ,NULL , max_stack))return -1 ;return 0 ;
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 10/10 perf tools: Add trace/beauty/generated/ into .gitignore
In reply to Arnaldo Carvalho de MeloFrom: Ravi Bangoria <[email protected]>
No functionality changes.
--- tools/perf/.gitignore | 1 + 1 file changed, 1 insertion(+)
tools/perf/.gitignore +1 -0
@@ -31,5 +31,6 @@ config.mak.autogen .config-detected util/intel-pt-decoder/inat-tables.c arch/*/include/generated/ +trace/beauty/generated/ pmu-events/pmu-events.c pmu-events/jevents
Signature · 1 line
2.14.3
Quoted 53 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
72906f38934a49faf4d2d38ea9ae32adcf7d5d0c:Merge branch 'x86-hyperv-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip(2018-01-30 13:04:50 -0800)are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-urgent-for-mingo-4.16-20180205for you to fetch changes up to
2fe2230d4183d2c311bbb7b426491ac486216a16:perf tools: Add trace/beauty/generated/ into .gitignore (2018-02-05 13:58:02 -0300)
----------------------------------------------------------------
perf/urgent fixes:- 'period' and 'freq' handling fixes for 'perf record', also
related: add AddPERF_SAMPLE_PERIODintoPEBS_FREERUNNING_FLAGSin the x86 perf kernel driver (Jiri Olsa)- Fix 'perf trace -i perf.data' callgraph handling (Ravi Bangoria)
- Synchronize tooling headers for asound, s390 and powerpc KVM, sched and x86 features (Arnaldo Carvalho de Melo)
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Arnaldo Carvalho de Melo (5):
tools headers: Synchronizesound/asound.h
tooling headers: Synchronize updated s390 kvm UAPI headers tools headers: Sync {tools/,}arch/powerpc/include/uapi/asm/kvm.htools headers: Synchronizeuapi/linux/sched.h
tools headers: Synchoronize x86 features UAPI headersJiri Olsa (3):
perf evsel: Fix period/freq terms setup
perf record: Fix period option handling x86/events/intel/ds: AddPERF_SAMPLE_PERIODintoPEBS_FREERUNNING_FLAGSRavi Bangoria (2):
perf trace: Fix call-graph output
perf tools: Add trace/beauty/generated/ into .gitignore
Quoted 15 lines
arch/x86/events/perf_event.h | 3 ++- tools/arch/powerpc/include/uapi/asm/kvm.h | 25 +++++++++++++++++++++++++ tools/arch/s390/include/uapi/asm/kvm.h | 5 ++++- tools/arch/x86/include/asm/cpufeatures.h | 24 ++++++++++++++++++++---- tools/arch/x86/include/asm/disabled-features.h | 3 ++- tools/arch/x86/include/asm/required-features.h | 3 ++- tools/include/uapi/linux/kvm.h | 4 ++++ tools/include/uapi/linux/sched.h | 5 +++++ tools/include/uapi/sound/asound.h | 9 +++++++++ tools/perf/.gitignore | 1 + tools/perf/builtin-record.c | 3 ++- tools/perf/builtin-trace.c | 5 ++++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 13 ++++++++++--- 14 files changed, 91 insertions(+), 13 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo