summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-07-02 12:25:51 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-07-02 12:25:51 +0000
commit51ab8bdeae88959d96bd3926fc7951630cb79813 (patch)
treea2afc1a5911b42bcad6fdc690ac9f0507185b461
parent4eb548238f91ec4f48d5b99eaf76c43e79630a3e (diff)
Kludge to not get locked threads with UVM, XXX
-rw-r--r--sys/arch/i386/i386/pmap.c20
-rw-r--r--sys/arch/i386/i386/pmap.old.c20
2 files changed, 36 insertions, 4 deletions
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index 00e567f86b9..87928d9caad 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.29 1999/06/04 16:37:48 mickey Exp $ */
+/* $OpenBSD: pmap.c,v 1.30 1999/07/02 12:25:50 niklas Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
@@ -1228,7 +1228,23 @@ pmap_enter(pmap, va, pa, prot, wired)
if (rv != KERN_SUCCESS)
panic("ptdi2 %x", pmap->pm_pdir[PTDPTDI]);
#if defined(UVM)
- uvm_map_pageable(vmap, v, round_page(v+1), FALSE);
+ /*
+ * XXX It is possible to get here from uvm_fault with vmap
+ * locked. uvm_map_pageable requires it to be unlocked, so
+ * try to record the state of the lock, unlock it, and then
+ * after the call, reacquire the original lock.
+ * THIS IS A GROSS HACK!
+ */
+ {
+ int ls = lockstatus(&vmap->lock);
+
+ if (ls)
+ lockmgr(&vmap->lock, LK_RELEASE, (void *)0,
+ curproc);
+ uvm_map_pageable(vmap, v, round_page(v+1), FALSE);
+ if (ls)
+ lockmgr(&vmap->lock, ls, (void *)0, curproc);
+ }
#else
vm_map_pageable(vmap, v, round_page(v+1), FALSE);
#endif
diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c
index fb300360e20..bfd7f719470 100644
--- a/sys/arch/i386/i386/pmap.old.c
+++ b/sys/arch/i386/i386/pmap.old.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.old.c,v 1.29 1999/06/04 16:37:48 mickey Exp $ */
+/* $OpenBSD: pmap.old.c,v 1.30 1999/07/02 12:25:50 niklas Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
@@ -1228,7 +1228,23 @@ pmap_enter(pmap, va, pa, prot, wired)
if (rv != KERN_SUCCESS)
panic("ptdi2 %x", pmap->pm_pdir[PTDPTDI]);
#if defined(UVM)
- uvm_map_pageable(vmap, v, round_page(v+1), FALSE);
+ /*
+ * XXX It is possible to get here from uvm_fault with vmap
+ * locked. uvm_map_pageable requires it to be unlocked, so
+ * try to record the state of the lock, unlock it, and then
+ * after the call, reacquire the original lock.
+ * THIS IS A GROSS HACK!
+ */
+ {
+ int ls = lockstatus(&vmap->lock);
+
+ if (ls)
+ lockmgr(&vmap->lock, LK_RELEASE, (void *)0,
+ curproc);
+ uvm_map_pageable(vmap, v, round_page(v+1), FALSE);
+ if (ls)
+ lockmgr(&vmap->lock, ls, (void *)0, curproc);
+ }
#else
vm_map_pageable(vmap, v, round_page(v+1), FALSE);
#endif