1. 25 Jun, 2018 18 commits
    • Ravi Bangoria's avatar
      perf script: Fix crash because of missing evsel->priv · a3af66f5
      Ravi Bangoria authored
      'perf script' in piped mode is crashing because evsel->priv is not set
      properly. Fix it.
      
      Before:
      
        # perf record -o - -- ls | perf script
        <SNIP 'ls' output>
          Segmentation fault (core dumped)
        #
      
      After:
      
        # perf record -o - -- ls | perf script
        <SNIP 'ls' output>
        ls 2282 1031.731974:  250000 cpu-clock:uhH:  7effe4b3d29e
        ls 2282 1031.732222:  250000 cpu-clock:uhH:  7effe4b3a650
        #
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: a14390fd ("perf script: Allow creating per-event dump files")
      Link: http://lkml.kernel.org/r/20180625124220.6434-3-ravi.bangoria@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a3af66f5
    • Ravi Bangoria's avatar
      perf script: Add missing output fields in a hint · 10e9cec9
      Ravi Bangoria authored
      A few fields are missing in a perf script -F hint. Add them.
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20180625124220.6434-2-ravi.bangoria@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      10e9cec9
    • Jiri Olsa's avatar
      perf bench: Fix numa report output code · 98310707
      Jiri Olsa authored
      Currently we can hit following assert when running numa bench:
      
        $ perf bench numa mem -p 3 -t 1 -P 512 -s 100 -zZ0cm --thp 1
        perf: bench/numa.c:1577: __bench_numa: Assertion `!(!(((wait_stat) & 0x7f) == 0))' failed.
      
      The assertion is correct, because we hit the SIGFPE in following line:
      
        Thread 2.2 "thread 0/0" received signal SIGFPE, Arithmetic exception.
        [Switching to Thread 0x7fffd28c6700 (LWP 11750)]
        0x000.. in worker_thread (__tdata=0x7.. ) at bench/numa.c:1257
        1257 td->speed_gbs = bytes_done / (td->runtime_ns / NSEC_PER_SEC) / 1e9;
      
      We don't check if the runtime is actually bigger than 1 second,
      and thus this might end up with zero division within FPU.
      
      Adding the check to prevent this.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180620094036.17278-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      98310707
    • Thomas Richter's avatar
      perf stat: Remove duplicate event counting · 6dde6429
      Thomas Richter authored
      'perf stat' shows a mismatch in perf stat regarding counter names on
      s390:
      
      Run command:
      
         [root@s35lp76 perf]# ./perf stat -e tx_nc_tend  -v --
                      ~/mytesttx 1 >/tmp/111
         tx_nc_tend: 1 573146 573146
         tx_nc_tend: 1 573146 573146
      
         Performance counter stats for '/root/mytesttx 1':
      
                       3      tx_nc_tend
      
             0.001037252 seconds time elapsed
      
         [root@s35lp76 perf]#
      
      shows transaction counter tx_nc_tend with value 3 but it was triggered
      only once as seen by the output of mytesttx.
      
      When looking up the event name tx_nc_tend the following function
      sequence is called:
      
      parse_events_multi_pmu_add()
      +--> perf_pmu__scan() being called with NULL argument
           +--> pmu_read_sysfs() scans directory ../devices/ for
                                 all PMUs
                +--> perf_pmu__find() tries to find a PMU in the
                                 global pmu list.
                     +--> pmu_lookup() called to read all file
                                       entries when not in global
                                       list.
      
      pmu_lookup() causes the issue. It calls
      +---> pmu_aliases() to read all the entries in the PMU directory.
                          On s390 this is named
                          /sys/devices/cpum_cf/events.
            +--> pmu_aliases_parse() reads all files and creates an
                             alias for each file name.
      
                             So we end up with first entry created by
                             reading the sysfs file
                             [root@s35lp76 perf]# cat /sys/devices/cpum_cf
                                                      /events/TX_NC_TEND
                             event=0x008d
                             [root@s35lp76 perf]#
      
                             Debug output shows this entry
                             tx_nc_tend -> 'cpum_cf'/'event=0x008d
                             '/
                             After all files in this directory have been
                             read and aliases created this function is called:
            +--> pmu_add_cpu_aliases()
                             This function looks up the CPU tables
                             created by the json files.
                             With json files for s390 now available all
                             the aliases are added to
                             the PMU alias list a second time.
                             The second entry is added by
                             reading the json file converted by jevent
                             resulting in file pmu-events/pmu-events.c:
      
                             {
                               .name = "tx_nc_tend",
                               .event = "event=0x8d",
                               .desc = "Unit: cpum_cf Completed TEND \
                                        instructions \
                                        in non-constrained TX mode",
                               .topic = "extended",
                               .long_desc = "A TEND instruction has \
                                             completed  in a \
                                             non-constrained \
                                             transactional-execution mode",
                               .pmu = "cpum_cf",
                              },
      
                              Debug output shows this entry
                              tx_nc_tend -> 'cpum_cf'/'event=0x8d'/
      
      Function pmu_aliases_parse() and pmu_add_cpu_aliases() both use
      __perf_pmu__new_alias() to add an alias to the PMU alias list. There is
      no check if an alias already exist
      
      So we end up with 2 entries for tx_nc_tend in the PMU alias list.
      
      Having set up the PMU alias list for this PMU now
      parse_events_multi_add_pmu() reads the complete alias list and adds each
      alias with parse_events_add_pmu() to the global perfev_list.  This
      causes the alias to be added multiple times to the event list.
      
      Fix this by making __perf_pmu__new_alias() to merge alias definitions if
      an alias is already on the alias list.  Also print a debug message when
      the alias has mismatches in some fields.
      
      Output before:
      
        [root@s35lp76 perf]# ./perf stat -e tx_nc_tend  -v \
                              -- ~/mytesttx 1 >/tmp/111
        tx_nc_tend: 1 551446 551446
      
         Performance counter stats for '/root/mytesttx 1':
      
                         3      tx_nc_tend
      
               0.000961134 seconds time elapsed
      
        [root@s35lp76 perf]#
      
      Output after:
      
        [root@s35lp76 perf]#  ./perf stat -e tx_nc_tend  -v \
                              -- ~/mytesttx 1 >/tmp/111
        tx_nc_tend: 1 551446 551446
      
         Performance counter stats for '/root/mytesttx 1':
      
                         1      tx_nc_tend
      
               0.000961134 seconds time elapsed
      
        [root@s35lp76 perf]#
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180615101105.47047-3-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6dde6429
    • Thomas Richter's avatar
      perf alias: Rebuild alias expression string to make it comparable · 0c24d6fb
      Thomas Richter authored
      PMU alias definitions in sysfs files may have spaces, newlines and
      numbers with leading zeroes. Some alias definitions may also appear in
      JSON files without spaces, etc.
      
      Scan alias definitions and remove leading zeroes, spaces, newlines, etc
      and rebuild string to make alias->str member comparable.
      
      s390 for example  has terms specified as event=0x0091 (read from files
      ../<PMU>/events/<FILE> and terms specified as event=0x91 (read from JSON
      files).
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180615101105.47047-2-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0c24d6fb
    • Thomas Richter's avatar
      perf alias: Remove trailing newline when reading sysfs files · ea23ac73
      Thomas Richter authored
      Remove a trailing newline when reading sysfs file contents such as
      /sys/devices/cpum_cf/events/TX_NC_TEND.  This shows when verbose option
      -v is used.
      
      Output before:
      
        tx_nc_tend -> 'cpum_cf'/'event=0x008d
        '/
      
      Output after:
      
        tx_nc_tend -> 'cpum_cf'/'event=0x8d'/
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180615101105.47047-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ea23ac73
    • Yonghong Song's avatar
      perf tools: Fix a clang 7.0 compilation error · c6555c14
      Yonghong Song authored
      Arnaldo reported the perf build failure with latest llvm/clang compiler
      (7.0).
      
         $ make LIBCLANGLLVM=1 -C tools/perf/
         <SNIP>
          CC       /tmp/tmp.t53Qo38zci/tests/kmod-path.o
         util/c++/clang.cpp: In function ‘std::unique_ptr<llvm::SmallVectorImpl<char> >
             perf::getBPFObjectFromModule(llvm::Module*)’:
         util/c++/clang.cpp:150:43: error: no matching function for call to
             ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&,
              llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’
                     TargetMachine::CGFT_ObjectFile)) {
                                                   ^
         In file included from util/c++/clang.cpp:25:0:
         /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate:
             virtual bool llvm::TargetMachine::addPassesToEmitFile(
             llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&,
             llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool,
             llvm::MachineModuleInfo*)
           virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &,
                        ^~~~~~~~~~~~~~~~~~~
        /usr/local/include/llvm/Target/TargetMachine.h:254:16: note:
            candidate expects 6 arguments, 3 provided
        mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory
        make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101:
            /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1
        make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2
        make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2
        make[5]: *** Waiting for unfinished jobs....
          CC       /tmp/tmp.t53Qo38zci/tests/thread-map.o
      
      The function addPassesToEmitFile signature changed in llvm 7.0 and such
      a change caused the failure. This patch fixed the issue with using
      proper function signatures under different compiler versions.
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20180616174739.1076733-1-yhs@fb.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c6555c14
    • Arnaldo Carvalho de Melo's avatar
      tools include uapi: Synchronize bpf.h with the kernel · f568b472
      Arnaldo Carvalho de Melo authored
      To pick the rename in:
      
        bd3a08aa ("bpf: flowlabel in bpf_fib_lookup should be flowinfo")
      
      Silencing this build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-zd1sgtbybtjrrt7bqdybu0s0@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f568b472
    • Arnaldo Carvalho de Melo's avatar
      tools include uapi: Update if_link.h to pick IFLA_{BRPORT_ISOLATED,VXLAN_TTL_INHERIT} · bb9a33cb
      Arnaldo Carvalho de Melo authored
      The IFLA_BRPORT_ISOLATED and IFLA_VXLAN_TTL_INHERIT defines were added in:
      
        7d850abd ("net: bridge: add support for port isolation")
        72f6d71e ("vxlan: add ttl inherit support")
      
      Pick them, silencing this build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'
      
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Eric Leblond <eric@regit.org>
      Cc: Hangbin Liu <liuhangbin@gmail.com>
      Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Link: https://lkml.kernel.org/n/tip-ezi5u0mmdqm0wfm0y2y8176r@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bb9a33cb
    • Arnaldo Carvalho de Melo's avatar
      tools include powerpc: Update arch/powerpc/include/uapi/asm/unistd.h copy to get 'rseq' syscall · 801f5e1a
      Arnaldo Carvalho de Melo authored
      This updates the tools/perf/ copy of the powerpc file used to generate
      the syscall table file used to make 'perf trace' become aware of the new
      'rseq' syscall, no matter in which system it gets built, i.e. older
      systems where the syscalls are not available in the running kernel (via
      tracefs) or in the system headers will still be aware of these
      syscalls/.
      
      From this commit:
      
        bb862b02 ("powerpc: Wire up restartable sequences system call")
      
      Silencing this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at 'arch/powerpc/include/uapi/asm/unistd.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-adtgz6u3apd76tghiu9w0k19@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      801f5e1a
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Update x86's syscall_64.tbl, adding 'io_pgetevents' and 'rseq' · b1494ec0
      Arnaldo Carvalho de Melo authored
      This updates the tools/perf/ copy of the system call table for x86 which makes
      'perf trace' become aware of the new 'io_pgetevents' and 'rseq' syscalls, no
      matter in which system it gets built, i.e. older systems where the syscalls are
      not available in the running kernel (via tracefs) or in the system headers will
      still be aware of these syscalls/.
      
      These are the csets introducing the source drift:
      
        05c17ced ("x86: Wire up restartable sequence system call")
        7a074e96 ("aio: implement io_pgetevents")
      
      This results in this build time change:
      
        $ diff -u /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c.old /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c
        --- /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c.old	2018-06-15 11:48:17.648948094 -0300
        +++ /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c	2018-06-15 11:48:22.133942480 -0300
        @@ -332,5 +332,7 @@
                [330] = "pkey_alloc",
                [331] = "pkey_free",
                [332] = "statx",
        +       [333] = "io_pgetevents",
        +       [334] = "rseq",
         };
        -#define SYSCALLTBL_x86_64_MAX_ID 332
        +#define SYSCALLTBL_x86_64_MAX_ID 334
        $
      
      This silences the following tools/perf/ build warning:
      
        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'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-tfvyz51sabuzemrszbrhzxni@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b1494ec0
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Synchronize drm/drm.h · 7b818dc5
      Arnaldo Carvalho de Melo authored
      To pick up the new ioctls added in these csets:
      
        7595bda2 ("drm: Add DRM client cap for aspect-ratio")
      
      The DRM caps are not yet being decoded in 'perf trace', so this sync
      doesn't incur in any change in behaviour in any tools, just silencing
      this tools/perf/ build warning:
      
      	Warning: Kernel ABI header at 'tools/include/uapi/drm/drm.h' differs from latest version at 'include/uapi/drm/drm.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-atwz0arwanq1npu8pptwkoxt@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7b818dc5
    • Adrian Hunter's avatar
      perf intel-pt: Fix packet decoding of CYC packets · 621a5a32
      Adrian Hunter authored
      Use a 64-bit type so that the cycle count is not limited to 32-bits.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1528371002-8862-1-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      621a5a32
    • Jiri Olsa's avatar
      perf tests: Add valid callback for parse-events test · 16ddcfbf
      Jiri Olsa authored
      Adding optional 'valid' callback for events tests in parse-events
      object, so we don't try to parse PMUs, which are not supported.
      
      Following line is displayed for skipped test:
      
        running test 52 'intel_pt//u'... SKIP
      
      Committer note:
      
      Use named initializers in the struct evlist_test variable to avoid
      breaking the build on centos:5, 6 and others with a similar gcc:
      
        cc1: warnings being treated as errors
        tests/parse-events.c: In function 'test_pmu_events':
        tests/parse-events.c:1817: error: missing initializer
        tests/parse-events.c:1817: error: (near initialization for 'e.type')
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20180611093422.1005-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      16ddcfbf
    • Jiri Olsa's avatar
      perf tests: Add event parsing error handling to parse events test · 933ccf20
      Jiri Olsa authored
      Add missing error handling for parse_events calls in test_event function
      that led to following segfault on s390:
      
        running test 52 'intel_pt//u'
        perf: Segmentation fault
        ...
        /lib64/libc.so.6(vasprintf+0xe6) [0x3fffca3f106]
        /lib64/libc.so.6(asprintf+0x46) [0x3fffca1aa96]
        ./perf(parse_events_add_pmu+0xb8) [0x80132088]
        ./perf(parse_events_parse+0xc62) [0x8019529a]
        ./perf(parse_events+0x98) [0x801341c0]
        ./perf(test__parse_events+0x48) [0x800cd140]
        ./perf(cmd_test+0x26a) [0x800bd44a]
        test child interrupted
      
      Adding the struct parse_events_error argument to parse_events call. Also
      adding parse_events_print_error to get more details on the parsing
      failures, like:
      
        # perf test 6 -v
        running test 52 'intel_pt//u'failed to parse event 'intel_pt//u', err 1, str 'Cannot find PMU `intel_pt'. Missing kernel support?'
        event syntax error: 'intel_pt//u'
                             \___ Cannot find PMU `intel_pt'. Missing kernel support?
      
      Committer note:
      
      Use named initializers in the struct parse_events_error variable to
      avoid breaking the build on centos5, 6 and others with a similar gcc:
      
        cc1: warnings being treated as errors
        tests/parse-events.c: In function 'test_event':
        tests/parse-events.c:1696: error: missing initializer
        tests/parse-events.c:1696: error: (near initialization for 'err.str')
      Reported-by: default avatarKim Phillips <kim.phillips@arm.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20180611093422.1005-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      933ccf20
    • Sandipan Das's avatar
      perf report powerpc: Fix crash if callchain is empty · 143c99f6
      Sandipan Das authored
      For some cases, the callchain provided by the kernel may be empty. So,
      the callchain ip filtering code will cause a crash if we do not check
      whether the struct ip_callchain pointer is NULL before accessing any
      members.
      
      This can be observed on a powerpc64le system running Fedora 27 as shown
      below.
      
        # perf record -b -e cycles:u ls
      
      Before:
      
        # perf report --branch-history
      
        perf: Segmentation fault
        -------- backtrace --------
        perf[0x1027615c]
        linux-vdso64.so.1(__kernel_sigtramp_rt64+0x0)[0x7fff856304d8]
        perf(arch_skip_callchain_idx+0x44)[0x10257c58]
        perf[0x1017f2e4]
        perf(thread__resolve_callchain+0x124)[0x1017ff5c]
        perf(sample__resolve_callchain+0xf0)[0x10172788]
        ...
      
      After:
      
        # perf report --branch-history
      
        Samples: 25  of event 'cycles:u', Event count (approx.): 2306870
          Overhead  Source:Line            Symbol                   Shared Object
        +   11.60%  _init+35736            [.] _init                ls
        +    9.84%  strcoll_l.c:137        [.] __strcoll_l          libc-2.26.so
        +    9.16%  memcpy.S:175           [.] __memcpy_power7      libc-2.26.so
        +    9.01%  gconv_charset.h:54     [.] _nl_find_locale      libc-2.26.so
        +    8.87%  dl-addr.c:52           [.] _dl_addr             libc-2.26.so
        +    8.83%  _init+236              [.] _init                ls
        ...
      Reported-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Signed-off-by: default avatarSandipan Das <sandipan@linux.ibm.com>
      Acked-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20180611104049.11048-1-sandipan@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      143c99f6
    • Thomas Richter's avatar
      perf test session topology: Fix test on s390 · b930e62e
      Thomas Richter authored
      On s390 this test case fails because the socket identifiction numbers
      assigned to the CPU are higher than the CPU identification numbers.
      
      F/ix this by adding the platform architecture into the perf data header
      flag information. This helps identifiing the test platform and handles
      s390 specifics in process_cpu_topology().
      
      Before:
      
        [root@p23lp27 perf]# perf test -vvvvv -F 39
        39: Session topology                                      :
        --- start ---
        templ file: /tmp/perf-test-iUv755
        socket_id number is too big.You may need to upgrade the perf tool.
        ---- end ----
        Session topology: Skip
        [root@p23lp27 perf]#
      
      After:
      
        [root@p23lp27 perf]# perf test -vvvvv -F 39
        39: Session topology                                      :
        --- start ---
        templ file: /tmp/perf-test-8X8VTs
        CPU 0, core 0, socket 6
        CPU 1, core 1, socket 3
        ---- end ----
        Session topology: Ok
        [root@p23lp27 perf]#
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Fixes: c84974ed ("perf test: Add entry to test cpu topology")
      Link: http://lkml.kernel.org/r/20180611073153.15592-2-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b930e62e
    • Thomas Richter's avatar
      perf record: Support s390 random socket_id assignment · 01766229
      Thomas Richter authored
      On s390 the socket identifier assigned to a CPU identifier is random and
      (depending on the configuration of the LPAR) may be higher than the CPU
      identifier. This is currently not supported.
      
      Fix this by allowing arbitrary socket identifiers being assigned to
      CPU id.
      
      Output before:
      
        [root@p23lp27 perf]# ./perf report --header -I -v
        ...
        socket_id number is too big.You may need to upgrade the perf tool.
        Error:
        The perf.data file has no samples!
        # ========
        # captured on    : Tue May 29 09:29:57 2018
        # header version : 1
        ...
        # Core ID and Socket ID information is not available
        ...
        [root@p23lp27 perf]#
      
      Output after:
      
        [root@p23lp27 perf]# ./perf report --header -I -v
        ...
        Error:
        The perf.data file has no samples!
        # ========
        # captured on    : Tue May 29 09:29:57 2018
        # header version : 1
        ...
        # CPU 0: Core ID 0, Socket ID 6
        # CPU 1: Core ID 1, Socket ID 3
        # CPU 2: Core ID -1, Socket ID -1
        ...
        [root@p23lp27 perf]#
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180611073153.15592-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      01766229
  2. 22 Jun, 2018 1 commit
  3. 21 Jun, 2018 1 commit
  4. 14 Jun, 2018 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo-4.18-20180611' of... · a89d0c2a
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo-4.18-20180611' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes and improvements from Arnaldo Carvalho de Melo:
      
      perf stat:
      
      - Fix metric column header display alignment (Jiri Olsa)
      
      - Improve error messages for default attributes, providing better output
        for error in command lines such as:
      
        $ perf stat -T
        Cannot set up transaction events
        event syntax error: '..cycles,cpu/cycles-t/,cpu/tx-start/,cpu/el-start/,cpu/cycles-ct/}'
                                          \___ unknown term
      
        Where the "event syntax error" line now appears (Jiri Olsa)
      
      - Add --interval-clear option, to provide a 'watch' like printing (Jiri Olsa)
      
      perf script:
      
      - Show hw-cache events too (Seeteena Thoufeek)
      
      perf c2c:
      
      - Fix data dependency problem in layout of 'struct c2c_hist_entry', where
        its member 'struct hist_entry' must be at the end because it has a ZLA
        as its last member, that gets space when handling callchains (Jiri Olsa)
      
      Core:
      
      - We cannot assume that a 'struct perf_evsel'  is to be obtained from a
        container_of operation on a 'struct hists' as there are tools, such as
        'perf c2c' that uses 'struct hist' instances without having them in
        container structs that also have 'struct perf_evsel' in a particular
        layout, so provide a different way of figuring out if a 'struct hists'
        and 'struct hist_entry' have callchains (Arnaldo Carvalho de Melo)
      
      - Fix error index in the PMU event parser, so that error messages can
        point to the problematic token (Jiri Olsa)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a89d0c2a
  5. 10 Jun, 2018 8 commits
    • Linus Torvalds's avatar
      Merge branch 'core-rseq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d82991a8
      Linus Torvalds authored
      Pull restartable sequence support from Thomas Gleixner:
       "The restartable sequences syscall (finally):
      
        After a lot of back and forth discussion and massive delays caused by
        the speculative distraction of maintainers, the core set of
        restartable sequences has finally reached a consensus.
      
        It comes with the basic non disputed core implementation along with
        support for arm, powerpc and x86 and a full set of selftests
      
        It was exposed to linux-next earlier this week, so it does not fully
        comply with the merge window requirements, but there is really no
        point to drag it out for yet another cycle"
      
      * 'core-rseq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rseq/selftests: Provide Makefile, scripts, gitignore
        rseq/selftests: Provide parametrized tests
        rseq/selftests: Provide basic percpu ops test
        rseq/selftests: Provide basic test
        rseq/selftests: Provide rseq library
        selftests/lib.mk: Introduce OVERRIDE_TARGETS
        powerpc: Wire up restartable sequences system call
        powerpc: Add syscall detection for restartable sequences
        powerpc: Add support for restartable sequences
        x86: Wire up restartable sequence system call
        x86: Add support for restartable sequences
        arm: Wire up restartable sequences system call
        arm: Add syscall detection for restartable sequences
        arm: Add restartable sequences support
        rseq: Introduce restartable sequences system call
        uapi/headers: Provide types_32_64.h
      d82991a8
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f4e5b30d
      Linus Torvalds authored
      Pull x86 updates and fixes from Thomas Gleixner:
      
       - Fix the (late) fallout from the vector management rework causing
         hlist corruption and irq descriptor reference leaks caused by a
         missing sanity check.
      
         The straight forward fix triggered another long standing issue to
         surface. The pre rework code hid the issue due to being way slower,
         but now the chance that user space sees an EBUSY error return when
         updating irq affinities is way higher, though quite a bunch of
         userspace tools do not handle it properly despite the fact that EBUSY
         could be returned for at least 10 years.
      
         It turned out that the EBUSY return can be avoided completely by
         utilizing the existing delayed affinity update mechanism for irq
         remapped scenarios as well. That's a bit more error handling in the
         kernel, but avoids fruitless fingerpointing discussions with tool
         developers.
      
       - Decouple PHYSICAL_MASK from AMD SME as its going to be required for
         the upcoming Intel memory encryption support as well.
      
       - Handle legacy device ACPI detection properly for newer platforms
      
       - Fix the wrong argument ordering in the vector allocation tracepoint
      
       - Simplify the IDT setup code for the APIC=n case
      
       - Use the proper string helpers in the MTRR code
      
       - Remove a stale unused VDSO source file
      
       - Convert the microcode update lock to a raw spinlock as its used in
         atomic context.
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/intel_rdt: Enable CMT and MBM on new Skylake stepping
        x86/apic/vector: Print APIC control bits in debugfs
        genirq/affinity: Defer affinity setting if irq chip is busy
        x86/platform/uv: Use apic_ack_irq()
        x86/ioapic: Use apic_ack_irq()
        irq_remapping: Use apic_ack_irq()
        x86/apic: Provide apic_ack_irq()
        genirq/migration: Avoid out of line call if pending is not set
        genirq/generic_pending: Do not lose pending affinity update
        x86/apic/vector: Prevent hlist corruption and leaks
        x86/vector: Fix the args of vector_alloc tracepoint
        x86/idt: Simplify the idt_setup_apic_and_irq_gates()
        x86/platform/uv: Remove extra parentheses
        x86/mm: Decouple dynamic __PHYSICAL_MASK from AMD SME
        x86: Mark native_set_p4d() as __always_inline
        x86/microcode: Make the late update update_lock a raw lock for RT
        x86/mtrr: Convert to use strncpy_from_user() helper
        x86/mtrr: Convert to use match_string() helper
        x86/vdso: Remove unused file
        x86/i8237: Register device based on FADT legacy boot flag
      f4e5b30d
    • Linus Torvalds's avatar
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a2211de0
      Linus Torvalds authored
      Pull x86 pti updates from Thomas Gleixner:
       "Three small commits updating the SSB mitigation to take the updated
        AMD mitigation variants into account"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features
        x86/bugs: Add AMD's SPEC_CTRL MSR usage
        x86/bugs: Add AMD's variant of SSB_NO
      a2211de0
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2322d6c5
      Linus Torvalds authored
      Pull more perf tooling updates from Thomas Gleixner:
       "Perf tool updates and fixes:
      
        perf stat:
      
         - Display user and system time for workload targets (Jiri Olsa)
      
        perf record:
      
         - Enable arbitrary event names thru name= modifier (Alexey Budankov)
      
        PowerPC:
      
         - Add a python script for hypervisor call statistics (Ravi Bangoria)
      
        Intel PT: (Adrian Hunter)
      
         - Fix sync_switch INTEL_PT_SS_NOT_TRACING
      
         - Fix decoding to accept CBR between FUP and corresponding TIP
      
         - Fix MTC timing after overflow
      
         - Fix "Unexpected indirect branch" error
      
        perf test:
      
         - record+probe_libc_inet_pton:
            - To get the symbol table for dynamic shared objects on ubuntu we
              need to pass the -D/--dynamic command line option, unlike with
              the fedora distros (Arnaldo Carvalho de Melo)
      
         - code-reading:
            - Fix perf_env setup for PTI entry trampolines (Adrian Hunter)
      
         - kmod-path:
            - Add tests for vdso32 and vdsox32 (Adrian Hunter)
      
         - Use header file util/debug.h (Thomas Richter)
      
        perf annotate:
      
         - Make the various UI backends (stdio, TUI, gtk) use more
           consistently structs with annotation options as specified by the
           user (Arnaldo Carvalho de Melo)
      
         - Move annotation specific knobs from the symbol_conf global kitchen
           sink to the annotation option structs (Arnaldo Carvalho de Melo)
      
        perf script:
      
         - Add more PMU fields to python scripts event handler dict (Jin Yao)
      
        Core:
      
         - Fix misleading error for some unparsable events mentioning PMUs
           when those are not involved in the problem (Jiri Olsa)
      
         - Consider BSS symbols when processing /proc/kallsyms ('B' and 'b')
           (Arnaldo Carvalho de Melo)
      
         - Be more robust when trying to use per-symbol histograms, checking
           for unlikely but possible cases where the space for the histograms
           wasn't allocated, print a debug message for such cases (Arnaldo
           Carvalho de Melo)
      
         - Fix symbol and object code resolution for vdso32 and vdsox32
           (Adrian Hunter)
      
         - No need to check for null when passing pointers to foo__get() style
           refcount grabbing helpers, just like in the kernel and with free(),
           its safe to pass a NULL pointer to avoid having to check it before
           each and every foo__get() call (Arnaldo Carvalho de Melo)
      
         - Remove some dead code (quote.[ch]) (Arnaldo Carvalho de Melo)
      
         - Remove some needless globals, making them local (Arnaldo Carvalho
           de Melo)
      
         - Reduce usage of symbol_conf.use_callchain, using other means of
           finding out if callchains are in use or available for specific
           events, as we evolved this codebase to allow requesting callchains
           for just a subset of the monitored events. In time it will help
           polish recording and showing mixed sets accross the various tools:
      
              perf record -e cycles/call-graph=fp/,cache-misses/call-graph=dwarf/,instructions'
      
           (Arnaldo Carvalho de Melo)
      
         - Consider PTI entry trampolines in map__rip_2objdump() (Adrian
           Hunter)"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (50 commits)
        perf script python: Add dict fields introduction to Documentation
        perf script python: Add more PMU fields to event handler dict
        perf script python: Move dsoname code to a new function
        perf symbols: Add BSS symbols when reading from /proc/kallsyms
        perf annnotate: Make __symbol__inc_addr_samples handle src->histograms == NULL
        perf intel-pt: Fix "Unexpected indirect branch" error
        perf intel-pt: Fix MTC timing after overflow
        perf intel-pt: Fix decoding to accept CBR between FUP and corresponding TIP
        perf intel-pt: Fix sync_switch INTEL_PT_SS_NOT_TRACING
        perf script powerpc: Python script for hypervisor call statistics
        perf test record+probe_libc_inet_pton: Ask 'nm' for dynamic symbols
        perf map: Consider PTI entry trampolines in rip_2objdump()
        perf test code-reading: Fix perf_env setup for PTI entry trampolines
        perf tools: Fix pmu events parsing rule
        perf stat: Display user and system time
        perf record: Enable arbitrary event names thru name= modifier
        perf tools: Fix symbol and object code resolution for vdso32 and vdsox32
        perf tests kmod-path: Add tests for vdso32 and vdsox32
        perf hists: Check if a hist_entry has callchains before using them
        perf hists: Introduce hist_entry__has_callchain() method
        ...
      2322d6c5
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9f3fbe85
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "Two small fixlets:
      
         - Add the missing iomu mapping call in the Freescale/NXP/Qualcomm/
           whoever owns it now/ SCFG MSI irqchip driver. Otherwise IRQs wont
           work at all.
      
         - Fix a SMP=n build warning in the STM32 irq chip driver"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/ls-scfg-msi: Map MSIs in the iommu
        irqchip/stm32: Fix non-SMP build warning
      9f3fbe85
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a8a4021b
      Linus Torvalds authored
      Pull core fixes from Thomas Gleixner:
       "A small set of core updates:
      
         - Make objtool cope with GCC8 oddities some more
      
         - Remove a stale local_irq_save/restore sequence in the signal code
           along with the stale comment in the RCU code. The underlying issue
           which led to this has been solved long time ago, but nobody cared
           to cleanup the hackarounds"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        signal: Remove no longer required irqsave/restore
        rcu: Update documentation of rcu_read_unlock()
        objtool: Fix GCC 8 cold subfunction detection for aliased functions
      a8a4021b
    • Anna-Maria Gleixner's avatar
      signal: Remove no longer required irqsave/restore · 59dc6f3c
      Anna-Maria Gleixner authored
      Commit a841796f ("signal: align __lock_task_sighand() irq disabling and
      RCU") introduced a rcu read side critical section with interrupts
      disabled. The changelog suggested that a better long-term fix would be "to
      make rt_mutex_unlock() disable irqs when acquiring the rt_mutex structure's
      ->wait_lock".
      
      This long-term fix has been made in commit b4abf910 ("rtmutex: Make
      wait_lock irq safe") for a different reason.
      
      Therefore revert commit a841796f ("signal: align >
      __lock_task_sighand() irq disabling and RCU") as the interrupt disable
      dance is not longer required.
      
      The change was tested on the base of b4abf910 ("rtmutex: Make wait_lock
      irq safe") with a four hour run of rcutorture scenario TREE03 with lockdep
      enabled as suggested by Paul McKenney.
      Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: bigeasy@linutronix.de
      Link: https://lkml.kernel.org/r/20180525090507.22248-3-anna-maria@linutronix.de
      59dc6f3c
    • Anna-Maria Gleixner's avatar
      rcu: Update documentation of rcu_read_unlock() · ec84b27f
      Anna-Maria Gleixner authored
      Since commit b4abf910 ("rtmutex: Make wait_lock irq safe") the
      explanation in rcu_read_unlock() documentation about irq unsafe rtmutex
      wait_lock is no longer valid.
      
      Remove it to prevent kernel developers reading the documentation to rely on
      it.
      Suggested-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: bigeasy@linutronix.de
      Link: https://lkml.kernel.org/r/20180525090507.22248-2-anna-maria@linutronix.de
      ec84b27f
  6. 09 Jun, 2018 11 commits
    • Linus Torvalds's avatar
      Merge branch 'proc-cmdline' · 3ca24ce9
      Linus Torvalds authored
      Merge proc_cmdline simplifications.
      
      This re-writes the get_mm_cmdline() logic to be rather simpler than it
      used to be, and makes the semantics for "cmdline goes past the end of
      the original area" more natural.
      
      You _can_ use prctl(PR_SET_MM) to just point your command line somewhere
      else entirely, but the traditional model is to just edit things in place
      and that still needs to continue to work.  At least this way the code
      makes some sense.
      
      * proc-cmdline:
        fs/proc: simplify and clarify get_mm_cmdline() function
        fs/proc: re-factor proc_pid_cmdline_read() a bit
      3ca24ce9
    • Mikulas Patocka's avatar
      hpfs: Use EUCLEAN for filesystem errors · f72328d2
      Mikulas Patocka authored
      Use the error code EUCLEAN for filesystem errors because other
      filesystems use this code too.
      
      [ And remove unused EMEMERROR  - Linus ]
      Signed-off-by: default avatarMikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f72328d2
    • Linus Torvalds's avatar
      Merge tag 'for-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply · a16afaf7
      Linus Torvalds authored
      Pull power supply and reset updates from Sebastian Reichel:
       - bq27xxx: Add BQ27426 support
       - ab8500: Drop AB8540/9540 support
       - Introduced new usb_type property
       - Properly document the power-supply ABI
       - misc. cleanups and fixes
      
      * tag 'for-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
        MAINTAINERS: add entry for LEGO MINDSTORMS EV3
        power: supply: ab8500_charger: fix spelling mistake: "faile" -> "failed"
        power: supply: axp288_fuel_gauge: Remove polling from the driver
        power: supply: axp288_fuelguage: Do not bind when the fg function is not used
        power: supply: axp288_charger: Do not bind when the charge function is not used
        power: supply: axp288_charger: Support 3500 and 4000 mA input current limit
        power: supply: s3c-adc-battery: fix driver data initialization
        power: supply: charger-manager: Verify polling interval only when polling requested
        power: supply: sysfs: Use enum to specify property
        power: supply: ab8500: Drop AB8540/9540 support
        power: supply: ab8500_fg: fix spelling mistake: "Disharge" -> "Discharge"
        power: supply: simplify getting .drvdata
        power: supply: bq27xxx: Add support for BQ27426
        gpio-poweroff: Use gpiod_set_value_cansleep
      a16afaf7
    • Linus Torvalds's avatar
      Merge tag 'hsi-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi · 2a70ea5c
      Linus Torvalds authored
      Pull HSI update from Sebastian Reichel:
       "Just one patch for the HSI subsystem this time: use the new vm_fault_t
        return type"
      
      * tag 'hsi-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
        hsi: clients: Change return type to vm_fault_t
      2a70ea5c
    • Linus Torvalds's avatar
      Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 6419945e
      Linus Torvalds authored
      Pull clk updates from Stephen Boyd:
       "This time we have a good set of changes to the core framework that do
        some general cleanups, but nothing too major. The majority of the diff
        goes to two SoCs, Actions Semi and Qualcomm. A brand new driver is
        introduced for Actions Semi so it takes up some lines to add all the
        different types, and the Qualcomm diff is there because we add support
        for two SoCs and it's quite a bit of data.
      
        Otherwise the big driver updates are on TI Davinci and Amlogic
        platforms. And then the long tail of driver updates for various fixes
        and stuff follows after that.
      
        Core:
         - debugfs cleanups removing error checking and an unused provider API
         - Removal of a clk init typedef that isn't used
         - Usage of match_string() to simplify parent string name matching
         - OF clk helpers moved to their own file (linux/of_clk.h)
         - Make clk warnings more readable across kernel versions
      
        New Drivers:
         - Qualcomm SDM845 GCC and Video clk controllers
         - Qualcomm MSM8998 GCC
         - Actions Semi S900 SoC support
         - Nuvoton npcm750 microcontroller clks
         - Amlogic axg AO clock controller
      
        Removed Drivers:
         - Deprecated Rockchip clk-gate driver
      
        Updates:
         - debugfs functions stopped checking return values
         - Support for the MSIOF module clocks on Rensas R-Car M3-N
         - Support for the new Rensas RZ/G1C and R-Car E3 SoCs
         - Qualcomm GDSC, RCG, and PLL updates for clk changes in new SoCs
         - Berlin and Amlogic SPDX tagging
         - Usage of of_clk_get_parent_count() in more places
         - Proper implementation of the CDEV1/2 clocks on Tegra20
         - Allwinner H6 PRCM clock support and R40 EMAC support
         - Add critical flag to meson8b's fdiv2 as temporary fixup for ethernet
         - Round closest support for meson's mpll driver
         - Support for meson8b nand clocks and gxbb video decoder clocks
         - Mediatek mali clks
         - STM32MP1 fixes
         - Uniphier LD11/LD20 stream demux system clock"
      
      * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (134 commits)
        clk: qcom: Export clk_fabia_pll_configure()
        clk: bcm: Update and add Stingray clock entries
        dt-bindings: clk: Update Stingray binding doc
        clk-si544: Properly round requested frequency to nearest match
        clk: ingenic: jz4770: Add 150us delay after enabling VPU clock
        clk: ingenic: jz4770: Enable power of AHB1 bus after ungating VPU clock
        clk: ingenic: jz4770: Modify C1CLK clock to disable CPU clock stop on idle
        clk: ingenic: jz4770: Change OTG from custom to standard gated clock
        clk: ingenic: Support specifying "wait for clock stable" delay
        clk: ingenic: Add support for clocks whose gate bit is inverted
        clk: use match_string() helper
        clk: bcm2835: use match_string() helper
        clk: Return void from debug_init op
        clk: remove clk_debugfs_add_file()
        clk: tegra: no need to check return value of debugfs_create functions
        clk: davinci: no need to check return value of debugfs_create functions
        clk: bcm2835: no need to check return value of debugfs_create functions
        clk: no need to check return value of debugfs_create functions
        clk: imx6: add EPIT clock support
        clk: mvebu: use correct bit for 98DX3236 NAND
        ...
      6419945e
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md · d60dafdc
      Linus Torvalds authored
      Pull MD updates from Shaohua Li:
       "A few fixes of MD for this merge window. Mostly bug fixes:
      
         - raid5 stripe batch fix from Amy
      
         - Read error handling for raid1 FailFast device from Gioh
      
         - raid10 recovery NULL pointer dereference fix from Guoqing
      
         - Support write hint for raid5 stripe cache from Mariusz
      
         - Fixes for device hot add/remove from Neil and Yufen
      
         - Improve flush bio scalability from Xiao"
      
      * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md:
        MD: fix lock contention for flush bios
        md/raid5: Assigning NULL to sh->batch_head before testing bit R5_Overlap of a stripe
        md/raid1: add error handling of read error from FailFast device
        md: fix NULL dereference of mddev->pers in remove_and_add_spares()
        raid5: copy write hint from origin bio to stripe
        md: fix two problems with setting the "re-add" device state.
        raid10: check bio in r10buf_pool_free to void NULL pointer dereference
        md: fix an error code format and remove unsed bio_sector
      d60dafdc
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · 1329c204
      Linus Torvalds authored
      Pull sparc updates from David Miller:
      
       - a FPE signal fix that was also merged upstream
      
       - privileged ADI driver from Tom Hromatka
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        sparc: fix compat siginfo ABI regression
        selftests: sparc64: char: Selftest for privileged ADI driver
        char: sparc64: Add privileged ADI driver
      1329c204
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide · d6c75284
      Linus Torvalds authored
      Pull IDE updates from David Miller:
       "Primarily IRQ disabling avoidance changes from Sebastian Andrzej
        Siewior"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
        ide: don't enable/disable interrupts in force threaded-IRQ mode
        ide: don't disable interrupts during kmap_atomic()
        ide: Handle irq disabling consistently
        alim15x3: move irq-restore before pci_dev_put()
      d6c75284
    • Linus Torvalds's avatar
      Merge tag 'staging-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · eafdca4d
      Linus Torvalds authored
      Pull staging/IIO updates from Greg KH:
       "Here is the big staging and IIO driver update for 4.18-rc1.
      
        It was delayed as I wanted to make sure the final driver deletions did
        not cause any major merge issues, and all now looks good.
      
        There are a lot of patches here, just over 1000. The diffstat summary
        shows the major changes here:
      
      	1007 files changed, 16828 insertions(+), 227770 deletions(-)
      
        Because of this, we might be close to shrinking the overall kernel
        source code size for two releases in a row.
      
        There was loads of work in this release cycle, primarily:
      
         - tons of ks7010 driver cleanups
      
         - lots of mt7621 driver fixes and cleanups
      
         - most driver cleanups
      
         - wilc1000 fixes and cleanups
      
         - lots and lots of IIO driver cleanups and new additions
      
         - debugfs cleanups for all staging drivers
      
         - lots of other staging driver cleanups and fixes, the shortlog has
           the full details.
      
        but the big user-visable things here are the removal of 3 chunks of
        code:
      
         - ncpfs and ipx were removed on schedule, no one has cared about this
           code since it moved to staging last year, and if it needs to come
           back, it can be reverted.
      
         - lustre file system is removed.
      
           I've ranted at the lustre developers about once a year for the past
           5 years, with no real forward progress at all to clean things up
           and get the code into the "real" part of the kernel.
      
           Given that the lustre developers continue to work on an external
           tree and try to port those changes to the in-kernel tree every once
           in a while, this whole thing really really is not working out at
           all. So I'm deleting it so that the developers can spend the time
           working in their out-of-tree location and get things cleaned up
           properly to get merged into the tree correctly at a later date.
      
        Because of these file removals, you will have merge issues on some of
        these files (2 in the ipx code, 1 in the ncpfs code, and 1 in the
        atomisp driver). Just delete those files, it's a simple merge :)
      
        All of this has been in linux-next for a while with no reported
        problems"
      
      * tag 'staging-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1011 commits)
        staging: ipx: delete it from the tree
        ncpfs: remove uapi .h files
        ncpfs: remove Documentation
        ncpfs: remove compat functionality
        staging: ncpfs: delete it
        staging: lustre: delete the filesystem from the tree.
        staging: vc04_services: no need to save the log debufs dentries
        staging: vc04_services: vchiq_debugfs_log_entry can be a void *
        staging: vc04_services: remove struct vchiq_debugfs_info
        staging: vc04_services: move client dbg directory into static variable
        staging: vc04_services: remove odd vchiq_debugfs_top() wrapper
        staging: vc04_services: no need to check debugfs return values
        staging: mt7621-gpio: reorder includes alphabetically
        staging: mt7621-gpio: change gc_map to don't use pointers
        staging: mt7621-gpio: use GPIOF_DIR_OUT and GPIOF_DIR_IN macros instead of custom values
        staging: mt7621-gpio: change 'to_mediatek_gpio' to make just a one line return
        staging: mt7621-gpio: dt-bindings: update documentation for #interrupt-cells property
        staging: mt7621-gpio: update #interrupt-cells for the gpio node
        staging: mt7621-gpio: dt-bindings: complete documentation for the gpio
        staging: mt7621-dts: add missing properties to gpio node
        ...
      eafdca4d
    • Tony Luck's avatar
      x86/intel_rdt: Enable CMT and MBM on new Skylake stepping · 1d9f3e20
      Tony Luck authored
      New stepping of Skylake has fixes for cache occupancy and memory
      bandwidth monitoring.
      
      Update the code to enable these by default on newer steppings.
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: stable@vger.kernel.org # v4.14
      Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
      Link: https://lkml.kernel.org/r/20180608160732.9842-1-tony.luck@intel.com
      1d9f3e20
    • Linus Torvalds's avatar
      Merge tag 'libnvdimm-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · 7d3bf613
      Linus Torvalds authored
      Pull libnvdimm updates from Dan Williams:
       "This adds a user for the new 'bytes-remaining' updates to
        memcpy_mcsafe() that you already received through Ingo via the
        x86-dax- for-linus pull.
      
        Not included here, but still targeting this cycle, is support for
        handling memory media errors (poison) consumed via userspace dax
        mappings.
      
        Summary:
      
         - DAX broke a fundamental assumption of truncate of file mapped
           pages. The truncate path assumed that it is safe to disconnect a
           pinned page from a file and let the filesystem reclaim the physical
           block. With DAX the page is equivalent to the filesystem block.
           Introduce dax_layout_busy_page() to enable filesystems to wait for
           pinned DAX pages to be released. Without this wait a filesystem
           could allocate blocks under active device-DMA to a new file.
      
         - DAX arranges for the block layer to be bypassed and uses
           dax_direct_access() + copy_to_iter() to satisfy read(2) calls.
           However, the memcpy_mcsafe() facility is available through the pmem
           block driver. In order to safely handle media errors, via the DAX
           block-layer bypass, introduce copy_to_iter_mcsafe().
      
         - Fix cache management policy relative to the ACPI NFIT Platform
           Capabilities Structure to properly elide cache flushes when they
           are not necessary. The table indicates whether CPU caches are
           power-fail protected. Clarify that a deep flush is always performed
           on REQ_{FUA,PREFLUSH} requests"
      
      * tag 'libnvdimm-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (21 commits)
        dax: Use dax_write_cache* helpers
        libnvdimm, pmem: Do not flush power-fail protected CPU caches
        libnvdimm, pmem: Unconditionally deep flush on *sync
        libnvdimm, pmem: Complete REQ_FLUSH => REQ_PREFLUSH
        acpi, nfit: Remove ecc_unit_size
        dax: dax_insert_mapping_entry always succeeds
        libnvdimm, e820: Register all pmem resources
        libnvdimm: Debug probe times
        linvdimm, pmem: Preserve read-only setting for pmem devices
        x86, nfit_test: Add unit test for memcpy_mcsafe()
        pmem: Switch to copy_to_iter_mcsafe()
        dax: Report bytes remaining in dax_iomap_actor()
        dax: Introduce a ->copy_to_iter dax operation
        uio, lib: Fix CONFIG_ARCH_HAS_UACCESS_MCSAFE compilation
        xfs, dax: introduce xfs_break_dax_layouts()
        xfs: prepare xfs_break_layouts() for another layout type
        xfs: prepare xfs_break_layouts() to be called with XFS_MMAPLOCK_EXCL
        mm, fs, dax: handle layout changes to pinned dax mappings
        mm: fix __gup_device_huge vs unmap
        mm: introduce MEMORY_DEVICE_FS_DAX and CONFIG_DEV_PAGEMAP_OPS
        ...
      7d3bf613