Re: [PATCH v12 20/24] virt: geniezone: Add tracing support for hyp call and vcpu exit_reason

From: Steven Rostedt
Date: Wed Aug 07 2024 - 16:03:11 EST


On Tue, 30 Jul 2024 16:24:32 +0800
Liju-clr Chen <liju-clr.chen@xxxxxxxxxxxx> wrote:

> From: Liju Chen <liju-clr.chen@xxxxxxxxxxxx>
>
> Add tracepoints for hypervisor calls and VCPU exit reasons in GenieZone
> driver. It aids performance debugging by providing more information
> about hypervisor operations and VCPU behavior.
>
> Command Usage:
> echo geniezone:* >> /sys/kernel/tracing/set_event
> echo 1 > /sys/kernel/tracing/tracing_on
> echo 0 > /sys/kernel/tracing/tracing_on
> cat /sys/kernel/tracing/trace
>
> For example:
> crosvm_vcpu0-4874 [007] ..... 94.757349: mtk_hypcall_enter: id=0xfb001005
> crosvm_vcpu0-4874 [007] ..... 94.760902: mtk_hypcall_leave: id=0xfb001005 invalid=0
> crosvm_vcpu0-4874 [007] ..... 94.760902: mtk_vcpu_exit: vcpu exit_reason=IRQ(0x92920003)
>
> This example tracks a hypervisor function call by an ID (`0xbb001005`)
> from initiation to termination, which is supported (invalid=0). A vCPU
> exit is triggered by an Interrupt Request (IRQ) (exit reason: 0x92920003).
>
> /* VM exit reason */
> enum {
> GZVM_EXIT_UNKNOWN = 0x92920000,
> GZVM_EXIT_MMIO = 0x92920001,
> GZVM_EXIT_HYPERCALL = 0x92920002,
> GZVM_EXIT_IRQ = 0x92920003,
> GZVM_EXIT_EXCEPTION = 0x92920004,
> GZVM_EXIT_DEBUG = 0x92920005,
> GZVM_EXIT_FAIL_ENTRY = 0x92920006,
> GZVM_EXIT_INTERNAL_ERROR = 0x92920007,
> GZVM_EXIT_SYSTEM_EVENT = 0x92920008,
> GZVM_EXIT_SHUTDOWN = 0x92920009,
> GZVM_EXIT_GZ = 0x9292000a,
> };
>
> Signed-off-by: Yi-De Wu <yi-de.wu@xxxxxxxxxxxx>
> Signed-off-by: Liju Chen <liju-clr.chen@xxxxxxxxxxxx>

From a tracing POV, I don't see any issues with this patch.

Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

-- Steve


> ---
> arch/arm64/geniezone/vm.c | 4 ++
> drivers/virt/geniezone/gzvm_vcpu.c | 3 ++
> include/trace/events/geniezone.h | 84 ++++++++++++++++++++++++++++++
> 3 files changed, 91 insertions(+)
> create mode 100644 include/trace/events/geniezone.h