1. 01 Apr, 2019 31 commits
    • Andi Kleen's avatar
      perf vendor events intel: Update Skylake events to v42 · 24339348
      Andi Kleen authored
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: https://lkml.kernel.org/r/20190315165219.GA21223@tassilo.jf.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      24339348
    • Andi Kleen's avatar
      perf vendor events intel: Update Broadwell-DE events to v7 · d2243329
      Andi Kleen authored
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: https://lkml.kernel.org/r/20190315165219.GA21223@tassilo.jf.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d2243329
    • Andi Kleen's avatar
      perf vendor events intel: Update Broadwell events to v23 · 8313fe2d
      Andi Kleen authored
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: https://lkml.kernel.org/r/20190315165219.GA21223@tassilo.jf.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8313fe2d
    • Andi Kleen's avatar
      perf vendor events intel: Update metrics from TMAM 3.5 · fd550098
      Andi Kleen authored
      Update all the Intel JSON metrics from Ahmad Yasin's TMAM 3.5
      for Intel big core from Sandy Bridge to Cascade Lake.
      
      This has many improvements and new metircs
      
      - New TopDownL1_SMT group that provides a per SMT thread version
      of --topdown that does not require -a anymore. The drawback is
      increased multiplexing though since L1 TopDown does not fit into
      4 generic counters anymore.
      
      - Added SMT aware versions of other metrics
      
      - Split SMT aware metrics into separate metrics to avoid
      unnecessary event collections
      
      - New metrics for better branch analysis:
      Estimated Branch_Mispredict_Costs, Instructions per taken Branch,
      Branch Instructions per Taken Branch, etc.
      
      - Instruction mix metrics:
      Instructions per load, Instructions per store, Instructions per Branch,
      Instructions per Call
      
      - New Cache metrics:
      Bandwidth to L1/L2/L3 caches. L1/L2/L3 misses per kilo instructions.
      memory level parallelism
      
      - New memory controller metrics:
      Normalized memory bandwidth in interval mode, Average memory latency,
      Average number of parallel read requests,
      
      - 3DXP persistent memory metrics for Cascade Lake:
      3dxp read latency, 3dxp read/write bandwidth
      
      - Some other useful metrics like Instruction Level Parallelism,
      
      - Various other improvements.
      
      Not all metrics are available on all CPUs. Skylake has best coverage.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: https://lkml.kernel.org/r/20190315165219.GA21223@tassilo.jf.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fd550098
    • Alexey Budankov's avatar
      perf record: Implement --mmap-flush=<number> option · 470530bb
      Alexey Budankov authored
      Implement a --mmap-flush option that specifies minimal number of bytes
      that is extracted from mmaped kernel buffer to store into a trace. The
      default option value is 1 byte what means every time trace writing
      thread finds some new data in the mmaped buffer the data is extracted,
      possibly compressed and written to a trace.
      
        $ tools/perf/perf record --mmap-flush 1024 -e cycles -- matrix.gcc
        $ tools/perf/perf record --aio --mmap-flush 1K -e cycles -- matrix.gcc
      
      The option is independent from -z setting, doesn't vary with compression
      level and can serve two purposes.
      
      The first purpose is to increase the compression ratio of a trace data.
      Larger data chunks are compressed more effectively so the implemented
      option allows specifying data chunk size to compress. Also at some cases
      executing more write syscalls with smaller data size can take longer
      than executing less write syscalls with bigger data size due to syscall
      overhead so extracting bigger data chunks specified by the option value
      could additionally decrease runtime overhead.
      
      The second purpose is to avoid self monitoring live-lock issue in system
      wide (-a) profiling mode. Profiling in system wide mode with compression
      (-a -z) can additionally induce data into the kernel buffers along with
      the data from monitored processes. If performance data rate and volume
      from the monitored processes is high then trace streaming and
      compression activity in the tool is also high. High tool process
      activity can lead to subtle live-lock effect when compression of single
      new byte from some of mmaped kernel buffer leads to generation of the
      next single byte at some mmaped buffer. So perf tool process ends up in
      endless self monitoring.
      
      Implemented synch parameter is the mean to force data move independently
      from the specified flush threshold value. Despite the provided flush
      value the tool needs capability to unconditionally drain memory buffers,
      at least in the end of the collection.
      
      Committer testing:
      
      Running with the default value, i.e. as soon as there is something to
      read go on consuming, we first write the synthesized events, small
      chunks of about 128 bytes:
      
        # perf trace -m 2048 --call-graph dwarf -e write -- perf record
        <SNIP>
           101.142 ( 0.004 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x210db60, count: 120) = 120
                                               __libc_write (/usr/lib64/libpthread-2.28.so)
                                               ion (/home/acme/bin/perf)
                                               record__write (inlined)
                                               process_synthesized_event (/home/acme/bin/perf)
                                               perf_tool__process_synth_event (inlined)
                                               perf_event__synthesize_mmap_events (/home/acme/bin/perf)
      
      Then we move to reading the mmap buffers consuming the events put there
      by the kernel perf infrastructure:
      
           107.561 ( 0.005 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befc02000, count: 336) = 336
                                               __libc_write (/usr/lib64/libpthread-2.28.so)
                                               ion (/home/acme/bin/perf)
                                               record__write (inlined)
                                               record__pushfn (/home/acme/bin/perf)
                                               perf_mmap__push (/home/acme/bin/perf)
                                               record__mmap_read_evlist (inlined)
                                               record__mmap_read_all (inlined)
                                               __cmd_record (inlined)
                                               cmd_record (/home/acme/bin/perf)
           12919.953 ( 0.136 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befc83150, count: 184984) = 184984
        <SNIP same backtrace as in the 107.561 timestamp>
           12920.094 ( 0.155 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befc02150, count: 261816) = 261816
        <SNIP same backtrace as in the 107.561 timestamp>
           12920.253 ( 0.093 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befb81120, count: 170832) = 170832
        <SNIP same backtrace as in the 107.561 timestamp>
      
      If we limit it to write only when more than 16MB are available for
      reading, it throttles that to a quarter of the --mmap-pages set for
      'perf record', which by default get to 528384 bytes, found out using
      'record -v':
      
        mmap flush: 132096
        mmap size 528384B
      
      With that in place all the writes coming from
      record__mmap_read_evlist(), i.e. from the mmap buffers setup by the
      kernel perf infrastructure were at least 132096 bytes long.
      
      Trying with a bigger mmap size:
      
         perf trace -e write perf record -v -m 2048 --mmap-flush 16M
         74982.928 ( 2.471 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff94a6cc000, count: 3580888) = 3580888
         74985.406 ( 2.353 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff949ecb000, count: 3453256) = 3453256
         74987.764 ( 2.629 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff9496ca000, count: 3859232) = 3859232
         74990.399 ( 2.341 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff948ec9000, count: 3769032) = 3769032
         74992.744 ( 2.064 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff9486c8000, count: 3310520) = 3310520
         74994.814 ( 2.619 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff947ec7000, count: 4194688) = 4194688
         74997.439 ( 2.787 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff9476c6000, count: 4029760) = 4029760
      
      Was again limited to a quarter of the mmap size:
      
        mmap flush: 2098176
        mmap size 8392704B
      
      A warning about that would be good to have but can be added later,
      something like:
      
        "max flush is a quarter of the mmap size, if wanting to bump the mmap
         flush further, bump the mmap size as well using -m/--mmap-pages"
      
      Also rename the 'sync' parameters to 'synch' to keep tools/perf building
      with older glibcs:
      
        cc1: warnings being treated as errors
        builtin-record.c: In function 'record__mmap_read_evlist':
        builtin-record.c:775: warning: declaration of 'sync' shadows a global declaration
        /usr/include/unistd.h:933: warning: shadowed declaration is here
        builtin-record.c: In function 'record__mmap_read_all':
        builtin-record.c:856: warning: declaration of 'sync' shadows a global declaration
        /usr/include/unistd.h:933: warning: shadowed declaration is here
      Signed-off-by: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
      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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/f6600d72-ecfa-2eb7-7e51-f6954547d500@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      470530bb
    • Alexey Budankov's avatar
      tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines · 3b1c5d96
      Alexey Budankov authored
      Implement libzstd feature check, NO_LIBZSTD and LIBZSTD_DIR defines to
      override Zstd library sources or disable the feature from the command
      line:
      
        $ make -C tools/perf LIBZSTD_DIR=/path/to/zstd/sources/ clean all
        $ make -C tools/perf NO_LIBZSTD=1 clean all
      
      Auto detection feature status is reported just before compilation
      starts.  If your system has some version of the zstd library
      preinstalled then the build system finds and uses it during the build.
      
      If you still prefer to compile with some other version of zstd library
      you have capability to refer the compilation to that version using
      LIBZSTD_DIR define.
      Signed-off-by: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/9b4cd8b0-10a3-1f1e-8d6b-5922a7ca216b@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3b1c5d96
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Rename input arguments and local variables of... · c9bd7796
      Tzvetomir Stoyanov authored
      tools lib traceevent: Rename input arguments and local variables of libtraceevent from pevent to tep
      
      "pevent" to "tep" renaming of:
       - all "pevent" input arguments of libtraceevent internal functions.
       - all local "pevent" variables of libtraceevent.
      
      This makes the implementation consistent with the chosen naming
      convention, tep (trace event parser), and will avoid any confusion with
      the old pevent name
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-5-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164344.944953447@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9bd7796
    • Tzvetomir Stoyanov's avatar
      perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event_filter to "tep" · 6b1f4c42
      Tzvetomir Stoyanov authored
      The member "pevent" of the struct tep_event_filter is renamed to "tep".
      This makes the struct consistent with the chosen naming convention:
      
        tep (trace event parser), instead of the old pevent.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-4-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164344.785896189@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6b1f4c42
    • Tzvetomir Stoyanov's avatar
      perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event to "tep" · 69769ce1
      Tzvetomir Stoyanov authored
      The member "pevent" of the struct tep_event is renamed to "tep". This
      makes the struct consistent with the chosen naming convention:
      
        tep (trace event parser), instead of the old pevent.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-3-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164344.627724996@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      69769ce1
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Rename input arguments of libtraceevent APIs from pevent to tep · 047ff221
      Tzvetomir Stoyanov authored
      Input arguments of libtraceevent APIs are renamed from "struct
      tep_handle *pevent" to "struct tep_handle *tep". This makes the API
      consistent with the chosen naming convention: tep (trace event parser),
      instead of the old pevent.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-2-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164344.465573837@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      047ff221
    • Tzvetomir Stoyanov's avatar
      tools tools, tools lib traceevent: Make traceevent APIs more consistent · 55c34ae0
      Tzvetomir Stoyanov authored
      Rename some traceevent APIs for consistency:
      
      tep_pid_is_registered() to tep_is_pid_registered()
      tep_file_bigendian() to tep_is_file_bigendian()
      
        to make the names and return values consistent with other tep_is_... APIs
      
      tep_data_lat_fmt() to tep_data_latency_format()
      
        to make the name more descriptive
      
      tep_host_bigendian() to tep_is_bigendian()
      tep_set_host_bigendian() to tep_set_local_bigendian()
      tep_is_host_bigendian() to tep_is_local_bigendian()
      
        "host" can be confused with VMs, and "local" is about the local
        machine. All tep_is_..._bigendian(struct tep_handle *tep) APIs return
        the saved data in the tep handle, while tep_is_bigendian() returns
        the running machine's endianness.
      
      All tep_is_... functions are modified to return bool value, instead of int.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20190327141946.4353-2-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164344.288624897@goodmis.org
      [ Removed some extra parenthesis around return statements ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      55c34ae0
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Remove call to exit() from tep_filter_add_filter_str() · fea6b632
      Tzvetomir Stoyanov authored
      This patch removes call to exit() from tep_filter_add_filter_str(). A
      library function should not force the application to exit. In the
      current implementation tep_filter_add_filter_str() calls exit() when a
      special "test_filters" mode is set, used only for debugging purposes.
      When this mode is set and a filter is added - its string is printed to
      the console and exit() is called. This patch changes the logic - when in
      "test_filters" mode, the filter string is still printed, but the exit()
      is not called. It is up to the application to track when "test_filters"
      mode is set and to call exit, if needed.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20190326154328.28718-9-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164344.121717482@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fea6b632
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Remove tep filter trivial APIs · a634b278
      Tzvetomir Stoyanov authored
      This patch removes trivial filter tep APIs:
      
        enum tep_filter_trivial_type
        tep_filter_event_has_trivial()
        tep_update_trivial()
        tep_filter_clear_trivial()
      
      Trivial filters is an optimization, used only in the first version of
      KernelShark. The API is deprecated, the next KernelShark release does
      not use it.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20190326154328.28718-4-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164343.968458918@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a634b278
    • Steven Rostedt (VMware)'s avatar
      tools lib traceevent: Removed unneeded !! and return parenthesis · 2ce4639f
      Steven Rostedt (VMware) authored
      As return is not a function we do not need parenthesis around the return
      value. Also, a function returning bool does not need to add !!.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
      Link: http://lkml.kernel.org/r/20190401164343.817886725@goodmis.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2ce4639f
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Implement new traceevent APIs for accessing struct tep_handler fields · 80c5526c
      Tzvetomir Stoyanov authored
      As struct tep_handler definition is not exposed as part of libtraceevent
      API, its fields cannot be accessed directly by the library users. This
      patch implements new APIs, which can be used to access the struct
      tep_handler fields:
      
        tep_get_event()        - retrieves an event pointer at a specific index
        tep_get_first_event()  - is modified to use tep_get_event()
        tep_clear_flag()       - clears a tep handle flag
        tep_test_flag()        - test if a given flag is set
        tep_get_header_timestamp_size() - returns the size of the timestamp stored
                                 in the header.
        tep_get_cpus()         - returns the number of CPUs
        tep_is_old_format()    - returns true if data was created by an
                                 older kernel with the old data format
        tep_set_print_raw()    - have the output print in the raw format
        tep_set_test_filters() - debugging utility for testing tep filters
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190325145017.30246-4-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164343.679629539@goodmis.org
      [ Renamed some newly added "pevent" to "tep" ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      80c5526c
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Coding style fixes · d5d2d05b
      Tzvetomir Stoyanov authored
      Fixed few coding style problems in event-parse-api.c
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190325145017.30246-3-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164343.537086316@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d5d2d05b
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Change description of few APIs · 489b3494
      Tzvetomir Stoyanov authored
      APIs descriptions should describe the purpose of the function, its
      parameters and return value. While working  on man pages implementation,
      I noticed mismatches in the  descriptions of few APIs.  This patch
      changes the description of these APIs, making them consistent with the
      man pages:
      
       - tep_print_num_field()
       - tep_print_func_field()
       - tep_get_header_page_size()
       - tep_get_long_size()
       - tep_set_long_size()
       - tep_get_page_size()
       - tep_set_page_size()
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20190325145017.30246-2-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164343.396759247@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      489b3494
    • Steven Rostedt (Red Hat)'s avatar
      tools lib traceevent: Add more debugging to see various internal ring buffer entries · 70df6a73
      Steven Rostedt (Red Hat) authored
      When trace-cmd report --debug is set, show the internal ring buffer
      entries like time-extends and padding. This requires adding new kbuffer
      API to retrieve these items.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
      Link: http://lkml.kernel.org/r/20190401164343.257591565@goodmis.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70df6a73
    • Tzvetomir Stoyanov's avatar
      tools lib traceevent: Implement a new API, tep_list_events_copy() · 6699ed71
      Tzvetomir Stoyanov authored
      Existing API tep_list_events() is not thread safe, it uses the internal
      array sort_events to keep cache of the sorted events and reuses it. This
      patch implements a new API, tep_list_events_copy(), which allocates new
      sorted array each time it is called. It could be used when a sorted
      events functionality is needed in thread safe use cases. It is up to the
      caller to free the array.
      Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/linux-trace-devel/20181218133013.31094-1-tstoyanov@vmware.com
      Link: http://lkml.kernel.org/r/20190401164343.117437443@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6699ed71
    • Steven Rostedt (VMware)'s avatar
      tools lib traceevent: Add mono clocks to be parsed in seconds · fed33e90
      Steven Rostedt (VMware) authored
      The mono clocks can display in seconds instead of whole numbers:
      
             trace-cmd-521   [001] 99176715281005: sched_waking:         comm=kworker/u16:2 pid=32118 prio=120 target_cpu=002
             trace-cmd-521   [001] 99176715286349: sched_wake_idle_without_ipi: cpu=2
             trace-cmd-521   [001] 99176715288047: sched_wakeup:         kworker/u16:2:32118 [120] success=1 CPU:002
             trace-cmd-521   [001] 99176715290022: sched_waking:         comm=trace-cmd pid=523 prio=120 target_cpu=000
             trace-cmd-521   [001] 99176715292332: sched_wake_idle_without_ipi: cpu=0
             trace-cmd-521   [001] 99176715292855: sched_wakeup:         trace-cmd:523 [120] success=1 CPU:000
             trace-cmd-521   [001] 99176715300697: sched_stat_runtime:   comm=trace-cmd pid=521 runtime=80233 [ns] vruntime=66705540554 [ns
      
      Break it up in seconds:
      
             trace-cmd-521   [001] 99176.715281: sched_waking:         comm=kworker/u16:2 pid=32118 prio=120 target_cpu=002
             trace-cmd-521   [001] 99176.715286: sched_wake_idle_without_ipi: cpu=2
             trace-cmd-521   [001] 99176.715288: sched_wakeup:         kworker/u16:2:32118 [120] success=1 CPU:002
             trace-cmd-521   [001] 99176.715290: sched_waking:         comm=trace-cmd pid=523 prio=120 target_cpu=000
             trace-cmd-521   [001] 99176.715292: sched_wake_idle_without_ipi: cpu=0
             trace-cmd-521   [001] 99176.715293: sched_wakeup:         trace-cmd:523 [120] success=1 CPU:000
             trace-cmd-521   [001] 99176.715301: sched_stat_runtime:   comm=trace-cmd pid=521 runtime=80233 [ns] vruntime=66705540554 [ns]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
      Link: http://lkml.kernel.org/r/20190401164342.976554023@goodmis.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fed33e90
    • Steven Rostedt (VMware)'s avatar
      tools lib traceevent: Handle trace_printk() "%px" · 328b82b7
      Steven Rostedt (VMware) authored
      With security updates, %p in the kernel is hashed to protect true kernel
      locations. But trace_printk() is not allowed in production systems, and
      when a pointer is used, there are many times that the actual address is
      needed. "%px" produces the real address. But libtraceevent does not know how
      to handle that extension. Add it.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
      Link: http://lkml.kernel.org/r/20190401164342.837312153@goodmis.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      328b82b7
    • Andi Kleen's avatar
      perf list: Output tool events · 5e0861ba
      Andi Kleen authored
      Add support in 'perf list' to output tool internal events, currently
      only 'duration_time'.
      
      Committer testing:
      
        $ perf list dur*
      
        List of pre-defined events (to be used in -e):
      
          duration_time                                      [Tool event]
      
        Metric Groups:
      
        $ perf list sw
      
        List of pre-defined events (to be used in -e):
      
          alignment-faults                                   [Software event]
          bpf-output                                         [Software event]
          context-switches OR cs                             [Software event]
          cpu-clock                                          [Software event]
          cpu-migrations OR migrations                       [Software event]
          dummy                                              [Software event]
          emulation-faults                                   [Software event]
          major-faults                                       [Software event]
          minor-faults                                       [Software event]
          page-faults OR faults                              [Software event]
          task-clock                                         [Software event]
      
          duration_time                                      [Tool event]
      
        $ perf list | grep duration
          duration_time                                      [Tool event]
               [L1D miss outstandings duration in cycles]
                page walk duration are excluded in Skylake]
                load. EPT page walk duration are excluded in Skylake]
                page walk duration are excluded in Skylake]
                store. EPT page walk duration are excluded in Skylake]
                (instruction fetch) request. EPT page walk duration are excluded in
                instruction fetch request. EPT page walk duration are excluded in
        $
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20190326221823.11518-5-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5e0861ba
    • Andi Kleen's avatar
      3371f389
    • Andi Kleen's avatar
      perf stat: Implement duration_time as a proper event · f0fbb114
      Andi Kleen authored
      The perf metric expression use 'duration_time' internally to normalize
      events.  Normal 'perf stat' without -x also prints the duration time.
      But when using -x, the interval is not output anywhere, which is
      inconvenient for any post processing which often wants to normalize
      values to time.
      
      So implement 'duration_time' as a proper perf event that can be
      specified explicitely with -e.
      
      The previous implementation of 'duration_time' only worked for metric
      processing. This adds the concept of a tool event that is handled by the
      tool. On the kernel level it is still mapped to the dummy software
      event, but the values are not read anymore, but instead computed by the
      tool.
      
      Add proper plumbing to handle this in the event parser, and display it
      in 'perf stat'. We don't want 'duration_time' to be added up, so it's
      only printed for the first CPU.
      
      % perf stat -e duration_time,cycles true
      
       Performance counter stats for 'true':
      
                 555,476 ns   duration_time
                 771,958      cycles
      
             0.000555476 seconds time elapsed
      
             0.000644000 seconds user
             0.000000000 seconds sys
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20190326221823.11518-3-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f0fbb114
    • Andi Kleen's avatar
      perf stat: Revert checks for duration_time · c2b3c170
      Andi Kleen authored
      This reverts e864c5ca ("perf stat: Hide internal duration_time
      counter") but doing it manually since the code has now moved to a
      different file.
      
      The next patch will properly implement duration_time as a full event, so
      no need to hide it anymore.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20190326221823.11518-2-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c2b3c170
    • 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 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa': File name too long
        openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 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, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 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 8 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