Re: [PATCH v2 10/15] KVM: x86/vmx: Check Arch LBR config when return perf capabilities

From: Like Xu
Date: Thu Dec 22 2022 - 06:07:09 EST


On 25/11/2022 12:05 pm, Yang Weijiang wrote:
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index b28be793de29..59bdd9873fb5 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2360,6 +2360,10 @@ static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct loaded_vmcs *vmcs0
if (guest_efer != host_efer)
exec_control |= VM_ENTRY_LOAD_IA32_EFER;
}
+
+ if (cpu_has_vmx_arch_lbr())
+ exec_control &= ~VM_ENTRY_LOAD_IA32_LBR_CTL;

Please verify that (arch) lbr is not available in the nested test case.
Thus when we support nested lbr, the developer will be aware of the need for test case updates

+
vm_entry_controls_set(vmx, exec_control);
/*