Module Name:    src
Committed By:   mrg
Date:           Thu Dec 21 09:09:43 UTC 2023

Modified Files:
        src/sys/arch/vax/vax: pmap.c

Log Message:
fix locking botch: use mutex_spin_exit(), not _exit(), for PMAP_UNLOCK.

fixes LOCKDEBUG issue in first attempt to unlock it.

also call PMAP_UNLOCK in one non-fatal out of memory case.

XXX: pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/vax/vax/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.198 src/sys/arch/vax/vax/pmap.c:1.199
--- src/sys/arch/vax/vax/pmap.c:1.198	Tue Oct 17 10:22:07 2023
+++ src/sys/arch/vax/vax/pmap.c	Thu Dec 21 09:09:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $	   */
+/*	$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -161,7 +161,7 @@ ptpinuse(void *pte)
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 static kmutex_t pmap_lock;
 #define PMAP_LOCK	mutex_spin_enter(&pmap_lock);
-#define PMAP_UNLOCK	mutex_spin_enter(&pmap_lock);
+#define PMAP_UNLOCK	mutex_spin_exit(&pmap_lock);
 #else
 #define PMAP_LOCK
 #define PMAP_UNLOCK
@@ -1196,6 +1196,7 @@ pmap_enter(pmap_t pmap, vaddr_t v, paddr
 	return 0;
 
 growfail:
+	PMAP_UNLOCK;
 	if (flags & PMAP_CANFAIL)
 		return ENOMEM;
 	panic("usrptmap space leakage");

Reply via email to