Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2002 04:27:28 -0700 (PDT)
From:      Don Lewis <dl-freebsd@catspoiler.org>
To:        jhb@FreeBSD.org
Cc:        current@FreeBSD.org, jake@FreeBSD.org, arr@FreeBSD.org
Subject:   Re: /usr/src/sys/vm/uma_core.c:1332: could sleep with "kernel li
Message-ID:  <200207101127.g6ABRSwr007009@gw.catspoiler.org>
In-Reply-To: <XFMail.20020709080521.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On  9 Jul, John Baldwin wrote:
> 
> On 09-Jul-2002 Don Lewis wrote:
>> I recently started seeing the warning message:
>> 
>> /usr/src/sys/vm/uma_core.c:1332: could sleep with "kernel linker" locked
>> from /usr/src/sys/kern/kern_linker.c:1797
>> 
>> at boot time on my -current box.  It appears to be related to the
>> changes in rev 1.90 of kern_linker.c.
> 
> Turn on witness_ddb (set debug.witness_ddb to 1 in either the loader or
> via sysctl) and get a 'tr' from ddb to see the codepath in question.  You
> can then 'c' continue to get back to running.  You might want to do
> 'w witness_ddb 0' to keep from dropping back into ddb all the time before
> continuing.

This problem is easily reproducable by just running "sysctl -a".

Here's the stack trace:

witness_sleep()
uma_zalloc_arg()
vm_map_entry_create()
vm_map_clip_start()
vm_map_wire()
vslock()
sysctl_old_user()
sysctl_kern_function_list_iterate()
link_elf_each_function_name()
sysctl_kern_function_list()
...

The only fix I can think of is to do something like:

	grab the lock
	
	walk the list, counting the number of bytes the data occupies
	
	unlock
	
retry:
	allocate a temporary buffer
	
	grab the lock
	
	walk the list, copying the data the data to the temporary buffer,
	halting the copy on overflow, but calculating the new size

	unlock

	if the buffer overflowed, free the buffer and goto retry

	copy the temporary buffer to user space

	free the buffer

I suppose this could be simplified a bit by pretending to have a zero
sized buffer and starting at the retry label, but in any case it sure
is ugly.
	



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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