Subject: Re: kern/28897: reproducible diagnostic assertion failure in
To: None <dlagno@smtp.ru>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 01/12/2005 11:36:07
--NextPart-20050112110535-0120400
Content-Type: Text/Plain; charset=us-ascii

> >Synopsis:       reproducible diagnostic assertion failure in kern_synch.c

> This panic is pretty reproducible on my laptop.

can you try the attached patch?  thanks.

YAMAMOTO Takashi

--NextPart-20050112110535-0120400
Content-Type: Text/Plain; charset=us-ascii
Content-Disposition: attachment; filename="a.diff"

Index: uvm_km.c
===================================================================
--- uvm_km.c	(revision 1021)
+++ uvm_km.c	(working copy)
@@ -223,7 +223,7 @@ km_vacache_free(struct pool *pp, void *v
 	}
 #endif
 	map = KM_VACACHE_POOL_TO_MAP(pp);
-	uvm_unmap(map, va, va + size);
+	uvm_unmap1(map, va, va + size, UVM_FLAG_QUANTUM);
 }
 
 /*
@@ -583,7 +583,8 @@ uvm_km_kmemalloc1(map, obj, size, align,
 			if ((flags & UVM_KMF_NOWAIT) ||
 			    ((flags & UVM_KMF_CANFAIL) && uvm_swapisfull())) {
 				/* free everything! */
-				uvm_unmap(map, kva, kva + size);
+				uvm_unmap1(map, kva, kva + size,
+				    UVM_FLAG_QUANTUM);
 				return (0);
 			} else {
 				uvm_wait("km_getwait2");	/* sleep here */
@@ -624,7 +625,8 @@ uvm_km_free(map, addr, size)
 	vaddr_t addr;
 	vsize_t size;
 {
-	uvm_unmap(map, trunc_page(addr), round_page(addr+size));
+	uvm_unmap1(map, trunc_page(addr), round_page(addr+size),
+	    UVM_FLAG_QUANTUM);
 }
 
 /*
Index: uvm_map.c
===================================================================
--- uvm_map.c	(revision 1018)
+++ uvm_map.c	(working copy)
@@ -4287,6 +4287,9 @@ uvm_mapent_reserve(struct vm_map *map, s
 
 	umr->umr_nentries = 0;
 
+	if ((flags & UVM_FLAG_QUANTUM) != 0)
+		return 0;
+
 	if (!VM_MAP_USE_KMAPENT(map))
 		return 0;
 
Index: uvm_map.h
===================================================================
--- uvm_map.h	(revision 1011)
+++ uvm_map.h	(working copy)
@@ -354,7 +354,8 @@ struct vm_map_kernel *
 int		uvm_map_submap(struct vm_map *, vaddr_t, vaddr_t,
 		    struct vm_map *);
 MAP_INLINE
-void		uvm_unmap(struct vm_map *, vaddr_t, vaddr_t);
+void		uvm_unmap1(struct vm_map *, vaddr_t, vaddr_t, int);
+#define	uvm_unmap(map, s, e)	uvm_unmap1((map), (s), (e), 0)
 void		uvm_unmap_detach(struct vm_map_entry *,int);
 void		uvm_unmap_remove(struct vm_map *, vaddr_t, vaddr_t,
 		    struct vm_map_entry **, struct uvm_mapent_reservation *);
Index: uvm_map_i.h
===================================================================
--- uvm_map_i.h	(revision 1001)
+++ uvm_map_i.h	(working copy)
@@ -128,14 +128,15 @@ uvm_map_setup(struct vm_map *map, vaddr_
  */
 
 /*
- * uvm_unmap: remove mappings from a vm_map (from "start" up to "stop")
+ * uvm_unmap1: remove mappings from a vm_map (from "start" up to "stop")
  *
  * => caller must check alignment and size
  * => map must be unlocked (we will lock it)
+ * => flags is UVM_FLAG_QUANTUM or 0.
  */
 
 MAP_INLINE void
-uvm_unmap(struct vm_map *map, vaddr_t start, vaddr_t end)
+uvm_unmap1(struct vm_map *map, vaddr_t start, vaddr_t end, int flags)
 {
 	struct vm_map_entry *dead_entries;
 	struct uvm_mapent_reservation umr;
@@ -147,7 +148,7 @@ uvm_unmap(struct vm_map *map, vaddr_t st
 	 * work now done by helper functions.   wipe the pmap's and then
 	 * detach from the dead entries...
 	 */
-	uvm_mapent_reserve(map, &umr, 2, 0);
+	uvm_mapent_reserve(map, &umr, 2, flags);
 	vm_map_lock(map);
 	uvm_unmap_remove(map, start, end, &dead_entries, &umr);
 	vm_map_unlock(map);

--NextPart-20050112110535-0120400--