On 23/06/20 13:13, Igor Mammedov wrote: >>> + apic->vcpu->kvm->arch.apic_map_dirty = true; >>> kvm_lapic_set_base(vcpu, vcpu->arch.apic_base); >>> /* set SPIV separately to get count of SW disabled APICs right */ >>> apic_set_spiv(apic, *((u32 *)(s->regs + APIC_SPIV))); >>> >> Queued, but it's better to set apic_map_dirty just before the call to >> kvm_recalculate_apic_map, or you can have a variant of the race that you >> pointed out. > Here I was worried about failure path as well that is just before normal > kvm_recalculate_apic_map(), and has its own kvm_recalculate_apic_map(). > > but I'm not sure if we should force map update in that case. > In that case kvm_lapic_set_base and apic_set_spiv will take care of it (and if it kvm_apic_state_fixup writes LDR, it succeeds and you go down the other path). Paolo