linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ioremap and vmalloc
@ 2008-09-19 11:15 Sébastien Chrétien
  2008-09-19 13:49 ` Grant Likely
  0 siblings, 1 reply; 11+ messages in thread
From: Sébastien Chrétien @ 2008-09-19 11:15 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

Hello,

When I use ioremap, the second time, I obtain this message :

allocation failed: out of vmalloc space - use vmalloc=<size> to increase
size.
What can I do in order to fix this problem ?

[-- Attachment #2: Type: text/html, Size: 278 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 11:15 ioremap and vmalloc Sébastien Chrétien
@ 2008-09-19 13:49 ` Grant Likely
  2008-09-19 16:34   ` Sébastien Chrétien
  0 siblings, 1 reply; 11+ messages in thread
From: Grant Likely @ 2008-09-19 13:49 UTC (permalink / raw)
  To: =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_, ?=; +Cc: linuxppc-dev

On Fri, Sep 19, 2008 at 01:15:20PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
> Hello,
> 
> When I use ioremap, the second time, I obtain this message :
> 
> allocation failed: out of vmalloc space - use vmalloc=<size> to increase
> size.
> What can I do in order to fix this problem ?

How large are the regions that you are ioremapping?  The kernel sets
aside a fixed amount of the virtual address space for ioremaps, and if
you exhaust that then more ioremaps will stop working.

g.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 13:49 ` Grant Likely
@ 2008-09-19 16:34   ` Sébastien Chrétien
  2008-09-19 16:38     ` Josh Boyer
  2008-09-19 16:43     ` Grant Likely
  0 siblings, 2 replies; 11+ messages in thread
From: Sébastien Chrétien @ 2008-09-19 16:34 UTC (permalink / raw)
  To: linuxppc-dev

The first is ioremap(0x20000000,0x10000000);
The second is ioremap(0x80000000,0x10000000);
Is it too long

Grant Likely a écrit :
> On Fri, Sep 19, 2008 at 01:15:20PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
>   
>> Hello,
>>
>> When I use ioremap, the second time, I obtain this message :
>>
>> allocation failed: out of vmalloc space - use vmalloc=<size> to increase
>> size.
>> What can I do in order to fix this problem ?
>>     
>
> How large are the regions that you are ioremapping?  The kernel sets
> aside a fixed amount of the virtual address space for ioremaps, and if
> you exhaust that then more ioremaps will stop working.
>
> g.
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
>   

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:34   ` Sébastien Chrétien
@ 2008-09-19 16:38     ` Josh Boyer
  2008-09-19 16:45       ` Sébastien Chrétien
  2008-09-19 16:43     ` Grant Likely
  1 sibling, 1 reply; 11+ messages in thread
From: Josh Boyer @ 2008-09-19 16:38 UTC (permalink / raw)
  To: =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_, ?=; +Cc: linuxppc-dev

On Fri, Sep 19, 2008 at 06:34:06PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
> The first is ioremap(0x20000000,0x10000000);
> The second is ioremap(0x80000000,0x10000000);
> Is it too long

The error message you are getting should have been a very strong hint that
the answer is "yes."

josh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:34   ` Sébastien Chrétien
  2008-09-19 16:38     ` Josh Boyer
@ 2008-09-19 16:43     ` Grant Likely
  1 sibling, 0 replies; 11+ messages in thread
From: Grant Likely @ 2008-09-19 16:43 UTC (permalink / raw)
  To: sebastien.chretien.enseirb; +Cc: linuxppc-dev

On Fri, Sep 19, 2008 at 06:34:06PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
> The first is ioremap(0x20000000,0x10000000);
> The second is ioremap(0x80000000,0x10000000);
> Is it too long

Well, you're trying to allocate two 256MB regions.  That is very large.
What kind of device are you trying to map?

g.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:38     ` Josh Boyer
@ 2008-09-19 16:45       ` Sébastien Chrétien
  2008-09-19 16:58         ` Josh Boyer
  2008-09-22  5:28         ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 11+ messages in thread
From: Sébastien Chrétien @ 2008-09-19 16:45 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev

if I write :
ioremap(0x20000000,0x40000) and ioremap(0x20000000,0x50000)

Will it crash ?

Josh Boyer a écrit :
> On Fri, Sep 19, 2008 at 06:34:06PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
>   
>> The first is ioremap(0x20000000,0x10000000);
>> The second is ioremap(0x80000000,0x10000000);
>> Is it too long
>>     
>
> The error message you are getting should have been a very strong hint that
> the answer is "yes."
>
> josh
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
>   

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:45       ` Sébastien Chrétien
@ 2008-09-19 16:58         ` Josh Boyer
  2008-09-19 17:12           ` Grant Likely
  2008-09-19 17:52           ` Sébastien Chrétien
  2008-09-22  5:28         ` Benjamin Herrenschmidt
  1 sibling, 2 replies; 11+ messages in thread
From: Josh Boyer @ 2008-09-19 16:58 UTC (permalink / raw)
  To: chretien; +Cc: linuxppc-dev

On Fri, Sep 19, 2008 at 06:45:01PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
> if I write :
> ioremap(0x20000000,0x40000) and ioremap(0x20000000,0x50000)
>
> Will it crash ?

I have no idea.  You haven't given us enough information to really answer
that.

Basic information needed would be: 

1) What board/chip
2) What kernel version
3) What are you actually trying to do
4) What driver are you using
5) If you are writing your own, where is the code for it

