linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/35] perf intel-pt: Add support for tracing virtual machine user space on the host
@ 2022-07-11  9:31 Adrian Hunter
  2022-07-11  9:31 ` [PATCH 01/35] perf tools: Fix dso_id inode generation comparison Adrian Hunter
                   ` (35 more replies)
  0 siblings, 36 replies; 83+ messages in thread
From: Adrian Hunter @ 2022-07-11  9:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Namhyung Kim, Ian Rogers, Andi Kleen, linux-kernel, kvm

Hi

Here are patches to support decoding an Intel PT trace that contains data
from virtual machine userspace.

This is done by adding functionality to perf inject to be able to inject
sideband events needed for decoding, into the perf.data file recorded on
the host.  That is, inject events from a perf.data file recorded in a
virtual machine into a perf.data file recorded on the host at the same
time.

For more details, see the example in the documentation added in the last
patch.

Note there was already support for tracing virtual machines kernel-only:

 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/perf-intel-pt.txt?h=v5.19-rc1#n1221
 
or the special case of tracing KVM self tests:

 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/perf-intel-pt.txt?h=v5.19-rc1#n1403

For general information about Intel PT also see the wiki page:

 https://perf.wiki.kernel.org/index.php/Perf_tools_support_for_Intel%C2%AE_Processor_Trace

The patches fall into 5 groups:
 1. the first patch is a fix
 2. the next 22 patches are preparation
 3. the main patch is "perf inject: Add support for injecting guest
 sideband events"
 4. 3 more preparation patches
 5. Intel PT decoding changes

The patches are mostly small except for "perf inject: Add support for
injecting guest sideband events".  However the code there adds new
functionality, does not affect existing functionality and is consequently
pretty self-contained.


Adrian Hunter (35):
      perf tools: Fix dso_id inode generation comparison
      perf tools: Export dsos__for_each_with_build_id()
      perf ordered_events: Add ordered_events__last_flush_time()
      perf tools: Export perf_event__process_finished_round()
      perf tools: Factor out evsel__id_hdr_size()
      perf tools: Add perf_event__synthesize_id_sample()
      perf script: Add --dump-unsorted-raw-trace option
      perf buildid-cache: Add guestmount'd files to the build ID cache
      perf buildid-cache: Do not require purge files to also be in the file system
      perf tools: Add machine_pid and vcpu to id_index
      perf session: Create guest machines from id_index
      perf tools: Add guest_cpu to hypervisor threads
      perf tools: Add machine_pid and vcpu to perf_sample
      perf tools: Use sample->machine_pid to find guest machine
      perf script: Add machine_pid and vcpu
      perf dlfilter: Add machine_pid and vcpu
      perf auxtrace: Add machine_pid and vcpu to auxtrace_error
      perf script python: Add machine_pid and vcpu
      perf script python: intel-pt-events: Add machine_pid and vcpu
      perf tools: Remove also guest kcore_dir with host kcore_dir
      perf tools: Make has_kcore_dir() work also for guest kcore_dir
      perf tools: Automatically use guest kcore_dir if present
      perf tools: Add reallocarray_as_needed()
      perf inject: Add support for injecting guest sideband events
      perf machine: Use realloc_array_as_needed() in machine__set_current_tid()
      perf tools: Handle injected guest kernel mmap event
      perf tools: Add perf_event__is_guest()
      perf intel-pt: Remove guest_machine_pid
      perf intel-pt: Add some more logging to intel_pt_walk_next_insn()
      perf intel-pt: Track guest context switches
      perf intel-pt: pt disable sync switch
      perf intel-pt: Determine guest thread from guest sideband
      perf intel-pt: Add machine_pid and vcpu to auxtrace_error
      perf intel-pt: Use guest pid/tid etc in guest samples
      perf intel-pt: Add documentation for tracing guest machine user space

 tools/lib/perf/include/internal/evsel.h            |    4 +
 tools/lib/perf/include/perf/event.h                |    7 +
 tools/perf/Documentation/perf-dlfilter.txt         |   22 +
 tools/perf/Documentation/perf-inject.txt           |   17 +
 tools/perf/Documentation/perf-intel-pt.txt         |  181 +++-
 tools/perf/Documentation/perf-script.txt           |   10 +-
 tools/perf/builtin-inject.c                        | 1043 +++++++++++++++++++-
 tools/perf/builtin-script.c                        |   19 +
 tools/perf/include/perf/perf_dlfilter.h            |    8 +
 tools/perf/scripts/python/intel-pt-events.py       |   32 +-
 tools/perf/util/auxtrace.c                         |   30 +-
 tools/perf/util/auxtrace.h                         |    4 +
 tools/perf/util/build-id.c                         |   80 +-
 tools/perf/util/build-id.h                         |   16 +-
 tools/perf/util/data.c                             |   43 +-
 tools/perf/util/data.h                             |    1 +
 tools/perf/util/dlfilter.c                         |    2 +
 tools/perf/util/dso.h                              |    6 +
 tools/perf/util/dsos.c                             |   10 +-
 tools/perf/util/event.h                            |   23 +
 tools/perf/util/evlist.c                           |   42 +-
 tools/perf/util/evsel.c                            |   27 +
 tools/perf/util/evsel.h                            |    2 +
 tools/perf/util/intel-pt.c                         |  183 +++-
 tools/perf/util/machine.c                          |   41 +-
 tools/perf/util/machine.h                          |    2 +
 tools/perf/util/ordered-events.h                   |    6 +
 .../util/scripting-engines/trace-event-python.c    |   15 +-
 tools/perf/util/session.c                          |  111 ++-
 tools/perf/util/session.h                          |    4 +
 tools/perf/util/symbol.c                           |    6 +-
 tools/perf/util/synthetic-events.c                 |   98 +-
 tools/perf/util/synthetic-events.h                 |    2 +
 tools/perf/util/thread.c                           |    1 +
 tools/perf/util/thread.h                           |    1 +
 tools/perf/util/util.c                             |   70 +-
 tools/perf/util/util.h                             |   15 +
 37 files changed, 2029 insertions(+), 155 deletions(-)


