mbox series

[RFC,0/2] KVM: arm64: vgic-its: Enhance debugging with debugfs and tracepoints

Message ID 20250113193128.1533449-1-jingzhangos@google.com (mailing list archive)
Headers show
Series KVM: arm64: vgic-its: Enhance debugging with debugfs and tracepoints | expand

Message

Jing Zhang Jan. 13, 2025, 7:31 p.m. UTC
This patch introduces two significant enhancements to the debugging
capabilities of the KVM VGIC ITS for ARM64 systems:

* Debugfs Interface for ITS Tables:
  A new debugfs interface is added, accessible at
  /sys/kernel/debug/kvm/<vm_name>/vgic-its-state@<its_base_address>.
  This interface exposes the internal ITS tables, allowing developers
  to inspect the mappings between Event IDs, Interrupt IDs, and their
  associated target processors. The information is presented in a clear,
  tabular format, making it easy to understand the current state of the
  ITS configuration.
* Tracepoints for ITS Commands:
  Tracepoints have been added to cover all major ITS commands. These
  tracepoints provide detailed information about each command execution,
  including device IDs, event IDs, collection IDs, and other relevant
  parameters. This allows for fine-grained monitoring of ITS activity
  and facilitates debugging of complex interrupt routing scenarios.

Motivation:

The ITS is a critical component for interrupt routing in virtualized
environments, but its complexity can make it difficult to debug and
optimize. The current lack of visibility into its internal state hinders
the ability to diagnose issues related to interrupt delivery, performance
bottlenecks, and configuration errors.

This patch addresses these challenges by providing tools to:

* Inspect ITS Table Mappings:
  The debugfs interface allows developers to directly examine the ITS
  tables, verify the correctness of mappings, and identify potential
  misconfigurations.
* Monitor ITS Command Execution:
  The tracepoints provide a detailed log of ITS command activity, making
  it easier to understand the flow of interrupt routing and pinpoint the
  root cause of issues.
* Improve Debuggability:
  By combining the static view of the ITS tables with the dynamic
  information from tracepoints, developers gain a comprehensive
  understanding of the ITS's behavior.

Implementation Details:

The debugfs interface is implemented using the seq_file interface to
present the ITS table data in a user-friendly format.
Tracepoints are defined using TRACE_EVENT and DECLARE_EVENT_CLASS macros
for efficient tracing. Tracepoints are strategically placed within each
ITS command handler function to capture relevant information.
The patch includes necessary modifications to the KVM Makefile and VGIC
header files to incorporate the new functionality.

---

Jing Zhang (2):
  KVM: arm64: vgic-its: Add debugfs interface to expose ITS tables
  KVM: arm64: vgic-its: Add tracepoints for VGIC ITS commands

 arch/arm64/kvm/Makefile              |   2 +-
 arch/arm64/kvm/vgic/trace.h          | 135 ++++++++++++++++
 arch/arm64/kvm/vgic/vgic-its-debug.c | 234 +++++++++++++++++++++++++++
 arch/arm64/kvm/vgic/vgic-its.c       |  58 ++++---
 arch/arm64/kvm/vgic/vgic.h           |  33 ++++
 5 files changed, 430 insertions(+), 32 deletions(-)
 create mode 100644 arch/arm64/kvm/vgic/vgic-its-debug.c


base-commit: 9d89551994a430b50c4fffcb1e617a057fa76e20