Re: [RFC PATCH 1/2] nSVM: introduce struct vmcb_ctrl_area_cached
From: Paolo Bonzini
Date: Tue Sep 28 2021 - 12:14:59 EST
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