Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2000 16:43:30 -0400 (EDT)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: KLD, kernel threads, zone allocator
Message-ID:  <Pine.SOL.4.21.0007211640400.417-100000@sol.cs.binghamton.edu>
In-Reply-To: <Pine.SOL.4.21.0007171638430.14955-100000@sol.cs.binghamton.edu>

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

On Mon, 17 Jul 2000, Zhihui Zhang wrote:

> 
> I am writing a KLD that gives me kernel fault each time I run 'ps' command
> after 'make unload'.  The KLD has a system call to create several kernel
> threads by calling kthread_create(). During unload, I set flags to each
> threads so that they will call exit1() upon wakeup (sleep on a timeout).  
> Before the last thread calls exit1(), it wakeup the kld unload process so
> that make 'unload' can finish. Is there anything wrong or better
> solutions?
> 
> I also use vm_zone to allocate some data structes within the KLD. When
> unloading, I can use zfree() to free them except the zone header that I
> can not free(some_zone, M_ZONE).  This is because M_ZONE is defined as
> *static* in vm_zone.c I wonder if this will cause memory leak after
> several loading and unloading the KLD.
> 
> Finally, I want to know how to save the panic screen without hand writing
> it down.  Any info on debugging under db> after fault?
> 
> Any help is appreciated.

Thanks to those who have helped me privately.  It is not a good idea to
use zone allocator with KLD.  You must clear everything before unloading
the KLD. Any kernel threads can be reparented to initproc to avoid 'ps'
panic.

-Zhihui



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.21.0007211640400.417-100000>