Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2006 19:08:17 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        freebsd-current@freebsd.org
Subject:   [panic]: recursed on non-recursive mutex pmap
Message-ID:  <20060427160817.GA1268@deviant.kiev.zoral.com.ua>

next in thread | raw e-mail | index | archive | help

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 @ /usr/home/ko=
stik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1843

Backtrace:
#26 0xc070066e in panic (
    fmt=3D0xc099b9ca "_mtx_lock_sleep: recursed on non-recursive mutex %s @=
 %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=3D0xc0b0a500, tid=3D3240063840, opts=
=3D0,=20
    file=3D0x20004b07 <Address 0x20004b07 out of bounds>, line=3D536890119)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_mutex.c:463
#28 0xc06f53b8 in _mtx_lock_flags (m=3D0xc0b0a500, opts=3D0,=20
    file=3D0xc09c433e "/usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/=
pmap.c", line=3D1843) at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/ker=
n_mutex.c:286
#29 0xc0916cd3 in pmap_remove (pmap=3D0xc0b0a500, sva=3D3321208832, eva=3D3=
321212928)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1843
#30 0xc08a190c in vm_map_delete (map=3D0xc1069000, start=3D3238432768,=20
    end=3D3321212928)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_map.c:2286
#31 0xc08a19d5 in vm_map_remove (map=3D0xc1069000, start=3D3321208832,=20
    end=3D3321212928)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_map.c:2315
#32 0xc089dda2 in kmem_free (map=3D0x20004b07, addr=3D536890119, size=3D409=
6)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_kern.c:209
#33 0xc091650b in free_pv_entry (pmap=3D0xc0b0a500, pv=3D0x20004b07)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1609
#34 0xc0916936 in pmap_remove_entry (pmap=3D0xc0b0a500, m=3D0xc117d1f8,=20
    va=3D3308380160)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1726
#35 0xc0916b83 in pmap_remove_pte (pmap=3D0xc0b0a500, ptq=3D0xc117d1f8,=20
    va=3D3308380160)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1797
#36 0xc0916da8 in pmap_remove (pmap=3D0xc0b0a500, sva=3D3308380160, eva=3D3=
308388352)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/i386/i386/pmap.c:1905
#37 0xc08a190c in vm_map_delete (map=3D0xc1069348, start=3D3238433608,=20
    end=3D3308388352)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_map.c:2286
#38 0xc089e57b in kmem_free_wakeup (map=3D0xc1069348, addr=3D3308118016,=20
    size=3D536890119)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/vm/vm_kern.c:467
#39 0xc06e188a in exec_free_args (args=3D0xc588ec7c)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:1039
#40 0xc06e102e in do_execve (td=3D0xc11f7360, args=3D0xc588ec7c, mac_p=3D0x=
0)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:780
#41 0xc06e032f in kern_execve (td=3D0xc11f7360, args=3D0xc588ec7c,=20
    mac_p=3D0x20004b07)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:252
#42 0xc06e024c in execve (td=3D0x20004b07, uap=3D0xc0a5a840)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/kern_exec.c:186
#43 0xc06caf9e in start_init (dummy=3D0x0)
    at /usr/home/kostik/build/bsd/6/src-misc/sys/kern/init_main.c:625
#44 0xc06e5703 in fork_exit (callout=3D0xc06cacc0 <start_init>, arg=3D0x200=
04b07,=20
    frame=3D0x20004b07)
    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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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
@@ -1595,6 +1595,8 @@
 	for (idx =3D 0; idx < _NPCM; idx++)
 		if (pc->pc_map[idx] !=3D pc_freemask[idx])
 			return;
+	if (pmap =3D=3D kernel_map->pmap)
+		return;
 	PV_STAT(pv_entry_spare -=3D _NPCPV);
 	PV_STAT(pc_chunk_count--);
 	PV_STAT(pc_chunk_frees++);

--DocE+STaALJfprDB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)

iD8DBQFEUOxwC3+MBN1Mb4gRAobnAKCnsVZfxNlmuexEKLggLSwR6bXJiACZAXI+
+fzx6XB6qf74Lcwzj5rKa0I=
=m2m7
-----END PGP SIGNATURE-----

--DocE+STaALJfprDB--



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