1. 01 Apr, 2019 6 commits
    • Thomas Richter's avatar
      perf list: Fix s390 counter long description for L1D_RO_EXCL_WRITES · 7fcfa9a2
      Thomas Richter authored
      Command
      
        # perf list --long-desc pmu
      
      lists the long description of the available counters. For counter
      named L1D_RO_EXCL_WRITES on machine types 3906 and 3907 the long
      description contains the counter number 'Counter:128 Name:'
      prefix. This is wrong.
      
      The fix changes the description text and removes this prefix.
      
      Output before:
      
        [root@m35lp76 perf]# ./perf list --long-desc pmu
         ...
         L1D_ONDRAWER_L4_SOURCED_WRITES
          [A directory write to the Level-1 Data cache directory where the
           returned cache line was sourced from On-Drawer Level-4 cache]
      
         L1D_RO_EXCL_WRITES
          [Counter:128 Name:L1D_RO_EXCL_WRITES A directory write to the Level-1
           Data cache where the line was originally in a Read-Only state in the
           cache but has been updated to be in the Exclusive state that allows
           stores to the cache line]
      
         ...
      
      Output after:
      
        [root@m35lp76 perf]# ./perf list --long-desc pmu
         ...
         L1D_ONDRAWER_L4_SOURCED_WRITES
          [A directory write to the Level-1 Data cache directory where the
           returned cache line was sourced from On-Drawer Level-4 cache]
      
         L1D_RO_EXCL_WRITES
          [L1D_RO_EXCL_WRITES A directory write to the Level-1
           Data cache where the line was originally in a Read-Only state in the
           cache but has been updated to be in the Exclusive state that allows
           stores to the cache line]
      
         ...
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Fixes: 109d59b9 ("perf vendor events s390: Add JSON files for IBM z14")
      Link: http://lkml.kernel.org/r/20190329133337.60255-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7fcfa9a2
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Add header defining used namespace struct to event.h · 514c5403
      Arnaldo Carvalho de Melo authored
      When adding the 'struct namespaces_event' to event.h, referencing the
      'struct perf_ns_link_info' type, we forgot to add the header where it is
      defined, getting that definition only by sheer luck.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: f3b3614a ("perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info")
      Link: https://lkml.kernel.org/n/tip-qkrld0v7boc9uabjbd8csxux@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      514c5403
    • Arnaldo Carvalho de Melo's avatar
      perf trace beauty renameat: No need to include linux/fs.h · b64f1cc6
      Arnaldo Carvalho de Melo authored
      There is no use for what is in that file, as everything is
      built by the tools/perf/trace/beauty/rename_flags.sh script from
      the copied kernel headers, the end result being:
      
        $ cat /tmp/build/perf/trace/beauty/generated/rename_flags_array.c
        static const char *rename_flags[] = {
      	[0 + 1] = "NOREPLACE",
      	[1 + 1] = "EXCHANGE",
      	[2 + 1] = "WHITEOUT",
        };
        $
      
      I.e. no use of any defines from uapi/linux/fs.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-lgugmfa8z4bpw5zsbuoitllb@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b64f1cc6
    • Arnaldo Carvalho de Melo's avatar
      perf augmented_raw_syscalls: Use a PERCPU_ARRAY map to copy more string bytes · 59f3bd78
      Arnaldo Carvalho de Melo authored
      The previous method, copying to the BPF stack limited us in how many
      bytes we could copy from strings, use a PERCPU_ARRAY map like devised by
      the sysdig guys[1] to copy more bytes:
      
      Before:
      
        # trace --no-inherit -e openat touch `python -c "print "$s" 'a' * 2000"`
        touch: cannot touch 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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EC) = 3
        openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", O_CREAT|O_NOCTTY|O_NONBLOCK|O_WRONLY, S_IRUGO|S_IWUGO) = -1 ENAMETOOLONG (File name too long)
        openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
        openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
        <SNIP some openat calls>
        #
      
      After:
      
        [root@quaco acme]# trace --no-inherit -e openat touch `python -c "print "$s" 'a' * 2000"`
        <STRIP what is the same as in the 'before' part>
        openat(AT_FDCWD, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", O_CREAT|O_NOCTTY|O_NONBLOC) = -1 ENAMETOOLONG (File name too long)
        <STRIP what is the same as in the 'before' part>
      
      If we leave something like 'perf trace -e string' to trace all syscalls
      with a string, and then do some 'perf top', to get some annotation for
      the augmented_raw_syscalls.o BPF program we get:
      
             │     → callq  *ffffffffc45576d1                                                                                                          ▒
             │                augmented_args->filename.size = probe_read_str(&augmented_args->filename.value,                                          ▒
        0.05 │       mov    %eax,0x40(%r13)
      
      Looking with pahole, expanding types, asking for hex offsets and sizes,
      and use of BTF type information to see what is at that 0x40 offset from
      %r13:
      
        # pahole -F btf -C augmented_args_filename --expand_types --hex /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
        struct augmented_args_filename {
      	struct syscall_enter_args {
      		long long unsigned int common_tp_fields;                                 /*     0   0x8 */
      		long int           syscall_nr;                                           /*   0x8   0x8 */
      		long unsigned int  args[6];                                              /*  0x10  0x30 */
      	} args; /*     0  0x40 */
      	/* --- cacheline 1 boundary (64 bytes) --- */
      	struct augmented_filename {
      		unsigned int       size;                                                 /*  0x40   0x4 */
      		int                reserved;                                             /*  0x44   0x4 */
      		char               value[4096];                                          /*  0x48 0x1000 */
      	} filename; /*  0x40 0x1008 */
      
      	/* size: 4168, cachelines: 66, members: 2 */
      	/* last cacheline: 8 bytes */
        };
        #
      
      Then looking if PATH_MAX leaves some signature in the tests:
      
             │                if (augmented_args->filename.size < sizeof(augmented_args->filename.value)) {                                            ▒
             │       cmp    $0xfff,%rdi
      
      0xfff == 4095
      sizeof(augmented_args->filename.value) == PATH_MAX == 4096
      
      [1] https://sysdig.com/blog/the-art-of-writing-ebpf-programs-a-primer/
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Daniel Borkmann <borkmann@iogearbox.net>
      Cc: Gianluca Borello <g.borello@gmail.com>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      cc: Martin Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: https://lkml.kernel.org/n/tip-76gce2d2ghzq537ubwhjkone@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      59f3bd78
    • Arnaldo Carvalho de Melo's avatar
      perf augmented_raw_syscalls: Copy strings from all syscalls with 1st or 2nd string arg · c52a82f7
      Arnaldo Carvalho de Melo authored
      Gets the augmented_raw_syscalls a bit more useful as-is, add a comment
      stating that the intent is to have all this in a map populated by
      userspace via the 'syscalls' BPF map, that right now has only a flag
      stating if the syscall is filtered or not.
      
      With it:
      
        # grep -B1 augmented_raw ~/.perfconfig
        [trace]
      	add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
        #
        # perf trace -e string
        weechat/6001 stat("/etc/localtime", 0x7ffe22c23d10)  = 0
        gnome-shell/1943 openat(AT_FDCWD, "/proc/self/stat", O_RDONLY) = 81
        weechat/6001 stat("/etc/localtime", 0x7ffe22c23d10)  = 0
        gmain/2475 inotify_add_watch(20<anon_inode:inotify>, "/home/acme/.config/firewall", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/var/cache/app-info/yaml", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/var/lib/app-info/xmls", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/var/lib/app-info/yaml", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/usr/share/app-info/yaml", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/usr/local/share/app-info/xmls", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/usr/local/share/app-info/yaml", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2391 inotify_add_watch(3<anon_inode:inotify>, "/home/acme/.local/share/app-info/yaml", 16789454) = -1 ENOENT (No such file or directory)
        gmain/1121 inotify_add_watch(12<anon_inode:inotify>, "/etc/NetworkManager/VPN", 16789454) = -1 ENOENT (No such file or directory)
        weechat/6001 stat("/etc/localtime", 0x7ffe22c23d10)  = 0
        gmain/2050 inotify_add_watch(8<anon_inode:inotify>, "/home/acme/~", 16789454) = -1 ENOENT (No such file or directory)
        gmain/2521 inotify_add_watch(6<anon_inode:inotify>, "/var/lib/fwupd/remotes.d/lvfs-testing", 16789454) = -1 ENOENT (No such file or directory)
        weechat/6001 stat("/etc/localtime", 0x7ffe22c23d10)  = 0
        DOM Worker/22714  ... [continued]: openat())             = 257
        FS Broker 3982/3990 openat(AT_FDCWD, "/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY) = 187
        DOMCacheThread/16652 mkdir("/home/acme/.mozilla/firefox/ina67tev.default/storage/default/https+++web.whatsapp.com/cache/morgue/192", S_IRUGO|S_IXUGO|S_IWUSR) = -1 EEXIST (File exists)
        ^C#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-a1hxffoy8t43e0wq6bzhp23u@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c52a82f7
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Add 'string' event alias to select syscalls with string args · 2b64b2ed
      Arnaldo Carvalho de Melo authored
      Will be used in conjunction with the change to augmented_raw_syscalls.c
      in the next cset that adds all syscalls with a first or second arg
      string.
      
      With just what we have in the syscall tracepoints we get:
      
        # perf trace -e string ls > /dev/null
               ? (         ): ls/22382  ... [continued]: execve())                                           = 0
           0.043 ( 0.004 ms): ls/22382 access(filename: 0x51ad420, mode: R)                                  = -1 ENOENT (No such file or directory)
           0.051 ( 0.004 ms): ls/22382 openat(dfd: CWD, filename: 0x51aa8b3, flags: RDONLY|CLOEXEC)          = 3
           0.071 ( 0.004 ms): ls/22382 openat(dfd: CWD, filename: 0x51b4d00, flags: RDONLY|CLOEXEC)          = 3
           0.138 ( 0.009 ms): ls/22382 openat(dfd: CWD, filename: 0x51684d0, flags: RDONLY|CLOEXEC)          = 3
           0.192 ( 0.004 ms): ls/22382 openat(dfd: CWD, filename: 0x51689c0, flags: RDONLY|CLOEXEC)          = 3
           0.255 ( 0.004 ms): ls/22382 openat(dfd: CWD, filename: 0x5168eb0, flags: RDONLY|CLOEXEC)          = 3
           0.342 ( 0.003 ms): ls/22382 openat(dfd: CWD, filename: 0x51693a0, flags: RDONLY|CLOEXEC)          = 3
           0.380 ( 0.003 ms): ls/22382 openat(dfd: CWD, filename: 0x5169950, flags: RDONLY|CLOEXEC)          = 3
           0.670 ( 0.011 ms): ls/22382 statfs(pathname: 0x515c783, buf: 0x7fff54d75b70)                      = 0
           0.683 ( 0.005 ms): ls/22382 statfs(pathname: 0x515c783, buf: 0x7fff54d75a60)                      = 0
           0.725 ( 0.004 ms): ls/22382 access(filename: 0x515c7ab)                                           = 0
           0.744 ( 0.005 ms): ls/22382 openat(dfd: CWD, filename: 0x50fba20, flags: RDONLY|CLOEXEC)          = 3
           0.793 ( 0.004 ms): ls/22382 openat(dfd: CWD, filename: 0x9e3e8390, flags: RDONLY|CLOEXEC|DIRECTORY|NONBLOCK) = 3
           0.921 ( 0.006 ms): ls/22382 openat(dfd: CWD, filename: 0x50f7d90)                                 = 3
        #
      
      If we put the vfs_getname probe point in place:
      
        # perf probe 'vfs_getname=getname_flags:73 pathname=result->name:string'
        Added new events:
          probe:vfs_getname    (on getname_flags:73 with pathname=result->name:string)
          probe:vfs_getname_1  (on getname_flags:73 with pathname=result->name:string)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:vfs_getname_1 -aR sleep 1
      
        # perf trace -e string ls > /dev/null
               ? (         ): ls/22440  ... [continued]: execve())                                           = 0
           0.048 ( 0.008 ms): ls/22440 access(filename: /etc/ld.so.preload, mode: R)                         = -1 ENOENT (No such file or directory)
           0.061 ( 0.007 ms): ls/22440 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: RDONLY|CLOEXEC)   = 3
           0.092 ( 0.008 ms): ls/22440 openat(dfd: CWD, filename: /lib64/libselinux.so.1, flags: RDONLY|CLOEXEC) = 3
           0.165 ( 0.007 ms): ls/22440 openat(dfd: CWD, filename: /lib64/libcap.so.2, flags: RDONLY|CLOEXEC) = 3
           0.216 ( 0.007 ms): ls/22440 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: RDONLY|CLOEXEC)   = 3
           0.282 ( 0.007 ms): ls/22440 openat(dfd: CWD, filename: /lib64/libpcre2-8.so.0, flags: RDONLY|CLOEXEC) = 3
           0.340 ( 0.007 ms): ls/22440 openat(dfd: CWD, filename: /lib64/libdl.so.2, flags: RDONLY|CLOEXEC)  = 3
           0.383 ( 0.007 ms): ls/22440 openat(dfd: CWD, filename: /lib64/libpthread.so.0, flags: RDONLY|CLOEXEC) = 3
           0.697 ( 0.021 ms): ls/22440 statfs(pathname: /sys/fs/selinux, buf: 0x7ffee7dc9010)                = 0
           0.720 ( 0.007 ms): ls/22440 statfs(pathname: /sys/fs/selinux, buf: 0x7ffee7dc8f00)                = 0
           0.757 ( 0.007 ms): ls/22440 access(filename: /etc/selinux/config)                                 = 0
           0.779 ( 0.009 ms): ls/22440 openat(dfd: CWD, filename: /usr/lib/locale/locale-archive, flags: RDONLY|CLOEXEC) = 3
           0.830 ( 0.006 ms): ls/22440 openat(dfd: CWD, filename: ., flags: RDONLY|CLOEXEC|DIRECTORY|NONBLOCK) = 3
           0.958 ( 0.010 ms): ls/22440 openat(dfd: CWD, filename: /usr/lib64/gconv/gconv-modules.cache)      = 3
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-6fh1myvn7ulf4xwq9iz3o776@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2b64b2ed
  2. 29 Mar, 2019 1 commit
    • Thomas Gleixner's avatar
      Merge tag 'perf-urgent-for-mingo-5.1-20190329' of... · 22261fdf
      Thomas Gleixner authored
      Merge tag 'perf-urgent-for-mingo-5.1-20190329' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo:
      
      Core libraries:
        Jiri Olsa:
        - Fix max perf_event_attr.precise_ip detection.
      
        Kan Liang:
        - Fix parser error for uncore event alias
      
        Wei Lin:
        - Fixup ordering of kernel maps after obtaining the main kernel map address.
      
      Intel PT:
        Adrian Hunter:
        - Fix TSC slip where A TSC packet can slip past MTC packets so that the
          timestamp appears to go backwards.
      
        - Fixes for exported-sql-viewer GUI conversion to python3.
      
      ARM coresight:
        Solomon Tan:
        - Fix the build by adding a missing case value for enumeration value introduced
          in newer library, that now is the required one.
      
      tool headers:
        Arnaldo Carvalho de Melo:
        - Syncronize kernel headers with the kernel, getting new io_uring and
          pidfd_send_signal syscalls so that 'perf trace' can handle them.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      22261fdf
  3. 28 Mar, 2019 18 commits
    • Kan Liang's avatar
      perf pmu: Fix parser error for uncore event alias · e94d6b7f
      Kan Liang authored
      Perf fails to parse uncore event alias, for example:
      
        # perf stat -e unc_m_clockticks -a --no-merge sleep 1
        event syntax error: 'unc_m_clockticks'
                             \___ parser error
      
      Current code assumes that the event alias is from one specific PMU.
      
      To find the PMU, perf strcmps the PMU name of event alias with the real
      PMU name on the system.
      
      However, the uncore event alias may be from multiple PMUs with common
      prefix. The PMU name of uncore event alias is the common prefix.
      
      For example, UNC_M_CLOCKTICKS is clock event for iMC, which include 6
      PMUs with the same prefix "uncore_imc" on a skylake server.
      
      The real PMU names on the system for iMC are uncore_imc_0 ...
      uncore_imc_5.
      
      The strncmp is used to only check the common prefix for uncore event
      alias.
      
      With the patch:
      
        # perf stat -e unc_m_clockticks -a --no-merge sleep 1
        Performance counter stats for 'system wide':
      
             723,594,722      unc_m_clockticks [uncore_imc_5]
             724,001,954      unc_m_clockticks [uncore_imc_3]
             724,042,655      unc_m_clockticks [uncore_imc_1]
             724,161,001      unc_m_clockticks [uncore_imc_4]
             724,293,713      unc_m_clockticks [uncore_imc_2]
             724,340,901      unc_m_clockticks [uncore_imc_0]
      
             1.002090060 seconds time elapsed
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: stable@vger.kernel.org
      Fixes: ea1fa48c ("perf stat: Handle different PMU names with common prefix")
      Link: http://lkml.kernel.org/r/1552672814-156173-1-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e94d6b7f
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Fix python3 support · 606bd60a
      Adrian Hunter authored
      Unlike python2, python3 strings are not compatible with byte strings.
      That results in disassembly not working for the branches reports. Fixup
      those places overlooked in the port to python3.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Fixes: beda0e72 ("perf script python: Add Python3 support to exported-sql-viewer.py")
      Link: http://lkml.kernel.org/r/20190327072826.19168-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      606bd60a
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Fix never-ending loop · 8453c936
      Adrian Hunter authored
      pyside version 1 fails to handle python3 large integers in some cases,
      resulting in Qt getting into a never-ending loop. This affects:
      	samples Table
      	samples_view Table
      	All branches Report
      	Selected branches Report
      
      Add workarounds for those cases.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Fixes: beda0e72 ("perf script python: Add Python3 support to exported-sql-viewer.py")
      Link: http://lkml.kernel.org/r/20190327072826.19168-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8453c936
    • Wei Li's avatar
      perf machine: Update kernel map address and re-order properly · 977c7a6d
      Wei Li authored
      Since commit 1fb87b8e ("perf machine: Don't search for active kernel
      start in __machine__create_kernel_maps"), the __machine__create_kernel_maps()
      just create a map what start and end are both zero. Though the address will be
      updated later, the order of map in the rbtree may be incorrect.
      
      The commit ee05d217 ("perf machine: Set main kernel end address properly")
      fixed the logic in machine__create_kernel_maps(), but it's still wrong in
      function machine__process_kernel_mmap_event().
      
      To reproduce this issue, we need an environment which the module address
      is before the kernel text segment. I tested it on an aarch64 machine with
      kernel 4.19.25:
      
        [root@localhost hulk]# grep _stext /proc/kallsyms
        ffff000008081000 T _stext
        [root@localhost hulk]# grep _etext /proc/kallsyms
        ffff000009780000 R _etext
        [root@localhost hulk]# tail /proc/modules
        hisi_sas_v2_hw 77824 0 - Live 0xffff00000191d000
        nvme_core 126976 7 nvme, Live 0xffff0000018b6000
        mdio 20480 1 ixgbe, Live 0xffff0000018ab000
        hisi_sas_main 106496 1 hisi_sas_v2_hw, Live 0xffff000001861000
        hns_mdio 20480 2 - Live 0xffff000001822000
        hnae 28672 3 hns_dsaf,hns_enet_drv, Live 0xffff000001815000
        dm_mirror 40960 0 - Live 0xffff000001804000
        dm_region_hash 32768 1 dm_mirror, Live 0xffff0000017f5000
        dm_log 32768 2 dm_mirror,dm_region_hash, Live 0xffff0000017e7000
        dm_mod 315392 17 dm_mirror,dm_log, Live 0xffff000001780000
        [root@localhost hulk]#
      
      Before fix:
      
        [root@localhost bin]# perf record sleep 3
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.011 MB perf.data (9 samples) ]
        [root@localhost bin]# perf buildid-list -i perf.data
        4c4e46c971ca935f781e603a09b52a92e8bdfee8 [vdso]
        [root@localhost bin]# perf buildid-list -i perf.data -H
        0000000000000000000000000000000000000000 /proc/kcore
        [root@localhost bin]#
      
      After fix:
      
        [root@localhost tools]# ./perf/perf record sleep 3
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.011 MB perf.data (9 samples) ]
        [root@localhost tools]# ./perf/perf buildid-list -i perf.data
        28a6c690262896dbd1b5e1011ed81623e6db0610 [kernel.kallsyms]
        106c14ce6e4acea3453e484dc604d66666f08a2f [vdso]
        [root@localhost tools]# ./perf/perf buildid-list -i perf.data -H
        28a6c690262896dbd1b5e1011ed81623e6db0610 /proc/kcore
      Signed-off-by: default avatarWei Li <liwei391@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Li Bin <huawei.libin@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190228092003.34071-1-liwei391@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      977c7a6d
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync powerpc's asm/kvm.h copy with the kernel sources · 707c373c
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        2b57ecd0 ("KVM: PPC: Book3S: Add count cache flush parameters to kvmppc_get_cpu_char()")
      
      That don't cause any changes in the tools.
      
      This silences this perf build warning:
      
        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'
        diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
      Link: https://lkml.kernel.org/n/tip-4pb7ywp9536hub2pnj4hu6i4@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      707c373c
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update x86's syscall_64.tbl and uapi/asm-generic/unistd · 8142bd82
      Arnaldo Carvalho de Melo authored
      To pick up the changes introduced in the following csets:
      
        2b188cc1 ("Add io_uring IO interface")
        edafccee ("io_uring: add support for pre-mapped user IO buffers")
        3eb39f47 ("signal: add pidfd_send_signal() syscall")
      
      This makes 'perf trace' to become aware of these new syscalls, so that
      one can use them like 'perf trace -e ui_uring*,*signal' to do a system
      wide strace-like session looking at those syscalls, for instance.
      
      For example:
      
        # perf trace -s io_uring-cp ~acme/isos/RHEL-x86_64-dvd1.iso ~/bla
      
         Summary of events:
      
         io_uring-cp (383), 1208866 events, 100.0%
      
           syscall         calls   total    min     avg     max   stddev
                                   (msec) (msec)  (msec)  (msec)     (%)
           -------------- ------ -------- ------ ------- -------  ------
           io_uring_enter 605780 2955.615  0.000   0.005  33.804   1.94%
           openat              4  459.446  0.004 114.861 459.435 100.00%
           munmap              4    0.073  0.009   0.018   0.042  44.03%
           mmap               10    0.054  0.002   0.005   0.026  43.24%
           brk                28    0.038  0.001   0.001   0.003   7.51%
           io_uring_setup      1    0.030  0.030   0.030   0.030   0.00%
           mprotect            4    0.014  0.002   0.004   0.005  14.32%
           close               5    0.012  0.001   0.002   0.004  28.87%
           fstat               3    0.006  0.001   0.002   0.003  35.83%
           read                4    0.004  0.001   0.001   0.002  13.58%
           access              1    0.003  0.003   0.003   0.003   0.00%
           lseek               3    0.002  0.001   0.001   0.001   9.00%
           arch_prctl          2    0.002  0.001   0.001   0.001   0.69%
           execve              1    0.000  0.000   0.000   0.000   0.00%
        #
        # perf trace -e io_uring* -s io_uring-cp ~acme/isos/RHEL-x86_64-dvd1.iso ~/bla
      
         Summary of events:
      
         io_uring-cp (390), 1191250 events, 100.0%
      
           syscall         calls   total    min    avg    max  stddev
                                   (msec) (msec) (msec) (msec)    (%)
           -------------- ------ -------- ------ ------ ------ ------
           io_uring_enter 597093 2706.060  0.001  0.005 14.761  1.10%
           io_uring_setup      1    0.038  0.038  0.038  0.038  0.00%
        #
      
      More work needed to make the tools/perf/examples/bpf/augmented_raw_syscalls.c
      BPF program to copy the 'struct io_uring_params' arguments to perf's ring
      buffer so that 'perf trace' can use the BTF info put in place by pahole's
      conversion of the kernel DWARF and then auto-beautify those arguments.
      
      This patch produces the expected change in the generated syscalls table
      for x86_64:
      
        --- /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c.before	2019-03-26 13:37:46.679057774 -0300
        +++ /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c	2019-03-26 13:38:12.755990383 -0300
        @@ -334,5 +334,9 @@ static const char *syscalltbl_x86_64[] =
         	[332] = "statx",
         	[333] = "io_pgetevents",
         	[334] = "rseq",
        +	[424] = "pidfd_send_signal",
        +	[425] = "io_uring_setup",
        +	[426] = "io_uring_enter",
        +	[427] = "io_uring_register",
         };
        -#define SYSCALLTBL_x86_64_MAX_ID 334
        +#define SYSCALLTBL_x86_64_MAX_ID 427
      
      This silences these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
      Cc: Christian Brauner <christian@brauner.io>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: https://lkml.kernel.org/n/tip-p0ars3otuc52x5iznf21shhw@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8142bd82
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update drm/i915_drm.h · 82392516
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        e46c2e99 ("drm/i915: Expose RPCS (SSEU) configuration to userspace (Gen11 only)")
      
      That don't cause changes in the generated perf binaries.
      
      To silence this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://lkml.kernel.org/n/tip-h6bspm1nomjnpr90333rrx7q@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      82392516
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync asm/cpufeatures.h with the kernel sources · 949af89a
      Arnaldo Carvalho de Melo authored
      To get the changes from:
      
        52f64909 ("x86: Add TSX Force Abort CPUID/MSR")
      
      That don't cause any changes in the generated perf binaries.
      
      And silence this perf build warning:
      
        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
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/n/tip-zv8kw8vnb1zppflncpwfsv2w@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      949af89a
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync linux/fcntl.h to get the F_SEAL_FUTURE_WRITE addition · e33ff03d
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        ab3948f5 ("mm/memfd: add an F_SEAL_FUTURE_WRITE seal to memfd")
      
      And silence this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
        diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-lvfx5cgf0xzmdi9mcjva1ttl@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e33ff03d
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync asm-generic/mman-common.h and linux/mman.h · be709d48
      Arnaldo Carvalho de Melo authored
      To deal with the move of some defines from asm-generic/mmap-common.h to
      linux/mman.h done in:
      
        746c9398 ("arch: move common mmap flags to linux/mman.h")
      
      The generated mmap_flags array stays the same:
      
        $ tools/perf/trace/beauty/mmap_flags.sh
        static const char *mmap_flags[] = {
      	[ilog2(0x40) + 1] = "32BIT",
      	[ilog2(0x01) + 1] = "SHARED",
      	[ilog2(0x02) + 1] = "PRIVATE",
      	[ilog2(0x10) + 1] = "FIXED",
      	[ilog2(0x20) + 1] = "ANONYMOUS",
      	[ilog2(0x100000) + 1] = "FIXED_NOREPLACE",
      	[ilog2(0x0100) + 1] = "GROWSDOWN",
      	[ilog2(0x0800) + 1] = "DENYWRITE",
      	[ilog2(0x1000) + 1] = "EXECUTABLE",
      	[ilog2(0x2000) + 1] = "LOCKED",
      	[ilog2(0x4000) + 1] = "NORESERVE",
      	[ilog2(0x8000) + 1] = "POPULATE",
      	[ilog2(0x10000) + 1] = "NONBLOCK",
      	[ilog2(0x20000) + 1] = "STACK",
      	[ilog2(0x40000) + 1] = "HUGETLB",
      	[ilog2(0x80000) + 1] = "SYNC",
        };
        $
      
      And to have the system's sys/mman.h find the definition of MAP_SHARED
      and MAP_PRIVATE, make sure they are defined in the tools/ mman-common.h
      in a way that keeps it the same as the kernel's, need for keeping the
      Android's NDK cross build working.
      
      This silences these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h'
        diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
        Warning: Kernel ABI header at 'tools/include/uapi/linux/mman.h' differs from latest version at 'include/uapi/linux/mman.h'
        diff -u tools/include/uapi/linux/mman.h include/uapi/linux/mman.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-h80ycpc6pedg9s5z2rwpy6ws@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      be709d48
    • Jiri Olsa's avatar
      perf evsel: Fix max perf_event_attr.precise_ip detection · 4e8a5c15
      Jiri Olsa authored
      After a discussion with Andi, move the perf_event_attr.precise_ip
      detection for maximum precise config (via :P modifier or for default
      cycles event) to perf_evsel__open().
      
      The current detection in perf_event_attr__set_max_precise_ip() is
      tricky, because precise_ip config is specific for given event and it
      currently checks only hw cycles.
      
      We now check for valid precise_ip value right after failing
      sys_perf_event_open() for specific event, before any of the
      perf_event_attr fallback code gets executed.
      
      This way we get the proper config in perf_event_attr together with
      allowed precise_ip settings.
      
      We can see that code activity with -vv, like:
      
        $ perf record -vv ls
        ...
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          ...
          precise_ip                       3
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
          ksymbol                          1
        ------------------------------------------------------------
        sys_perf_event_open: pid 9926  cpu 0  group_fd -1  flags 0x8
        sys_perf_event_open failed, error -95
        decreasing precise_ip by one (2)
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          ...
          precise_ip                       2
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
          ksymbol                          1
        ------------------------------------------------------------
        sys_perf_event_open: pid 9926  cpu 0  group_fd -1  flags 0x8 = 4
        ...
      Suggested-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/n/tip-dkvxxbeg7lu74155d4jhlmc9@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4e8a5c15
    • Adrian Hunter's avatar
      perf intel-pt: Fix TSC slip · f3b4e06b
      Adrian Hunter authored
      A TSC packet can slip past MTC packets so that the timestamp appears to
      go backwards. One estimate is that can be up to about 40 CPU cycles,
      which is certainly less than 0x1000 TSC ticks, but accept slippage an
      order of magnitude more to be on the safe side.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 79b58424 ("perf tools: Add Intel PT support for decoding MTC packets")
      Link: http://lkml.kernel.org/r/20190325135135.18348-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f3b4e06b
    • Solomon Tan's avatar
      perf cs-etm: Add missing case value · c8fa7a80
      Solomon Tan authored
      The following error was thrown when compiling `tools/perf` using OpenCSD
      v0.11.1. This patch fixes said error.
      
          CC       util/intel-pt-decoder/intel-pt-log.o
          CC       util/cs-etm-decoder/cs-etm-decoder.o
        util/cs-etm-decoder/cs-etm-decoder.c: In function
        ‘cs_etm_decoder__buffer_range’:
        util/cs-etm-decoder/cs-etm-decoder.c:370:2: error: enumeration value
        ‘OCSD_INSTR_WFI_WFE’ not handled in switch [-Werror=switch-enum]
          switch (elem->last_i_type) {
          ^~~~~~
          CC       util/intel-pt-decoder/intel-pt-decoder.o
        cc1: all warnings being treated as errors
      
      Because `OCSD_INSTR_WFI_WFE` case was added only in v0.11.0, the minimum
      required OpenCSD library version for this patch is no longer v0.10.0.
      Signed-off-by: default avatarSolomon Tan <solomonbobstoner@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Walker <robert.walker@arm.com>
      Cc: Suzuki K Poulouse <suzuki.poulose@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/20190322052255.GA4809@w-OptiPlex-7050Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c8fa7a80
    • David Howells's avatar
      afs: Fix StoreData op marshalling · 8c7ae38d
      David Howells authored
      The marshalling of AFS.StoreData, AFS.StoreData64 and YFS.StoreData64 calls
      generated by ->setattr() ops for the purpose of expanding a file is
      incorrect due to older documentation incorrectly describing the way the RPC
      'FileLength' parameter is meant to work.
      
      The older documentation says that this is the length the file is meant to
      end up at the end of the operation; however, it was never implemented this
      way in any of the servers, but rather the file is truncated down to this
      before the write operation is effected, and never expanded to it (and,
      indeed, it was renamed to 'TruncPos' in 2014).
      
      Fix this by setting the position parameter to the new file length and doing
      a zero-lengh write there.
      
      The bug causes Xwayland to SIGBUS due to unexpected non-expansion of a file
      it then mmaps.  This can be tested by giving the following test program a
      filename in an AFS directory:
      
      	#include <stdio.h>
      	#include <stdlib.h>
      	#include <unistd.h>
      	#include <fcntl.h>
      	#include <sys/mman.h>
      	int main(int argc, char *argv[])
      	{
      		char *p;
      		int fd;
      		if (argc != 2) {
      			fprintf(stderr,
      				"Format: test-trunc-mmap <file>\n");
      			exit(2);
      		}
      		fd = open(argv[1], O_RDWR | O_CREAT | O_TRUNC);
      		if (fd < 0) {
      			perror(argv[1]);
      			exit(1);
      		}
      		if (ftruncate(fd, 0x140008) == -1) {
      			perror("ftruncate");
      			exit(1);
      		}
      		p = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
      			 MAP_SHARED, fd, 0);
      		if (p == MAP_FAILED) {
      			perror("mmap");
      			exit(1);
      		}
      		p[0] = 'a';
      		if (munmap(p, 4096) < 0) {
      			perror("munmap");
      			exit(1);
      		}
      		if (close(fd) < 0) {
      			perror("close");
      			exit(1);
      		}
      		exit(0);
      	}
      
      Fixes: 31143d5d ("AFS: implement basic file write support")
      Reported-by: default avatarJonathan Billings <jsbillin@umich.edu>
      Tested-by: default avatarJonathan Billings <jsbillin@umich.edu>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8c7ae38d
    • David Howells's avatar
      vfs: Update mount API docs · 7d6ab823
      David Howells authored
      Update the mount API docs to reflect recent changes to the code.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7d6ab823
    • Linus Torvalds's avatar
      Merge tag 's390-5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · bfed6d0f
      Linus Torvalds authored
      Pull s390 fixes from Martin Schwidefsky:
       "Improvements and bug fixes for 5.1-rc2:
      
         - Fix early free of the channel program in vfio
      
         - On AP device removal make sure that all messages are flushed with
           the driver still attached that queued the message
      
         - Limit brk randomization to 32MB to reduce the chance that the heap
           of ld.so is placed after the main stack
      
         - Add a rolling average for the steal time of a CPU, this will be
           needed for KVM to decide when to do busy waiting
      
         - Fix a warning in the CPU-MF code
      
         - Add a notification handler for AP configuration change to react
           faster to new AP devices"
      
      * tag 's390-5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/cpumf: Fix warning from check_processor_id
        zcrypt: handle AP Info notification from CHSC SEI command
        vfio: ccw: only free cp on final interrupt
        s390/vtime: steal time exponential moving average
        s390/zcrypt: revisit ap device remove procedure
        s390: limit brk randomization to 32MB
      bfed6d0f
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 97c41a6b
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "A couple of minor fixes only for now
      
         - fix for incorrect DMA channels on Renesas R-Car
      
         - Broadcom bcm2835 error handling fixes
      
         - Kconfig dependency fixes for bcm2835 and davinci
      
         - CPU idle wakeup fix for i.MX6
      
         - MMC regression on Tegra186
      
         - fix incorrect phy settings on one imx board"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        arm64: tegra: Disable CQE Support for SDMMC4 on Tegra186
        ARM: dts: nomadik: Fix polarity of SPI CS
        ARM: davinci: fix build failure with allnoconfig
        ARM: imx_v4_v5_defconfig: enable PWM driver
        ARM: imx_v6_v7_defconfig: continue compiling the pwm driver
        ARM: dts: imx6dl-yapp4: Use correct pseudo PHY address for the switch
        ARM: dts: imx6qdl: Fix typo in imx6qdl-icore-rqs.dtsi
        ARM: dts: imx6ull: Use the correct style for SPDX License Identifier
        ARM: dts: pfla02: increase phy reset duration
        ARM: imx6q: cpuidle: fix bug that CPU might not wake up at expected time
        ARM: imx51: fix a leaked reference by adding missing of_node_put
        ARM: dts: imx6dl-yapp4: Use rgmii-id phy mode on the cpu port
        arm64: bcm2835: Add missing dependency on MFD_CORE.
        ARM: dts: bcm283x: Fix hdmi hpd gpio pull
        soc: bcm: bcm2835-pm: Fix error paths of initialization.
        soc: bcm: bcm2835-pm: Fix PM_IMAGE_PERI power domain support.
        arm64: dts: renesas: r8a774c0: Fix SCIF5 DMA channels
        arm64: dts: renesas: r8a77990: Fix SCIF5 DMA channels
      97c41a6b
    • Thomas Richter's avatar
      s390/cpumf: Fix warning from check_processor_id · b6ffdf27
      Thomas Richter authored
      Function __hw_perf_event_init() used a CPU variable without
      ensuring CPU preemption has been disabled. This caused the
      following warning in the kernel log:
      
        [ 7.277085] BUG: using smp_processor_id() in preemptible
                       [00000000] code: cf-csdiag/1892
        [ 7.277111] caller is cf_diag_event_init+0x13a/0x338
        [ 7.277122] CPU: 10 PID: 1892 Comm: cf-csdiag Not tainted
                       5.0.0-20190318.rc0.git0.9e1a11e0f602.300.fc29.s390x+debug #1
        [ 7.277131] Hardware name: IBM 2964 NC9 712 (LPAR)
        [ 7.277139] Call Trace:
        [ 7.277150] ([<000000000011385a>] show_stack+0x82/0xd0)
        [ 7.277161]  [<0000000000b7a71a>] dump_stack+0x92/0xd0
        [ 7.277174]  [<00000000007b7e9c>] check_preemption_disabled+0xe4/0x100
        [ 7.277183]  [<00000000001228aa>] cf_diag_event_init+0x13a/0x338
        [ 7.277195]  [<00000000002cf3aa>] perf_try_init_event+0x72/0xf0
        [ 7.277204]  [<00000000002d0bba>] perf_event_alloc+0x6fa/0xce0
        [ 7.277214]  [<00000000002dc4a8>] __s390x_sys_perf_event_open+0x398/0xd50
        [ 7.277224]  [<0000000000b9e8f0>] system_call+0xdc/0x2d8
        [ 7.277233] 2 locks held by cf-csdiag/1892:
        [ 7.277241]  #0: 00000000976f5510 (&sig->cred_guard_mutex){+.+.},
                        at: __s390x_sys_perf_event_open+0xd2e/0xd50
        [ 7.277257]  #1: 00000000363b11bd (&pmus_srcu){....},
                        at: perf_event_alloc+0x52e/0xce0
      
      The variable is now accessed in proper context. Use
      get_cpu_var()/put_cpu_var() pair to disable
      preemption during access.
      As the hardware authorization settings apply to all CPUs, it
      does not matter which CPU is used to check the authorization setting.
      
      Remove the event->count assignment. It is not needed as function
      perf_event_alloc() allocates memory for the event with kzalloc() and
      thus count is already set to zero.
      
      Fixes: fe5908bc ("s390/cpum_cf_diag: Add support for s390 counter facility diagnostic trace")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      b6ffdf27
  4. 27 Mar, 2019 1 commit
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 1a9df9e2
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Fixes here and there, a couple new device IDs, as usual:
      
         1) Fix BQL race in dpaa2-eth driver, from Ioana Ciornei.
      
         2) Fix 64-bit division in iwlwifi, from Arnd Bergmann.
      
         3) Fix documentation for some eBPF helpers, from Quentin Monnet.
      
         4) Some UAPI bpf header sync with tools, also from Quentin Monnet.
      
         5) Set descriptor ownership bit at the right time for jumbo frames in
            stmmac driver, from Aaro Koskinen.
      
         6) Set IFF_UP properly in tun driver, from Eric Dumazet.
      
         7) Fix load/store doubleword instruction generation in powerpc eBPF
            JIT, from Naveen N. Rao.
      
         8) nla_nest_start() return value checks all over, from Kangjie Lu.
      
         9) Fix asoc_id handling in SCTP after the SCTP_*_ASSOC changes this
            merge window. From Marcelo Ricardo Leitner and Xin Long.
      
        10) Fix memory corruption with large MTUs in stmmac, from Aaro
            Koskinen.
      
        11) Do not use ipv4 header for ipv6 flows in TCP and DCCP, from Eric
            Dumazet.
      
        12) Fix topology subscription cancellation in tipc, from Erik Hugne.
      
        13) Memory leak in genetlink error path, from Yue Haibing.
      
        14) Valid control actions properly in packet scheduler, from Davide
            Caratti.
      
        15) Even if we get EEXIST, we still need to rehash if a shrink was
            delayed. From Herbert Xu.
      
        16) Fix interrupt mask handling in interrupt handler of r8169, from
            Heiner Kallweit.
      
        17) Fix leak in ehea driver, from Wen Yang"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (168 commits)
        dpaa2-eth: fix race condition with bql frame accounting
        chelsio: use BUG() instead of BUG_ON(1)
        net: devlink: skip info_get op call if it is not defined in dumpit
        net: phy: bcm54xx: Encode link speed and activity into LEDs
        tipc: change to check tipc_own_id to return in tipc_net_stop
        net: usb: aqc111: Extend HWID table by QNAP device
        net: sched: Kconfig: update reference link for PIE
        net: dsa: qca8k: extend slave-bus implementations
        net: dsa: qca8k: remove leftover phy accessors
        dt-bindings: net: dsa: qca8k: support internal mdio-bus
        dt-bindings: net: dsa: qca8k: fix example
        net: phy: don't clear BMCR in genphy_soft_reset
        bpf, libbpf: clarify bump in libbpf version info
        bpf, libbpf: fix version info and add it to shared object
        rxrpc: avoid clang -Wuninitialized warning
        tipc: tipc clang warning
        net: sched: fix cleanup NULL pointer exception in act_mirr
        r8169: fix cable re-plugging issue
        net: ethernet: ti: fix possible object reference leak
        net: ibm: fix possible object reference leak
        ...
      1a9df9e2
  5. 26 Mar, 2019 14 commits