summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-02-17 22:57:51 +0000
committerneel <neel@FreeBSD.org>2014-02-17 22:57:51 +0000
commit19c649a6fb24e7fb22f37c91a01a443df9e080fb (patch)
tree6fb5674099c1f23b57631cb5e286df5c14222ac4
parent73e479882993de792ed571ea4d1265cfab1c34a8 (diff)
downloadFreeBSD-src-19c649a6fb24e7fb22f37c91a01a443df9e080fb.zip
FreeBSD-src-19c649a6fb24e7fb22f37c91a01a443df9e080fb.tar.gz
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().
-rw-r--r--sys/amd64/vmm/io/vioapic.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/amd64/vmm/io/vioapic.c b/sys/amd64/vmm/io/vioapic.c
index 703e479..411887d 100644
--- a/sys/amd64/vmm/io/vioapic.c
+++ b/sys/amd64/vmm/io/vioapic.c
@@ -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++)
OpenPOWER on IntegriCloud