Commit af28dfac authored by Igor Mammedov's avatar Igor Mammedov Committed by Paolo Bonzini
Browse files

kvm: lapic: fix broken vcpu hotplug

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 changes.  In this case
the APIC map is not considered dirty and the is not updated.

Fix the issue by forcing unconditional update from kvm_apic_set_state(),
like it used to be.

Fixes: 4abaffce

 ("KVM: LAPIC: Recalculate apic map in batch")
Signed-off-by: default avatarIgor Mammedov <>
Message-Id: <>
Signed-off-by: default avatarPaolo Bonzini <>
parent 49097762
......@@ -2567,6 +2567,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
memcpy(vcpu->arch.apic->regs, s->regs, sizeof(*s));
apic->vcpu->kvm->arch.apic_map_dirty = true;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment