Subject: Re: lock bug in getnewvnode, or uvm_km_kmemalloc/uvm_map ?
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Chris Gilbert <chris@dokein.co.uk>
List: tech-kern
Date: 11/19/2002 22:13:17
On Tue, 19 Nov 2002 20:38:00 +0100
Manuel Bouyer <bouyer@antioche.eu.org> wrote:

> On Tue, Nov 19, 2002 at 07:54:54PM +0100, Frank van der Linden wrote:
> > On Tue, Nov 19, 2002 at 03:46:41PM +0100, Manuel Bouyer wrote:
> > > getnewvnode() (the simple_lock is grabbed in getnewvnode)
> > > pool_get(PR_NOWAIT)
> > > pool_allocator_alloc()
> > > pool_page_alloc_nointr()
> > > uvm_km_alloc_poolpage1()
> > > uvm_km_kmemalloc()
> > > uvm_map()
> > > pool_get(PR_WAITOK)
> > 
> > I remember posting about this a while ago to this list, and
> > proposing a fix. Chuq at that time told me the fix was okay, but I
> > never did implement it.
> 
> I was on 08/05/2002:
> http://mail-index.netbsd.org/tech-kern/2002/08/05/0001.html
> 
> I though doing it too. uvm_km_kmemalloc() has the info, it just needs
> to pass it to uvm_map(), and from here to uvm_mapent_alloc(). It's not
> hard.
> But I didn't know if there are other places where uvm_map() may sleep.
> There is at last one, in vm_map_lock() if I trust the comment. We can
> probably always pass UVM_FLAG_TRYLOCK for the nowait case.
> Is pmap_growkernel() allowed to sleep ?

I don't think pmap_growkernel can sleep, the man page also says if it
can't get the resources it should panic.  Certainly on arm32 if it fails
to get memory it panic's.

Chris