Re: [PATCH v3 4/4] KVM: x86: add new nested vmexit tracepoints

From: Maxim Levitsky
Date: Tue Nov 28 2023 - 01:47:48 EST


On Fri, 2023-11-24 at 17:11 +0100, Paolo Bonzini wrote:
> On 9/28/23 12:36, Maxim Levitsky wrote:
> > Add 3 new tracepoints for nested VM exits which are intended
> > to capture extra information to gain insights about the nested guest
> > behavior.
> >
> > The new tracepoints are:
> >
> > - kvm_nested_msr
> > - kvm_nested_hypercall
> >
> > These tracepoints capture extra register state to be able to know
> > which MSR or which hypercall was done.
> >
> > - kvm_nested_page_fault
> >
> > This tracepoint allows to capture extra info about which host pagefault
> > error code caused the nested page fault.
> >
> > Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
>
> Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
>
> with just one question below that can be fixed when applying:
>
> > @@ -1139,6 +1145,22 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
> > vmcb12->control.exit_int_info_err,
> > KVM_ISA_SVM);
> >
> > + /* Collect some info about nested VM exits */
> > + switch (vmcb12->control.exit_code) {
> > + case SVM_EXIT_MSR:
> > + trace_kvm_nested_msr(vmcb12->control.exit_info_1 == 1,
> > + kvm_rcx_read(vcpu),
> > + (vmcb12->save.rax & -1u) |
> > + (((u64)(kvm_rdx_read(vcpu) & -1u) << 32)));
>
> Why the second "& -1u"? (And I also prefer 0xFFFFFFFFull

I think I copied it from somewhere but I can't seem to find where.
I agree with both remarks, will fix.

Thanks,
Best regards,
Maxim Levitsky
>
> Paolo
>