Re: Allocating Large buffers at Boot-time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 06, 2007 at 10:29:54AM -0000, Martyn Welch wrote:
> I need to allocate a large buffer for DMA transfers in a driver I'm
> working on. I understand that the kernel normally will not allocate
> coherent buffers larger than 128KB, the suggested solution (from
> O'Reilly's ldd3) seems to be to compile the driver into the kernel and
> allocate a buffer at boot using alloc_bootmem_low(). When I tried this I
> get a kernel panic:

Are you trying to do this from a module? That would explain it doesn't
work.

> ========================================================================
> =========
> 
> BUG: unable to handle kernel NULL pointer dereference at virtual address
> 000002f0
>  printing eip:
> c021ca95
> *pde = 00000000
> Oops: 0000 [#1]
> SMP
> Modules linked in:
> CPU:    0
> EIP:    0060:[<c021ca95>]    Not tainted VLI
> EFLAGS: 00010202   (2.6.17.9 #23)
> EIP is at find_next_zero_bit+0x35/0xb0
> eax: 000000bc   ebx: c0522c20   ecx: 00000013   edx: ffffffff
> esi: 00000000   edi: 000002f0   ebp: 00038000   esp: c17ffef8
> ds: 007b   es: 007b   ss: 0068
> Process swapper (pid: 1, threadinfo=c17fe000 task=dfbdfa10)
> Stack: 00000000 c0522c20 00000000 01000000 00038000 c04e2894 00000000
> 00038000
>        00001793 00000000 ffffffff 00000000 ffffff80 00000246 00000013
> 00000001
>        00001793 00000000 00000001 c0522c20 01000000 00000080 00001000
> c04e2c84
> Call Trace:
>  <c04e2894> __alloc_bootmem_core+0xe4/0x3a0  <c04e2c84>
> __alloc_bootmem_nopanic+0x64/0x80
>  <c04e2cc0> __alloc_bootmem+0x20/0x50  <c04eb5cb>
> universeII_init+0x2b/0x40
>  <c0100423> init+0x123/0x330  <c0102eea> ret_from_fork+0x6/0x14
>  <c0100300> init+0x0/0x330  <c0100300> init+0x0/0x330
>  <c0100e35> kernel_thread_helper+0x5/0x10
> Code: 20 89 74 24 08 8b 74 24 18 89 7c 24 0c c1 f8 05 83 e1 1f 89 6c 24
> 10 8d 3c 86 8b 6c 24 1c 89 5c 24 04 c7 04 24 00 00 00 00 74 22 <8b> 07
> c7 04 24 20 00 00 00 29 0c 24 d3 e8 f7 d0 0f bc c0 75 05
> EIP: [<c021ca95>] find_next_zero_bit+0x35/0xb0 SS:ESP 0068:c17ffef8
> 
> ========================================================================
> =========
> 
> The offending code:
> 
> ========================================================================
> =========
> 
> static int __init universeII_init(void)
> {
> 	void* buffer;
> 	
> 	printk(KERN_INFO "Loading driver.\n");
> 
> 	buffer = alloc_bootmem(PAGE_SIZE);
> 
> 	return 0;
> }

I hope you do understand you're leaking memory over here.

> ========================================================================
> =========
> 
> I am using:
> 
> kernel version 2.6.17.9

If you're not trying to allocate from a module, you might want to
update your kernel to 2.6.20 and see if you can recreate the Oops.



Erik

-- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux