Revert "KVM: LAPIC: Recalculate apic map in batch"
PATCH 1/1 Revert "KVM: LAPIC: Recalculate apic map in batch"
Guest fails to online hotplugged CPU with error
smpboot: do_boot_cpu failed(-1) to wakeup CPU#4
It's caused by the fact that kvm_apic_set_state(), which used to call recalculate_apic_map() unconditionally and pulled hotplugged CPU into apic map, is updating map conditionally on state change which doesn't happen in this case and apic map update is skipped.
Also subj commit introduces a race which can make apic map update events loss, in case one CPU is already in process of updating apic map and another CPU flags map as dirty asking for another update. But the first CPU will clear update request set by another CPU when update in progress is finished.
CPU1 kvm_recalculate_apic_map()
.. updating
CPU2 apic_map_dirty = true
CPU1 apic_map_dirty = false
CPU2 kvm_recalculate_apic_map()
nop due to apic_map_dirty == false
This reverts commit 4abaffce4d25aa41392d2e81835592726d757857.
--- arch/x86/include/asm/kvm_host.h | 1 - arch/x86/kvm/lapic.h | 1 - arch/x86/kvm/lapic.c | 46 +++++++-------------------------- arch/x86/kvm/x86.c | 1 - 4 files changed, 10 insertions(+), 39 deletions(-)
arch/x86/include/asm/kvm_host.h +0 -1
@@ -943,7 +943,6 @@ struct kvm_arch {atomic_t vapics_in_nmi_mode;struct mutex apic_map_lock;struct kvm_apic_map *apic_map; -bool apic_map_dirty;bool apic_access_page_done;unsigned long apicv_inhibit_reasons;
arch/x86/kvm/lapic.h +0 -1
@@ -81,7 +81,6 @@ void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8);void kvm_lapic_set_eoi (struct kvm_vcpu *vcpu);void kvm_lapic_set_base (struct kvm_vcpu *vcpu,u64 value);u64 kvm_lapic_get_base (struct kvm_vcpu *vcpu); -void kvm_recalculate_apic_map (struct kvm *kvm);void kvm_apic_set_version (struct kvm_vcpu *vcpu);int kvm_lapic_reg_write (struct kvm_lapic *apic,u32 reg,u32 val); int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
arch/x86/kvm/lapic.c +10 -36
132 lines not on this page · raw message
arch/x86/kvm/x86.c +0 -1
@@ -374,7 +374,6 @@ int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info) }kvm_lapic_set_base (vcpu, msr_info->data); -kvm_recalculate_apic_map (vcpu->kvm);return 0 ; }EXPORT_SYMBOL_GPL (kvm_set_apic_base);
Signature · 1 line
2.26.2