Re: [PATCH,RFC] Add gfp_mask to get_vm_area()

From: David Gibson (david@gibson.dropbear.id.au)
Date: Tue Oct 01 2002 - 00:34:17 EST


On Mon, Sep 30, 2002 at 10:08:00PM -0700, Andrew Morton wrote:
>
> David Gibson wrote:
> >
> > Dave, please consider this patch. It renames get_vm_area() to
> > __get_vm_area() and adds a gfp_mask parameter which is passed on to
> > kmalloc(). get_vm_area(size,flags) is then defined as as
> > __get_vm_area(size,flags,GFP_KERNEL) to avoid messing with existing
> > callers.
> >
> > We need this in order to sanely make pci_alloc_consistent() (and other
> > consistent allocation functions) obey the DMA-mapping.txt rules on PPC
> > embedded machines (specifically the requirement that it be callable
> > from interrupt context).
> >
>
> I can look after that for you. But I'd prefer that you just add the
> extra gfp_flags argument to get_vm_area() and update the 16 callers.
>
> You cannot call get_vm_area() from interrupt context at present;
> it does write_lock(&vmlist_lock) unsafely.

Oh crap, I'm an idiot. I've even seen prototype patches for this one
that changed the write_lock() to write_lock_irq(). Duh.

> It would be a bit sad to make vmlist_lock interrupt-safe for this. Is
> there no alternative?

I don't see an easy one: PPC 4xx has non-coherent cache, so we have to
mark consistent memory non-cacheable. We want to make the normal
lowmem mapping use large page TLB entries, so we can't frob the
attribute bits on the pages in place. That means we need to create a
new, non-cacheable mapping for the physical RAM we allocate, which in
turn means allocating a chunk of kernel virtual memory.

> (And what the hell is arch/alpha/mm/init.c:callback_init() doing rewriting
> vmlist? Somebody shoot that code)

-- 
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:25 EST