Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2009 18:11:53 +0100
From:      =?UTF-8?Q?Nikola_Kne=C5=BEevi=C4=87?= <laladelausanne@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   blockable sleep lock (sleep mutex) 16
Message-ID:  <02026848-7F83-405C-B4F3-EDD8B47DA294@gmail.com>

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

I'm trying to port Click modular router to FreeBSD 7.1, but with a  
twist. Instead of letting Click run in netisr (as it used to run in  
FreeBSD 4), I want to have it running in a kthread. I managed to get  
it running this way, but when I turn on INVARIANTS and WITNESS (along  
with WITNESS_SKIPSPIN), I get coredumps when I'm trying to install a  
new configuration...

Here is the trace:
---8<---
(kgdb) bt
#0  doadump () at pcpu.h:195
#1  0xffffffff8049ef98 in boot (howto=260) at /usr/src/sys/kern/ 
kern_shutdown.c:418
#2  0xffffffff8049f429 in panic (fmt=Variable "fmt" is not available.
) at /usr/src/sys/kern/kern_shutdown.c:574
#3  0xffffffff804d941c in witness_checkorder (lock=0xffffff0007fdfc50,  
flags=Variable "flags" is not available.
) at /usr/src/sys/kern/subr_witness.c:877
#4  0xffffffff80493769 in _mtx_lock_flags (m=0xffffff0007fdfc50,  
opts=0, file=0xffffffff8085536f "/usr/src/sys/vm/uma_core.c",
     line=1834) at /usr/src/sys/kern/kern_mutex.c:183
#5  0xffffffff806a6aab in uma_zalloc_arg (zone=0xffffff0007fde9c0,  
udata=0x0, flags=2) at /usr/src/sys/vm/uma_core.c:1834
#6  0xffffffff804908c6 in malloc (size=Variable "size" is not available.
) at uma.h:277
#7  0xffffffff877579bd in operator new[] (sz=Variable "sz" is not  
available.
) at /home/knl/work/mx/click/bsdmodule/..//lib/glue.cc:285
#8  0xffffffff877856d3 in ?? ()
#9  0xffffffff8785d540 in ?? ()
#10 0xffffffff8785d610 in ?? ()
#11 0x0000000000000000 in ?? ()
#12 0xffffff0001353300 in ?? ()
#13 0xffffffff8785d580 in ?? ()
#14 0xffffffff87777afa in Click::ClickInstance::element_hindexes  
(this=0x4, result=@0xffffffff8785d610) at vector.hh:96
Previous frame identical to this frame (corrupt stack?)
--->8---

This is the message buffer:
Unread portion of the kernel message buffer:
panic: blockable sleep lock (sleep mutex) 16 @ /usr/src/sys/vm/ 
uma_core.c:1834
cpuid = 0
Uptime: 24m35s
Physical memory: 114 MB
Dumping 42 MB: 27 11


Any hints where I should search for the cause?

I'm using MTX_DEF mutexes to protect data structures. Click exports  
its own FS, where each element (part of the router) has its own files.  
Each file has coresponding function which is responsible for input/ 
output of the data. So, when I want to create a new router, I write to  
file named "config". Then, function named write_config takes over,  
starts the Lexer, which in turns produces elements, which then export  
their representations in the VFS. All of this happens in the  
clickfs_close (creation starts when file is closed).

If I read the code correctly, vn_closefile locks the Giant, so that  
may cause problems...

Cheers,
N.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?02026848-7F83-405C-B4F3-EDD8B47DA294>