KVM: x86: make vapics_in_nmi_mode atomic
Writes were a bit racy, but hard to turn into a bug at the same time. (Particularly because modern Linux doesn't use this feature anymore.) Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> [Actually the next patch makes it much, much easier to trigger the race so I'm including this one for stable@ as well. - Paolo] Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:

committed by
Paolo Bonzini

parent
2ecd9d29ab
commit
42720138b0
@@ -1263,10 +1263,10 @@ static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val)
|
||||
if (!nmi_wd_enabled) {
|
||||
apic_debug("Receive NMI setting on APIC_LVT0 "
|
||||
"for cpu %d\n", apic->vcpu->vcpu_id);
|
||||
apic->vcpu->kvm->arch.vapics_in_nmi_mode++;
|
||||
atomic_inc(&apic->vcpu->kvm->arch.vapics_in_nmi_mode);
|
||||
}
|
||||
} else if (nmi_wd_enabled)
|
||||
apic->vcpu->kvm->arch.vapics_in_nmi_mode--;
|
||||
atomic_dec(&apic->vcpu->kvm->arch.vapics_in_nmi_mode);
|
||||
}
|
||||
|
||||
static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
|
||||
|
Reference in New Issue
Block a user