[panic]: recursed on non-recursive mutex pmap

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Thu, 27 Apr 2006 19:08:17 +0300
With today current, running inside qemu with config GENERIC + options QUOTA,
I get the panic while kernel tries to exec init:

panic: _mtx_lock_sleep: resursed on non-recursive mutex pmap _at_ /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1843

Backtrace:
#26 0xc070066e in panic (
    fmt=0xc099b9ca "_mtx_lock_sleep: recursed on non-recursive mutex %s _at_ %s:%d\n") at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_shutdown.c:549
#27 0xc06f5826 in _mtx_lock_sleep (m=0xc0b0a500, tid=3240063840, opts=0, 
    file=0x20004b07 <Address 0x20004b07 out of bounds>, line=536890119)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_mutex.c:463
#28 0xc06f53b8 in _mtx_lock_flags (m=0xc0b0a500, opts=0, 
    file=0xc09c433e "/usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c", line=1843) at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_mutex.c:286
#29 0xc0916cd3 in pmap_remove (pmap=0xc0b0a500, sva=3321208832, eva=3321212928)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1843
#30 0xc08a190c in vm_map_delete (map=0xc1069000, start=3238432768, 
    end=3321212928)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_map.c:2286
#31 0xc08a19d5 in vm_map_remove (map=0xc1069000, start=3321208832, 
    end=3321212928)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_map.c:2315
#32 0xc089dda2 in kmem_free (map=0x20004b07, addr=536890119, size=4096)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_kern.c:209
#33 0xc091650b in free_pv_entry (pmap=0xc0b0a500, pv=0x20004b07)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1609
#34 0xc0916936 in pmap_remove_entry (pmap=0xc0b0a500, m=0xc117d1f8, 
    va=3308380160)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1726
#35 0xc0916b83 in pmap_remove_pte (pmap=0xc0b0a500, ptq=0xc117d1f8, 
    va=3308380160)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1797
#36 0xc0916da8 in pmap_remove (pmap=0xc0b0a500, sva=3308380160, eva=3308388352)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1905
#37 0xc08a190c in vm_map_delete (map=0xc1069348, start=3238433608, 
    end=3308388352)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_map.c:2286
#38 0xc089e57b in kmem_free_wakeup (map=0xc1069348, addr=3308118016, 
    size=536890119)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_kern.c:467
#39 0xc06e188a in exec_free_args (args=0xc588ec7c)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:1039
#40 0xc06e102e in do_execve (td=0xc11f7360, args=0xc588ec7c, mac_p=0x0)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:780
#41 0xc06e032f in kern_execve (td=0xc11f7360, args=0xc588ec7c, 
    mac_p=0x20004b07)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:252
#42 0xc06e024c in execve (td=0x20004b07, uap=0xc0a5a840)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:186
#43 0xc06caf9e in start_init (dummy=0x0)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/init_main.c:625
#44 0xc06e5703 in fork_exit (callout=0xc06cacc0 <start_init>, arg=0x20004b07, 
    frame=0x20004b07)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_fork.c:819
#45 0xc090306c in fork_trampoline ()
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/exception.s:199

The problem appears because free_pv_entry decided to free pv_chunk
when pmap is kernel_pmap. I added the bandaid to be able to
continue my work, but hope for proper fix from vm gurus.

Index: sys/i386/i386/pmap.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/sys/i386/i386/pmap.c,v
retrieving revision 1.551
diff -u -r1.551 pmap.c
--- sys/i386/i386/pmap.c	27 Apr 2006 05:02:21 -0000	1.551
+++ sys/i386/i386/pmap.c	27 Apr 2006 16:05:44 -0000
_at__at_ -1595,6 +1595,8 _at__at_
 	for (idx = 0; idx < _NPCM; idx++)
 		if (pc->pc_map[idx] != pc_freemask[idx])
 			return;
+	if (pmap == kernel_map->pmap)
+		return;
 	PV_STAT(pv_entry_spare -= _NPCPV);
 	PV_STAT(pc_chunk_count--);
 	PV_STAT(pc_chunk_frees++);

Received on Thu Apr 27 2006 - 14:08:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:55 UTC