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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to