Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Feb 2014 22:57:52 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262139 - head/sys/amd64/vmm/io
Message-ID:  <201402172257.s1HMvq4C093839@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Mon Feb 17 22:57:51 2014
New Revision: 262139
URL: http://svnweb.freebsd.org/changeset/base/262139

Log:
  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().

Modified:
  head/sys/amd64/vmm/io/vioapic.c

Modified: head/sys/amd64/vmm/io/vioapic.c
==============================================================================
--- head/sys/amd64/vmm/io/vioapic.c	Mon Feb 17 22:43:07 2014	(r262138)
+++ head/sys/amd64/vmm/io/vioapic.c	Mon Feb 17 22:57:51 2014	(r262139)
@@ -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++)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402172257.s1HMvq4C093839>