[Linux-Xtensa] kmalloc failure in kernel

linux-xtensa at linux-xtensa.org linux-xtensa at linux-xtensa.org
Wed Apr 1 07:29:15 PDT 2009


On Wed, Apr 01, 2009 at 06:32:45AM -0700, linux-xtensa at linux-xtensa.org wrote:
> Hi,
> 
>    I was working on bringing up the virtual frame buffer and it was fine. I wanted to modify that and wanted to map a DMA capable physical memory instead of using virtual memory.
> 
>   So I modified the vmalloc_32(size) call to kmalloc(size, (GFP_DMA|GFP_KERNEL) but the kernel crashes at this point.
> 
>   For testing I tried kmalloc( 32, GPF_KERNEL ), but the same result.
> 
> The dump is given below
> 
> Unable to handle kernel paging request at virtual address 00000000
>  pc = d015682b, ra = 900c3345
> Oops: sig: 11 [#1]
> 
> a00: 900c3345 d3817dc0 d2e48c00 d002dce4 00000400 d38514c0 00100000 d38514c0
> a08: 90156828 00060900 00000000 d0510d38 d0510000 00000000 00000003 00010000
> pc: d015682b, ps: 00060913, depc: 00000018, excvaddr: 00000000
> lbeg: d00e8408, lend: d00e8413 lcount: 00000000, sar: 0000001e
> 
> Stack: 900c23ee d3817e00 00000000 d013f9ac d2e48c00 00000000 00000000 00000001
>        d2e9cb90 d38514c0 00100000 00100fff 900c2489 d3817e20 00000001 d2e48c08
>        00000001 d0064fa8 d2e48cb0 d2e48c08 900c1d18 d3817e40 d013f9ac d2e48c08
> Call Trace:
>  [<d00c241a>] driver_probe_device+0x92/0xf4
>  [<d00c2489>] __device_attach+0xd/0x14
>  [<d00c1d18>] bus_for_each_drv+0x2c/0x50
>  [<d00c251c>] device_attach+0x5c/0x7c
>  [<d00c1cb4>] bus_attach_device+0x24/0x5c
>  [<d00c1229>] device_add+0x1b9/0x314
>  [<d00c3622>] platform_device_add+0xc2/0xe8
>  [<d0156af9>] cochinfb_init+0x135/0x158
>  [<d014fe65>] kernel_init+0xb9/0x1cc
>  [<d00022c9>] kernel_thread+0x1d/0x28
> 
> Kernel panic - not syncing: Attempted to kill init!

It later on does vmalloc_to_page() and dereferences the result
unconditionally.  This is probably where it explodes.

You really need pages here, kmalloc() gives you different memory
objects.

The buddy allocator (interface at include/linux/gfp.h) gives you
physically contiguous pages that you can use with dma.

And adjust all code that is specific to dealing with a vmalloc area,
of course.

	Hannes


More information about the linux-xtensa mailing list