Bug 201565 - Intel Processor Trace enabling in KVM
Summary: Intel Processor Trace enabling in KVM
Alias: None
Product: Virtualization
Classification: Unclassified
Component: kvm (show other bugs)
Hardware: i386 Linux
: P1 normal
Assignee: virtualization_kvm
Depends on:
Reported: 2018-10-30 10:34 UTC by Luwei Kang
Modified: 2018-10-31 00:34 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.19
Regression: No
Bisected commit-id:

architecture-instruction-set-extensions-programming-reference (711.87 KB, application/pdf)
2018-10-30 10:34 UTC, Luwei Kang

Description Luwei Kang 2018-10-30 10:34:25 UTC
Created attachment 279247 [details]

Intel Processor Trace (Intel PT) is an extension of Intel Architecture that captures information about software execution using dedicated hardware facilities that cause only minimal performance perturbation to the software being traced. Details on the Intel PT infrastructure and trace capabilities can be found in the Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 3C.

The suite of architecture changes serve to simplify the process of virtualizing Intel PT for use by a guest software. There are two primary elements to this new architecture support for VMX support improvements made for Intel PT.
1. Addition of a new guest IA32_RTIT_CTL value field to the VMCS.
  — This serves to speed and simplify the process of disabling trace on VM exit, and restoring it on VM entry.
2. Enabling use of EPT to redirect PT output.
  — This enables the VMM to elect to virtualize the PT output buffer using EPT. In this mode, the CPU will treat PT output addresses as Guest Physical Addresses (GPAs) and translate them using EPT. This means that Intel PT output reads (of the ToPA table) and writes (of trace output) can cause EPT violations, and other output events.

Intel Processor Trace virtualization can be work in one of 2 possible modes by set new option "pt_mode". Default is System-Wide mode.
a. System-Wide mode (default):
   When the host configures Intel PT to collect trace packets of the entire system, it can leave the relevant VMX controls clear to allow VMX-specific packets to provide information across VMX transitions.
   KVM guest will not aware this feature in this mode and both host and KVM guest trace will output to host buffer.

b. Host-Guest mode:
   Host can configure trace-packet generation while in VMX non-root operation for guests and root operation for native executing normally.
   Intel PT will be exposed to KVM guest in this mode, and the trace output to respective buffer of host and guest.
   In this mode, the status of PT will be saved and disabled before VM-entry and restored after VM-exit if trace a virtual machine.
Comment 1 Luwei Kang 2018-10-30 10:39:21 UTC
The link of patch set V13:
Comment 2 Luwei Kang 2018-10-31 00:34:26 UTC
Why this ticket:

Note You need to log in before you can comment on or make changes to this bug.