etc.

josh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:58         ` Josh Boyer
@ 2008-09-19 17:12           ` Grant Likely
  2008-09-19 17:47             ` Sébastien Chrétien
  2008-09-19 17:52           ` Sébastien Chrétien
  1 sibling, 1 reply; 11+ messages in thread
From: Grant Likely @ 2008-09-19 17:12 UTC (permalink / raw)
  To: Josh Boyer; +Cc: chretien, linuxppc-dev

On Fri, Sep 19, 2008 at 10:58 AM, Josh Boyer <jwboyer@gmail.com> wrote:
> On Fri, Sep 19, 2008 at 06:45:01PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
>> if I write :
>> ioremap(0x20000000,0x40000) and ioremap(0x20000000,0x50000)
>>
>> Will it crash ?
>
> I have no idea.  You haven't given us enough information to really answer
> that.

But I can say that the second ioremap() call makes the first ioremap()
both redundant and inefficient.  You're using exactly the same base
address so the same region is getting mapped twice.  Since the second
call uses a bigger region than the first then the kernel will probably
need to allocate another chunk of virtual address space to map it
instead of reusing the first mapping.

g.


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 17:12           ` Grant Likely
@ 2008-09-19 17:47             ` Sébastien Chrétien
  0 siblings, 0 replies; 11+ messages in thread
From: Sébastien Chrétien @ 2008-09-19 17:47 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

I made a mistake. The right code is :

ioremap(0x20000000,0x40000) and ioremap(0x80000000,0x50000)



Grant Likely a écrit :
> On Fri, Sep 19, 2008 at 10:58 AM, Josh Boyer <jwboyer@gmail.com> wrote:
>   
>> On Fri, Sep 19, 2008 at 06:45:01PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
>>     
>>> if I write :
>>> ioremap(0x20000000,0x40000) and ioremap(0x20000000,0x50000)
>>>
>>> Will it crash ?
>>>       
>> I have no idea.  You haven't given us enough information to really answer
>> that.
>>     
>
> But I can say that the second ioremap() call makes the first ioremap()
> both redundant and inefficient.  You're using exactly the same base
> address so the same region is getting mapped twice.  Since the second
> call uses a bigger region than the first then the kernel will probably
> need to allocate another chunk of virtual address space to map it
> instead of reusing the first mapping.
>
> g.
>
>
>   

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:58         ` Josh Boyer
  2008-09-19 17:12           ` Grant Likely
@ 2008-09-19 17:52           ` Sébastien Chrétien
  1 sibling, 0 replies; 11+ messages in thread
From: Sébastien Chrétien @ 2008-09-19 17:52 UTC (permalink / raw)
  To: linuxppc-dev

The chip that I am using is a MPC7448.
The Kernel version is 2.6.26.
I am developping my own driver.
I am making some tests

Josh Boyer a écrit :
> On Fri, Sep 19, 2008 at 06:45:01PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:
>   
>> if I write :
>> ioremap(0x20000000,0x40000) and ioremap(0x20000000,0x50000)
>>
>> Will it crash ?
>>     
>
> I have no idea.  You haven't given us enough information to really answer
> that.
>
> Basic information needed would be: 
>
> 1) What board/chip
> 2) What kernel version
> 3) What are you actually trying to do
> 4) What driver are you using
> 5) If you are writing your own, where is the code for it
>
> etc.
>
> josh
>
>   

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ioremap and vmalloc
  2008-09-19 16:45       ` Sébastien Chrétien
  2008-09-19 16:58         ` Josh Boyer
@ 2008-09-22  5:28         ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2008-09-22  5:28 UTC (permalink / raw)
  To: Sébastien Chrétien; +Cc: linuxppc-dev, Kumar Gala

On Fri, 2008-09-19 at 18:45 +0200, Sébastien Chrétien wrote:
> if I write :
> ioremap(0x20000000,0x40000) and ioremap(0x20000000,0x50000)
> 
> Will it crash ?

To give you a rough idea, unless you tweak things like TASK_SIZE,
KERNELBASE, CONFIG_LOWMEM_SIZE, etc... and depending on what CPU you
use, you can generally count on approx. 200M of virtual space for
vmalloc/ioremap, or a bit less. I would additionally recommend against
mapping a significant portion of that for your devices as the kernel
will need space for its own use by vmalloc.

You can increase the amount available here by lowering TASK_SIZE to 2G
and KERNELBASE as well, and keeping CONFIG_LOWMEM_SIZE clamped to
something like 256M. That will give you a good GB of virtual space if I
can still count correctly.

(Note, having just looked at the MMU init code for 32 bits, I almost had
to puke, Kumar, Josh, we really need to clean that shit up one of these
days).

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-09-22  5:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-19 11:15 ioremap and vmalloc Sébastien Chrétien
2008-09-19 13:49 ` Grant Likely
2008-09-19 16:34   ` Sébastien Chrétien
2008-09-19 16:38     ` Josh Boyer
2008-09-19 16:45       ` Sébastien Chrétien
2008-09-19 16:58         ` Josh Boyer
2008-09-19 17:12           ` Grant Likely
2008-09-19 17:47             ` Sébastien Chrétien
2008-09-19 17:52           ` Sébastien Chrétien
2008-09-22  5:28         ` Benjamin Herrenschmidt
2008-09-19 16:43     ` Grant Likely

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).