linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Yanok <yanok@emcraft.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, wd@denx.de, dzu@denx.de,
	Ilya Yanok <yanok@emcraft.com>
Subject: Re: [PATCH] powerpc: rework dma-noncoherent to use generic vmap/vunmap functions
Date: Thu, 12 Feb 2009 20:40:14 +0300	[thread overview]
Message-ID: <49945EFE.8000401@emcraft.com> (raw)
In-Reply-To: <1233722625.16867.249.camel@pasglop>

Hi Ben,

excuse me for so long time to reply.

Benjamin Herrenschmidt wrote:
>> This patch rewrites consistent dma allocations support to use vmalloc
>> layer to allocate virtual memory space from vmalloc pool and get rid
>> of CONFIG_CONSISTENT_{START,SIZE}.
>>     
>
> So as commented before, please drop the defconfig updates.
>   

Ok.

>> -/*
>>   * Allocate DMA-coherent memory space and return both the kernel remapped
>>   * virtual and bus address for that space.
>>   */
>> @@ -151,19 +41,17 @@ void *
>>  __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
>>  {
>>  	struct page *page;
>> -	struct vm_region *c;
>>  	unsigned long order;
>> +	void *v;
>> +	int i;
>> +	struct page *pages[PAGE_ALIGN(size)>>PAGE_SHIFT];
>>     
>
> I'm not -too- fan of that page list one the stack up there.
>
> I understand why you don't wantto kmalloc something here etc... but
> that's what __vmalloc_area() does and it's somewhat useful to keep track
> of the page array that way, it might prove handy in the future.
>   

I don't like array being on stack too... But I fear I didn't understand
what were you talking about here...
__vmalloc_area does kmalloc or vmalloc to allocate pages array and then
allocates pages one by one but we need physically contiguous pages
here... (And that is why we don't really need to store pages array)
So I just added kmalloc/vmalloc to allocate the pages array and stored
it in vm_struct structure.

> Might even be worth adding a generic patch to add a VM_COHERENT_DMA flag
> so they can be listed as such and make sure you set the "caller" field
> yourself with your own caller.
>   
I used __builtin_return_address(1) as the 'caller' so I get useful
output in /proc/vmallocinfo (btw, ioremap doesn't provide useful 'caller').
Do you think we have high chances of such a patch being accepted in
lkml? Well, I'll try to do this (for now I stick with VM_IOREMAP).

> (Hint: look at the output of /proc/vmallocinfo)
>
> Also, the mucking around with PG_Reserved shouldn't be of any use
> anymore.
>   
Ok, removed.

Please review the updated patch (I'll post it as a followup).

Regards, Ilya.

  reply	other threads:[~2009-02-12 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 12:58 [PATCH] powerpc: rework dma-noncoherent to use generic vmap/vunmap functions Ilya Yanok
2009-01-10 23:30 ` Benjamin Herrenschmidt
2009-01-11  0:31 ` Grant Likely
2009-01-12  0:47   ` Josh Boyer
2009-02-04  4:43 ` Benjamin Herrenschmidt
2009-02-12 17:40   ` Ilya Yanok [this message]
2009-02-12 20:41     ` Benjamin Herrenschmidt
2009-02-12 21:03       ` Ilya Yanok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49945EFE.8000401@emcraft.com \
    --to=yanok@emcraft.com \
    --cc=benh@kernel.crashing.org \
    --cc=dzu@denx.de \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).