ioremap and vmalloc
From: Sébastien Chrétien <hidden>
Date: 2008-09-19 11:15:22
11 messages, 5 authors, 2008-09-22 · open the first message on its own page
From: Sébastien Chrétien <hidden>
Date: 2008-09-19 11:15:22
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 ?
From: Grant Likely <hidden>
Date: 2008-09-19 14:01:27
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.
From: Sébastien Chrétien <hidden>
Date: 2008-09-19 16:35:53
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:quoted
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
From: Josh Boyer <hidden>
Date: 2008-09-19 16:39:16
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
From: Grant Likely <hidden>
Date: 2008-09-19 16:43:44
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.
From: Josh Boyer <hidden>
Date: 2008-09-19 16:59:30
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
From: Sébastien Chrétien <hidden>
Date: 2008-09-19 17:02:12
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:quoted
The first is ioremap(0x20000000,0x10000000); The second is ioremap(0x80000000,0x10000000); Is it too longThe 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
From: Grant Likely <hidden>
Date: 2008-09-19 17:12:23
On Fri, Sep 19, 2008 at 10:58 AM, Josh Boyer [off-list ref] wrote:
On Fri, Sep 19, 2008 at 06:45:01PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:quoted
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.
From: Sébastien Chrétien <hidden>
Date: 2008-09-19 17:49:22
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 [off-list ref] wrote:quoted
On Fri, Sep 19, 2008 at 06:45:01PM +0200, =?ISO-8859-1?Q?S=E9bastien_Chr=E9tien_ wrote:quoted
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.
From: Sébastien Chrétien <hidden>
Date: 2008-09-19 17:54:23
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:quoted
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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2008-09-22 05:29:12
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.