Regards
Adrian

^ permalink raw reply	[flat|nested] 83+ messages in thread

end of thread, other threads:[~2022-08-11 17:22 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11  9:31 [PATCH 00/35] perf intel-pt: Add support for tracing virtual machine user space on the host Adrian Hunter
2022-07-11  9:31 ` [PATCH 01/35] perf tools: Fix dso_id inode generation comparison Adrian Hunter
2022-07-18 14:57   ` Arnaldo Carvalho de Melo
2022-07-19 10:18     ` Adrian Hunter
2022-07-19 15:13       ` Ian Rogers
2022-07-19 19:16         ` Arnaldo Carvalho de Melo
2022-07-11  9:31 ` [PATCH 02/35] perf tools: Export dsos__for_each_with_build_id() Adrian Hunter
2022-07-19 16:55   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 03/35] perf ordered_events: Add ordered_events__last_flush_time() Adrian Hunter
2022-07-19 16:56   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 04/35] perf tools: Export perf_event__process_finished_round() Adrian Hunter
2022-07-19 17:04   ` Ian Rogers
2022-08-09 11:37     ` Adrian Hunter
2022-07-11  9:31 ` [PATCH 05/35] perf tools: Factor out evsel__id_hdr_size() Adrian Hunter
2022-07-19 17:09   ` Ian Rogers
2022-08-09 11:49     ` Adrian Hunter
2022-08-09 17:07       ` Ian Rogers
2022-07-11  9:31 ` [PATCH 06/35] perf tools: Add perf_event__synthesize_id_sample() Adrian Hunter
2022-07-19 17:10   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 07/35] perf script: Add --dump-unsorted-raw-trace option Adrian Hunter
2022-07-19 17:11   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 08/35] perf buildid-cache: Add guestmount'd files to the build ID cache Adrian Hunter
2022-07-19 17:41   ` Ian Rogers
2022-08-09 12:21     ` Adrian Hunter
2022-07-11  9:31 ` [PATCH 09/35] perf buildid-cache: Do not require purge files to also be in the file system Adrian Hunter
2022-07-19 17:44   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 10/35] perf tools: Add machine_pid and vcpu to id_index Adrian Hunter
2022-07-19 17:48   ` Ian Rogers
2022-08-09 12:19     ` Adrian Hunter
2022-07-11  9:31 ` [PATCH 11/35] perf session: Create guest machines from id_index Adrian Hunter
2022-07-19 17:51   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 12/35] perf tools: Add guest_cpu to hypervisor threads Adrian Hunter
2022-07-20  0:23   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 13/35] perf tools: Add machine_pid and vcpu to perf_sample Adrian Hunter
2022-07-20  0:36   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 14/35] perf tools: Use sample->machine_pid to find guest machine Adrian Hunter
2022-07-20  0:37   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 15/35] perf script: Add machine_pid and vcpu Adrian Hunter
2022-07-20  0:39   ` Ian Rogers
2022-07-11  9:31 ` [PATCH 16/35] perf dlfilter: " Adrian Hunter
2022-07-20  0:42   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 17/35] perf auxtrace: Add machine_pid and vcpu to auxtrace_error Adrian Hunter
2022-07-20  0:43   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 18/35] perf script python: Add machine_pid and vcpu Adrian Hunter
2022-07-20  0:43   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 19/35] perf script python: intel-pt-events: " Adrian Hunter
2022-07-20  0:44   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 20/35] perf tools: Remove also guest kcore_dir with host kcore_dir Adrian Hunter
2022-07-20  0:45   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 21/35] perf tools: Make has_kcore_dir() work also for guest kcore_dir Adrian Hunter
2022-07-20  0:49   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 22/35] perf tools: Automatically use guest kcore_dir if present Adrian Hunter
2022-07-20  0:51   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 23/35] perf tools: Add reallocarray_as_needed() Adrian Hunter
2022-07-20  0:55   ` Ian Rogers
2022-08-09 16:48     ` Adrian Hunter
2022-07-11  9:32 ` [PATCH 24/35] perf inject: Add support for injecting guest sideband events Adrian Hunter
2022-07-20  1:06   ` Ian Rogers
2022-08-11 17:19     ` Adrian Hunter
2022-07-11  9:32 ` [PATCH 25/35] perf machine: Use realloc_array_as_needed() in machine__set_current_tid() Adrian Hunter
2022-07-11  9:32 ` [PATCH 26/35] perf tools: Handle injected guest kernel mmap event Adrian Hunter
2022-07-20  1:09   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 27/35] perf tools: Add perf_event__is_guest() Adrian Hunter
2022-07-20  1:11   ` Ian Rogers
2022-07-20 14:06     ` Arnaldo Carvalho de Melo
2022-07-20 14:56       ` Ian Rogers
2022-07-11  9:32 ` [PATCH 28/35] perf intel-pt: Remove guest_machine_pid Adrian Hunter
2022-07-20  1:12   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 29/35] perf intel-pt: Add some more logging to intel_pt_walk_next_insn() Adrian Hunter
2022-07-20  1:13   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 30/35] perf intel-pt: Track guest context switches Adrian Hunter
2022-07-20  1:13   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 31/35] perf intel-pt: Disable sync switch with guest sideband Adrian Hunter
2022-07-20  1:14   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 32/35] perf intel-pt: Determine guest thread from " Adrian Hunter
2022-07-20  1:15   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 33/35] perf intel-pt: Add machine_pid and vcpu to auxtrace_error Adrian Hunter
2022-07-20  5:27   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 34/35] perf intel-pt: Use guest pid/tid etc in guest samples Adrian Hunter
2022-07-20  5:28   ` Ian Rogers
2022-07-11  9:32 ` [PATCH 35/35] perf intel-pt: Add documentation for tracing guest machine user space Adrian Hunter
2022-07-20  5:29   ` Ian Rogers
2022-07-18 15:28 ` [PATCH 00/35] perf intel-pt: Add support for tracing virtual machine user space on the host Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).