[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <05425bd8-46dc-f136-fbe0-52f42351aea1@redhat.com>
Date: Tue, 28 Sep 2021 18:14:49 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Emanuele Giuseppe Esposito <eesposit@...hat.com>,
kvm@...r.kernel.org
Cc: Maxim Levitsky <mlevitsk@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/2] nSVM: introduce struct vmcb_ctrl_area_cached
On 17/09/21 14:49, Emanuele Giuseppe Esposito wrote:
> +static inline bool vmcb_is_intercept_cached(struct vmcb_ctrl_area_cached *control, u32 bit)
> +{
> + return vmcb_is_intercept((struct vmcb_control_area *) control,
> + bit);
> +}
> +
This is quite dangerous, because it expects that the offset is the same
between vmcb_control_area and vmcb_ctrl_area_cached. You can just
duplicate the implementation (which is essentially just a test_bit), and
call the function
static inline bool vmcb12_is_intercept(struct kvm_vcpu *vcpu, u32 bit)
Likewise, nested_vmcb_check_controls can just take the vcpu since you
moved nested_load_control_from_vmcb12 earlier.
Finally, copy_vmcb_control_area can be inlined, and its caller
nested_load_control_from_vmcb12 can stop copying the ASID. There is
only one call to it since commit 4995a3685f1b ("KVM: SVM: Use a separate
vmcb for the nested L2 guest", 2021-03-15).
Thanks,
Paolo
Powered by blists - more mailing lists