Use spinlocks to lock accesses to the vioapic.

This is necessary because if the vlapic is configured in x2apic mode the
vioapic_process_eoi() function is called inside the critical section
established by vm_run().
This commit is contained in:
Neel Natu 2014-02-17 22:57:51 +00:00
parent 5efaea4cc6
commit 9c43cd07ec

View File

@ -64,8 +64,8 @@ struct vioapic {
} rtbl[REDIR_ENTRIES];
};
#define VIOAPIC_LOCK(vioapic) mtx_lock(&((vioapic)->mtx))
#define VIOAPIC_UNLOCK(vioapic) mtx_unlock(&((vioapic)->mtx))
#define VIOAPIC_LOCK(vioapic) mtx_lock_spin(&((vioapic)->mtx))
#define VIOAPIC_UNLOCK(vioapic) mtx_unlock_spin(&((vioapic)->mtx))
#define VIOAPIC_LOCKED(vioapic) mtx_owned(&((vioapic)->mtx))
static MALLOC_DEFINE(M_VIOAPIC, "vioapic", "bhyve virtual ioapic");
@ -476,7 +476,7 @@ vioapic_init(struct vm *vm)
vioapic = malloc(sizeof(struct vioapic), M_VIOAPIC, M_WAITOK | M_ZERO);
vioapic->vm = vm;
mtx_init(&vioapic->mtx, "vioapic lock", NULL, MTX_DEF);
mtx_init(&vioapic->mtx, "vioapic lock", NULL, MTX_SPIN);
/* Initialize all redirection entries to mask all interrupts */
for (i = 0; i < REDIR_ENTRIES; i++)