On Thu, Jun 30, 2022 at 7:07 PM Xiaoyao Li <xiaoyao.li@xxxxxxxxx> wrote: > > On 6/11/2022 1:11 AM, Jue Wang wrote: > ... > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 4790f0d7d40b..a08693808729 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -4772,6 +4772,8 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu, > > /* Init IA32_MCi_CTL to all 1s */ > > for (bank = 0; bank < bank_num; bank++) > > vcpu->arch.mce_banks[bank*4] = ~(u64)0; > > + vcpu->arch.apic->nr_lvt_entries = > > + KVM_APIC_MAX_NR_LVT_ENTRIES - !(mcg_cap & MCG_CMCI_P); > > vcpu->arch.apic->nr_lvt_entries needs to be initialized as > KVM_APIC_MAX_NR_LVT_ENTREIS - 1 when creating lapic. > > What if userspace doesn't call KVM_X86_SETUP_MCE at all? Good catch. Paolo / Sean, should another patch be sent to fix this or do you recommend some other means to address the nr_lvt_entries initialization issue that Xiaoyao pointed out? Thanks a lot, -Jue > > > > > static_call(kvm_x86_setup_mce)(vcpu); > > out: >