Re: [PATCH v5 3/3] KVM: x86: add new nested vmexit tracepoints

From: Paolo Bonzini
Date: Thu Dec 19 2024 - 13:03:33 EST


On 12/19/24 18:49, Maxim Levitsky wrote:
Here I probably would have preferred an unconditional tracepoint giving
RAX/RBX/RCX/RDX after a nested vmexit. This is not exactly what Sean
wanted but perhaps it strikes a middle ground? I know you wrote this
for a debugging tool, do you really need to have everything in a single
tracepoint, or can you correlate the existing exit tracepoint with this
hypothetical trace_kvm_nested_exit_regs, to pick RDMSR vs. WRMSR?

Hi!

If the new trace_kvm_nested_exit_regs tracepoint has a VM exit number argument, then
I can enable this new tracepoint twice with a different filter (vm_exit_num number == msr and vm_exit_num == vmcall),
and each instance will count the events that I need.

So this can work.
Ok, thanks. On one hand it may make sense to have trace_kvm_exit_regs and trace_kvm_nested_exit_regs (you can even extend the TRACE_EVENT_KVM_EXIT macro to generate both the exit and the exit_regs tracepoint). On the other hand it seems to me that this new tracepoint is kinda reinventing the wheel; your patch adding nested equivalents of trace_kvm_hypercall and trace_kvm_msr seems more obvious to me.

I see Sean's point in not wanting one-off tracepoints, on the other hand there is value in having similar tracepoints for the L1->L0 and L2->L0 cases. I'll let him choose between the two possibilities (a new *_exit_regs pair, or just apply this patch) but I think there should be one of these two.

Paolo