1. 23 6月, 2020 2 次提交
  2. 18 6月, 2020 8 次提交
    • T
      perf build: Fix error message when asking for -fsanitize=address without required libraries · 6a1515c9
      Tiezhu Yang 提交于
      When build perf with ASan or UBSan, if libasan or libubsan can not find,
      the feature-glibc is 0 and there exists the following error log which is
      wrong, because we can find gnu/libc-version.h in /usr/include,
      glibc-devel is also installed.
      
        [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
          BUILD:   Doing 'make -j4' parallel build
          HOSTCC   fixdep.o
          HOSTLD   fixdep-in.o
          LINK     fixdep
        <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
        <stdin>:1:0: warning: -fsanitize=address not supported for this target
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                      libaudit: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
        ...                        libaio: [ OFF ]
        ...                       libzstd: [ OFF ]
        ...        disassembler-four-args: [ OFF ]
      
        Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el].  Stop.
        Makefile.perf:224: recipe for target 'sub-make' failed
        make[1]: *** [sub-make] Error 2
        Makefile:69: recipe for target 'all' failed
        make: *** [all] Error 2
        [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
        /usr/include/gnu/libc-version.h
      
      After install libasan and libubsan, the feature-glibc is 1 and the build
      process is success, so the cause is related with libasan or libubsan, we
      should check them and print an error log to reflect the reality.
      
      Committer testing:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
        ...                        libaio: [ OFF ]
        ...                       libzstd: [ OFF ]
        ...        disassembler-four-args: [ OFF ]
      
        Makefile.config:401: *** No libasan found, please install libasan.  Stop.
        make[1]: *** [Makefile.perf:231: sub-make] Error 2
        make: *** [Makefile:70: all] Error 2
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $
        $
        $ sudo dnf install libasan
        <SNIP>
        Installed:
          libasan-9.3.1-2.fc31.x86_64
        $
        $
        $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
         <SNIP>
          CC       /tmp/build/perf/util/pmu-flex.o
          FLEX     /tmp/build/perf/util/expr-flex.c
          CC       /tmp/build/perf/util/expr-bison.o
          CC       /tmp/build/perf/util/expr.o
          CC       /tmp/build/perf/util/expr-flex.o
          CC       /tmp/build/perf/util/parse-events-flex.o
          CC       /tmp/build/perf/util/parse-events.o
          LD       /tmp/build/perf/util/intel-pt-decoder/perf-in.o
          LD       /tmp/build/perf/util/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        <SNIP>
          INSTALL  python-scripts
          INSTALL  perf_completion-script
          INSTALL  perf-tip
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $ ldd ~/bin/perf | grep asan
        	libasan.so.5 => /lib64/libasan.so.5 (0x00007f0904164000)
        $
      
      And if we rebuild without -fsanitize-address:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
          GEN      /tmp/build/perf/common-cmds.h
          CC       /tmp/build/perf/exec-cmd.o
        <SNIP>
          INSTALL  perf_completion-script
          INSTALL  perf-tip
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $ ldd ~/bin/perf | grep asan
        $
      Signed-off-by: NTiezhu Yang <yangtiezhu@loongson.cn>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: tiezhu yang <yangtiezhu@loongson.cn>
      Cc: xuefeng li <lixuefeng@loongson.cn>
      Link: http://lore.kernel.org/lkml/1592445961-28044-1-git-send-email-yangtiezhu@loongson.cnSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6a1515c9
    • S
      tools lib traceevent: Add handler for __builtin_expect() · 1b20d949
      Steven Rostedt (VMware) 提交于
      In order to move pointer checks like IS_ERR_VALUE() out of the hotpath
      and into the reader path of a trace event, user space tools need to be
      able to parse that. IS_ERR_VALUE() is defined as:
      
       #define IS_ERR_VALUE() unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
      
      Which eventually turns into:
      
        __builtin_expect(!!((unsigned long)(void *)(x) >= (unsigned long)-4095), 0)
      
      Now the traceevent parser can handle most of that except for the
      __builtin_expect(), which needs to be added.
      
      Link: https://lore.kernel.org/linux-mm/20200320055823.27089-3-jaewon31.kim@samsung.com/Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jaewon Kim <jaewon31.kim@samsung.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: linux-mm@kvack.org
      Cc: linux-trace-devel@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200324200956.821799393@goodmis.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1b20d949
    • S
      tools lib traceevent: Handle __attribute__((user)) in field names · 74621d92
      Steven Rostedt (VMware) 提交于
      Commit c61f13ea ("gcc-plugins: Add structleak for more stack
      initialization") added "__attribute__((user))" to the user when
      stackleak detector is enabled. This now appears in the field format of
      system call trace events for system calls that have user buffers. The
      "__attribute__((user))" breaks the parsing in libtraceevent. That needs
      to be handled.
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jaewon Kim <jaewon31.kim@samsung.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: linux-mm@kvack.org
      Cc: linux-trace-devel@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200324200956.663647256@goodmis.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      74621d92
    • S
      tools lib traceevent: Add append() function helper for appending strings · 27d4d336
      Steven Rostedt (VMware) 提交于
      There's several locations that open code realloc and strcat() to append
      text to strings. Add an append() function that takes a delimiter and a
      string to append to another string.
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jaewon Lim <jaewon31.kim@samsung.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: linux-mm@kvack.org
      Cc: linux-trace-devel@vger.kernel.org
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Link: http://lore.kernel.org/lkml/20200324200956.515118403@goodmis.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      27d4d336
    • A
      tools headers UAPI: Sync linux/fs.h with the kernel sources · 0e093c77
      Arnaldo Carvalho de Melo 提交于
      To pick the changes from:
      
        b383a73f ("fs/ext4: Introduce DAX inode flag")
      
      And silence this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fs.h' differs from latest version at 'include/uapi/linux/fs.h'
        diff -u tools/include/uapi/linux/fs.h include/uapi/linux/fs.h
      
      It causes various beautifiers for things like fspick, fsmount, etc (see
      below) to get rebuilt, but this specific change doesn't make 'perf
      trace' be capable of decoding anything new, as we still don't decode
      what comes from ioctls, just its cmds.
      
      Details about the update:
      
        $ cp include/uapi/linux/fs.h tools/include/uapi/linux/fs.h
        $ git diff
        diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h
        index 379a612f8f1d..f44eb0a04afd 100644
        --- a/tools/include/uapi/linux/fs.h
        +++ b/tools/include/uapi/linux/fs.h
        @@ -262,6 +262,7 @@ struct fsxattr {
         #define FS_EA_INODE_FL                 0x00200000 /* Inode used for large EA */
         #define FS_EOFBLOCKS_FL                        0x00400000 /* Reserved for ext4 */
         #define FS_NOCOW_FL                    0x00800000 /* Do not cow file */
        +#define FS_DAX_FL                      0x02000000 /* Inode is DAX */
         #define FS_INLINE_DATA_FL              0x10000000 /* Reserved for ext4 */
         #define FS_PROJINHERIT_FL              0x20000000 /* Create with parents projid */
         #define FS_CASEFOLD_FL                 0x40000000 /* Folder is case insensitive */
        $ m
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j8' parallel build
          INSTALL  GTK UI
          CC       /tmp/build/perf/builtin-trace.o
          DESCEND  plugins
          CC       /tmp/build/perf/trace/beauty/fsmount.o
          CC       /tmp/build/perf/trace/beauty/fspick.o
          CC       /tmp/build/perf/trace/beauty/mount_flags.o
          CC       /tmp/build/perf/trace/beauty/move_mount.o
          CC       /tmp/build/perf/trace/beauty/renameat.o
          CC       /tmp/build/perf/trace/beauty/sync_file_range.o
          INSTALL  trace_plugins
          LD       /tmp/build/perf/trace/beauty/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        <SNIP>
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0e093c77
    • A
      tools include UAPI: Sync linux/vhost.h with the kernel sources · f64925c1
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        776f3950 ("vhost_vdpa: Support config interrupt in vdpa")
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
        diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
      
      This automatically picks the new ioctl introduced in the above patch,
      making tools such as 'perf trace' aware of them and possibly allowing to
      use the strings in filters, etc:
      
        # perf trace -e ioctl --pid 7951
        <SNIP>
           0.178 ( 0.010 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
           0.194 ( 0.010 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
           0.209 ( 0.010 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
           0.224 (249.413 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.660 ( 0.011 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.675 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.686 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.697 ( 0.008 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.709 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.720 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.730 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.740 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.752 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.762 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.772 ( 0.007 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         249.782 (120.138 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         370.201 ( 0.039 ms): CPU 0/KVM/8023 ioctl(fd: 12, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7f744f9e1420) = 0
         370.254 ( 0.052 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         370.575 ( 0.365 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         370.973 ( 0.028 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         371.015 ( 0.037 ms): CPU 0/KVM/8023 ioctl(fd: 14, cmd: KVM_RUN) = 0
         371.071 ( 0.009 ms): CPU 0/KVM/8023 ioctl(fd: 12, cmd: KVM_IRQ_LINE_STATUS, arg: 0x7f744f9e14b0) = 0
        <SNIP>
        #
      
      Details about the update:
      
        $ diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
        --- tools/include/uapi/linux/vhost.h	2020-04-16 13:19:12.056763843 -0300
        +++ include/uapi/linux/vhost.h	2020-06-17 10:04:20.532056428 -0300
        @@ -15,6 +15,8 @@
         #include <linux/types.h>
         #include <linux/ioctl.h>
      
        +#define VHOST_FILE_UNBIND -1
        +
         /* ioctls */
      
         #define VHOST_VIRTIO 0xAF
        @@ -140,4 +142,6 @@
         /* Get the max ring size. */
         #define VHOST_VDPA_GET_VRING_NUM	_IOR(VHOST_VIRTIO, 0x76, __u16)
      
        +/* Set event fd for config interrupt*/
        +#define VHOST_VDPA_SET_CONFIG_CALL	_IOW(VHOST_VIRTIO, 0x77, int)
         #endif
        $
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before
        $ cp include/uapi/linux/vhost.h tools/include/uapi/linux/vhost.h
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after
        $ diff -u before after
        --- before	2020-06-17 10:15:35.123275966 -0300
        +++ after	2020-06-17 10:15:51.812482117 -0300
        @@ -27,6 +27,7 @@
         	[0x72] = "VDPA_SET_STATUS",
         	[0x74] = "VDPA_SET_CONFIG",
         	[0x75] = "VDPA_SET_VRING_ENABLE",
        +	[0x77] = "VDPA_SET_CONFIG_CALL",
         };
         static const char *vhost_virtio_ioctl_read_cmds[] = {
         	[0x00] = "GET_FEATURES",
        $
      
      This causes these parts to get rebuilt:
      
        CC       /tmp/build/perf/trace/beauty/ioctl.o
        INSTALL  trace_plugins
        LD       /tmp/build/perf/trace/beauty/perf-in.o
        LD       /tmp/build/perf/perf-in.o
        LINK     /tmp/build/perf/perf
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zhu Lingshan <lingshan.zhu@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f64925c1
    • A
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 25ca7e5c
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        7e5b3c26 ("x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation")
      
      Addressing these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
        diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      With this one will be able to use these new AMD MSRs in filters, by
      name, e.g.:
      
        # perf trace -e msr:* --filter "msr==IA32_MCU_OPT_CTRL"
        ^C#
      
      Using -v we can see how it sets up the tracepoint filters, converting
      from the string in the filter to the numeric value:
      
        # perf trace -v -e msr:* --filter "msr==IA32_MCU_OPT_CTRL"
        Using CPUID GenuineIntel-6-8E-A
        0x123
        New filter for msr:read_msr: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
        0x123
        New filter for msr:write_msr: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
        0x123
        New filter for msr:rdpmc: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
        mmap size 528384B
        ^C#
      
      The updating process shows how this affects tooling in more detail:
      
        $ diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
        --- tools/arch/x86/include/asm/msr-index.h	2020-06-03 10:36:09.959910238 -0300
        +++ arch/x86/include/asm/msr-index.h	2020-06-17 10:04:20.235052901 -0300
        @@ -128,6 +128,10 @@
         #define TSX_CTRL_RTM_DISABLE		BIT(0)	/* Disable RTM feature */
         #define TSX_CTRL_CPUID_CLEAR		BIT(1)	/* Disable TSX enumeration */
      
        +/* SRBDS support */
        +#define MSR_IA32_MCU_OPT_CTRL		0x00000123
        +#define RNGDS_MITG_DIS			BIT(0)
        +
         #define MSR_IA32_SYSENTER_CS		0x00000174
         #define MSR_IA32_SYSENTER_ESP		0x00000175
         #define MSR_IA32_SYSENTER_EIP		0x00000176
        $ set -o vi
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        --- before	2020-06-17 10:05:49.653114752 -0300
        +++ after	2020-06-17 10:06:01.777258731 -0300
        @@ -51,6 +51,7 @@
         	[0x0000011e] = "IA32_BBL_CR_CTL3",
         	[0x00000120] = "IDT_MCR_CTRL",
         	[0x00000122] = "IA32_TSX_CTRL",
        +	[0x00000123] = "IA32_MCU_OPT_CTRL",
         	[0x00000140] = "MISC_FEATURES_ENABLES",
         	[0x00000174] = "IA32_SYSENTER_CS",
         	[0x00000175] = "IA32_SYSENTER_ESP",
        $
      
      The related change to cpu-features.h affects this:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      This shouldn't be affecting that 'perf bench' entry:
      
        $ find tools/perf/ -type f | xargs grep SRBDS
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Gross <mgross@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      25ca7e5c
    • M
      perf script: Initialize zstd_data · b13b04d9
      Milian Wolff 提交于
      Fixes segmentation fault when trying to interpret zstd-compressed data
      with perf script:
      
      ```
        $ perf record -z ls
        ...
        [ perf record: Captured and wrote 0,010 MB perf.data, compressed (original 0,001 MB, ratio is 2,190) ]
        $ memcheck perf script
        ...
        ==67911== Invalid read of size 4
        ==67911==    at 0x5568188: ZSTD_decompressStream (in /usr/lib/libzstd.so.1.4.5)
        ==67911==    by 0x6E726B: zstd_decompress_stream (zstd.c:100)
        ==67911==    by 0x65729C: perf_session__process_compressed_event (session.c:72)
        ==67911==    by 0x6598E8: perf_session__process_user_event (session.c:1583)
        ==67911==    by 0x65BA59: reader__process_events (session.c:2177)
        ==67911==    by 0x65BA59: __perf_session__process_events (session.c:2234)
        ==67911==    by 0x65BA59: perf_session__process_events (session.c:2267)
        ==67911==    by 0x5A7397: __cmd_script (builtin-script.c:2447)
        ==67911==    by 0x5A7397: cmd_script (builtin-script.c:3840)
        ==67911==    by 0x5FE9D2: run_builtin (perf.c:312)
        ==67911==    by 0x711627: handle_internal_command (perf.c:364)
        ==67911==    by 0x711627: run_argv (perf.c:408)
        ==67911==    by 0x711627: main (perf.c:538)
        ==67911==  Address 0x71d8 is not stack'd, malloc'd or (recently) free'd
      ```
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NAlexey Budankov <alexey.budankov@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LPU-Reference: 20200612230333.72140-1-milian.wolff@kdab.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b13b04d9
  3. 17 6月, 2020 7 次提交
  4. 16 6月, 2020 5 次提交
  5. 15 6月, 2020 1 次提交
  6. 13 6月, 2020 2 次提交
  7. 12 6月, 2020 4 次提交
  8. 11 6月, 2020 3 次提交
  9. 10 6月, 2020 8 次提交
    • I
      perf pmu: Remove unused declaration · 85d0f9ad
      Ian Rogers 提交于
      This avoids multiple declarations if the flex header is included.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200609234344.3795-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      85d0f9ad
    • B
      tools, bpf: Do not force gcc as CC · 47f6bc4c
      Brett Mastbergen 提交于
      This allows transparent cross-compilation with CROSS_COMPILE by
      relying on 7ed1c190 ("tools: fix cross-compile var clobbering").
      
      Same change was applied to tools/bpf/bpftool/Makefile in
      9e88b931 ("tools: bpftool: do not force gcc as CC").
      Signed-off-by: NBrett Mastbergen <brett.mastbergen@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20200609213506.3299-1-brett.mastbergen@gmail.com
      47f6bc4c
    • A
      libbpf: Handle GCC noreturn-turned-volatile quirk · 32022fd9
      Andrii Nakryiko 提交于
      Handle a GCC quirk of emitting extra volatile modifier in DWARF (and
      subsequently preserved in BTF by pahole) for function pointers marked as
      __attribute__((noreturn)). This was the way to mark such functions before GCC
      2.5 added noreturn attribute. Drop such func_proto modifiers, similarly to how
      it's done for array (also to handle GCC quirk/bug).
      
      Such volatile attribute is emitted by GCC only, so existing selftests can't
      express such test. Simple repro is like this (compiled with GCC + BTF
      generated by pahole):
      
        struct my_struct {
            void __attribute__((noreturn)) (*fn)(int);
        };
        struct my_struct a;
      
      Without this fix, output will be:
      
      struct my_struct {
          voidvolatile  (*fn)(int);
      };
      
      With the fix:
      
      struct my_struct {
          void (*fn)(int);
      };
      
      Fixes: 351131b5 ("libbpf: add btf_dump API for BTF-to-C conversion")
      Reported-by: NJean-Philippe Brucker <jean-philippe@linaro.org>
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Tested-by: NJean-Philippe Brucker <jean-philippe@linaro.org>
      Link: https://lore.kernel.org/bpf/20200610052335.2862559-1-andriin@fb.com
      32022fd9
    • A
      libbpf: Define __WORDSIZE if not available · 8ca8d4a8
      Arnaldo Carvalho de Melo 提交于
      Some systems, such as Android, don't have a define for __WORDSIZE, do it
      in terms of __SIZEOF_LONG__, as done in perf since 2012:
      
         http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5
      
      For reference: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
      
      I build tested it here and Andrii did some Travis CI build tests too.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200608161150.GA3073@kernel.org
      8ca8d4a8
    • T
      selftests/net: in rxtimestamp getopt_long needs terminating null entry · 865a6cbb
      tannerlove 提交于
      getopt_long requires the last element to be filled with zeros.
      Otherwise, passing an unrecognized option can cause a segfault.
      
      Fixes: 16e78122 ("selftests/net: Add a test to validate behavior of rx timestamps")
      Signed-off-by: NTanner Love <tannerlove@google.com>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      865a6cbb
    • J
      bpf: Selftests and tools use struct bpf_devmap_val from uapi · 042b1545
      Jesper Dangaard Brouer 提交于
      Sync tools uapi bpf.h header file and update selftests that use
      struct bpf_devmap_val.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/159170951195.2102545.1833108712124273987.stgit@firesoul
      042b1545
    • L
      bpf: cgroup: Allow multi-attach program to replace itself · 248e00ac
      Lorenz Bauer 提交于
      When using BPF_PROG_ATTACH to attach a program to a cgroup in
      BPF_F_ALLOW_MULTI mode, it is not possible to replace a program
      with itself. This is because the check for duplicate programs
      doesn't take the replacement program into account.
      
      Replacing a program with itself might seem weird, but it has
      some uses: first, it allows resetting the associated cgroup storage.
      Second, it makes the API consistent with the non-ALLOW_MULTI usage,
      where it is possible to replace a program with itself. Third, it
      aligns BPF_PROG_ATTACH with bpf_link, where replacing itself is
      also supported.
      
      Sice this code has been refactored a few times this change will
      only apply to v5.7 and later. Adjustments could be made to
      commit 1020c1f2 ("bpf: Simplify __cgroup_bpf_attach") and
      commit d7bf2c10 ("bpf: allocate cgroup storage entries on attaching bpf programs")
      as well as commit 324bda9e ("bpf: multi program support for cgroup+bpf")
      
      Fixes: af6eea57 ("bpf: Implement bpf_link-based cgroup BPF program attachment")
      Signed-off-by: NLorenz Bauer <lmb@cloudflare.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20200608162202.94002-1-lmb@cloudflare.com
      248e00ac
    • D
      kallsyms/printk: add loglvl to print_ip_sym() · 2062a4e8
      Dmitry Safonov 提交于
      Patch series "Add log level to show_stack()", v3.
      
      Add log level argument to show_stack().
      
      Done in three stages:
      1. Introducing show_stack_loglvl() for every architecture
      2. Migrating old users with an explicit log level
      3. Renaming show_stack_loglvl() into show_stack()
      
      Justification:
      
      - It's a design mistake to move a business-logic decision into platform
        realization detail.
      
      - I have currently two patches sets that would benefit from this work:
        Removing console_loglevel jumps in sysrq driver [1] Hung task warning
        before panic [2] - suggested by Tetsuo (but he probably didn't realise
        what it would involve).
      
      - While doing (1), (2) the backtraces were adjusted to headers and other
        messages for each situation - so there won't be a situation when the
        backtrace is printed, but the headers are missing because they have
        lesser log level (or the reverse).
      
      - As the result in (2) plays with console_loglevel for kdb are removed.
      
      The least important for upstream, but maybe still worth to note that every
      company I've worked in so far had an off-list patch to print backtrace
      with the needed log level (but only for the architecture they cared
      about).  If you have other ideas how you will benefit from show_stack()
      with a log level - please, reply to this cover letter.
      
      See also discussion on v1:
      https://lore.kernel.org/linux-riscv/20191106083538.z5nlpuf64cigxigh@pathway.suse.cz/
      
      This patch (of 50):
      
      print_ip_sym() needs to have a log level parameter to comply with other
      parts being printed.  Otherwise, half of the expected backtrace would be
      printed and other may be missing with some logging level.
      
      The following callee(s) are using now the adjusted log level:
      - microblaze/unwind: the same level as headers & userspace unwind.
        Note that pr_debug()'s there are for debugging the unwinder itself.
      - nds32/traps: symbol addresses are printed with the same log level
        as backtrace headers.
      - lockdep: ip for locking issues is printed with the same log level
        as other part of the warning.
      - sched: ip where preemption was disabled is printed as error like
        the rest part of the message.
      - ftrace: bug reports are now consistent in the log level being used.
      Signed-off-by: NDmitry Safonov <dima@arista.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Ben Segall <bsegall@google.com>
      Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Dmitry Safonov <0x7f454c46@gmail.com>
      Cc: Dmitry Safonov <dima@arista.com>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Link: http://lkml.kernel.org/r/20200418201944.482088-2-dima@arista.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2062a4e8