[uClinux-dev] 2.4.10 kmalloc has bugs?

Thuys, Michiel michiel.thuys at intersil.com
Tue Nov 20 07:45:46 EST 2001


Kovacs,

It seems that the kernel thinks it has free memory at address 0x00e00000
(looking at your first mail). This is not the case according to your
memory layout. Maybe you should check in arch/armnommu/mm/init.c what
the values are for the start and size of your memory
(meminfo.bank[0].start and meminfo.bank[0].size). These values are used
to pass the end of free memory to the kernel (start of free mem is the
end of the kernel) and may be wrong in your case.

I can tell you that 2.4.10 runs fine on my ARM9 board.

Michiel

> -----Original Message-----
> From: kernig kovacs [mailto:kovacs_kernig at hotmail.com]
> Sent: dinsdag 20 november 2001 13:04
> To: uclinux-dev at uclinux.org
> Subject: Re: [uClinux-dev] 2.4.10 kmalloc has bugs?
> 
> 
> To Michiel
> 
> Thank you for replying me.
> I have checked your suggestion and I am sure that 
> arch/armnommu/mm/init.c
> has reserved initial ramdisk space. Code as below
> 
> void __init bootmem_init(struct meminfo *mi)
> {
> ......
> #ifdef CONFIG_BLK_DEV_INITRD
>  if (initrd_node >= 0)
>   reserve_bootmem_node(NODE_DATA(initrd_node), __pa(initrd_start),
>          initrd_end - initrd_start);
> #endif
> ......
> }
> 
> 
> I have traced bug today
> 
> After undecompressed initial ramdisk, kernel mount it and run 
> /dev/init.
> in the binary loader, fs/binfmt_flat.c, will load /dev/init 
> to a page catch
> which return from do_mmap.
> .....
> textpos = do_mmap(0, 0, text_len + data_len + extra,
>     PROT_READ | PROT_EXEC | PROT_WRITE, 0, 0);
> 
> textpot is the returned address, the length is text_len + 
> data_len + extra.
> then
>    result = bprm->file->f_op->read(bprm->file,
>      (char *) textpos, text_len + data_len + extra, &fpos);
> 
> the bprm->file->f_op->read is linked to generic_file_read(), 
> which is in
> mmnommu/filemap.c.
> 
> And BUG happened after generic_file_read has been called. BUS as below
> 
> 
> ##swap.c[93]->lru_cache_add()
> ##page_alloc.c[229]->rmqueue()
> kernel BUG at page_alloc.c:229!
> ##page_alloc.c[229]->rmqueue()
> page=0x  128780
> ##page_alloc.c[229]->rmqueue()
> kernel BUG at filemap.c:74!<2> - extra data = 00128780
> ##swap.c[93]->lru_cache_add()
> kernel BUG at swap.c:93!
> ##swap.c[93]->lru_cache_add()
> page=0x  128780
> ##swap.c[93]->lru_cache_add()
> ##page_alloc.c[229]->rmqueue()
> kernel BUG at page_alloc.c:229!
> ##page_alloc.c[229]->rmqueue()
> page=0x  128780
> ##page_alloc.c[229]->rmqueue()
> kernel BUG at filemap.c:74!<2> - extra data = 00128780
> ##swap.c[93]->lru_cache_add()
> ...........
> 
> Finally I found the bug happeded in include/linux/swap.h at
> PageInactive(page);
> 
> code as below.
> 
>  */
> #define DEBUG_LRU_PAGE(page)   \
> do {      \
>  if (PageActive(page))   \
>   BUG();    \
> printk("##%s[%d]->%s()\n",__FILE__,__LINE__,__FUNCTION__);    
>         \
>  if (PageInactive(page))   \
>   BUG();    \
> printk("##%s[%d]->%s()\n",__FILE__,__LINE__,__FUNCTION__);    
>         \
> printk("page=0x%8x\n",page);                                  
>         \
>  if (page_count(page) == 0)  \
>   BUG();    \
> printk("##%s[%d]->%s()\n",__FILE__,__LINE__,__FUNCTION__);    
>         \
> } while (0)
> 
> I think maybe that's problem of page alligment.
> 
> my basic configure is as below
> 
> PAGE_OFFSET=0x0,
> compressed image Initrd.gz is set at 0xf00000.
> It has 16M sdram from 0x0 to 0x100000.
> The kernel entry is 0x8000
> 
> I think it's hard to solve my problem but I am wonder that 
> other can run
> that ARM7 successfully.
> 
> Dose any boy can help me and give me suggestion?
> 
> Regards,
> 
>  kovacs
> 
> 
> 
> ----- Original Message -----
> From: "Thuys, Michiel" <michiel.thuys at intersil.com>
> To: <uclinux-dev at uclinux.org>
> Sent: Monday, November 19, 2001 9:05 PM
> Subject: RE: [uClinux-dev] 2.4.10 kmalloc has bugs?
> 
> 
> > In setup_arch() in arch/armnommu/kernel/setup.c, the bootmemory is
> > initialized. This initialization reserves (reserve_bootmem call) the
> > part of memory where the kernel is located so that the kernel page
> > allocator knows where the free memory is. This is probably 
> going wrong
> > in your case. The memory area where your initrd.img lies should be
> > reserved here so that the kernel cannot allocate it anymore.
> >
> > Hope this helps.
> >
> > Michiel
> >
> > -----Original Message-----
> > From: kernig kovacs [mailto:kovacs_kernig at hotmail.com]
> > Sent: maandag 19 november 2001 13:14
> > To: uclinux-dev at uclinux.org
> > Subject: [uClinux-dev] 2.4.10 kmalloc has bugs?
> >
> >
> > Hi all
> >
> > I use ARM7 no mmu asic, my compiler is 2.95.3.
> > I feed initrd.img to my kernel by it can run /dev/init?
> > ......
> > EXT2-fs warning: maximal mount count reached, running e2fsck is
> > recommended
> > VFS: Mounted root (ext2 filesystem).
> > BINFMT_FLAT: Loading file: d17120
> > ##binfmt_flat.c[535]->load_flat_binary()
> > do_mmap:
> > Process blocks 1: 00d1f10c: 00000000 -> 0013c800: 0013c780 (65536
> > @00e00000
> > #1).
> > ##binfmt_flat.c[538]->load_flat_binary()
> > textpos =   e00000
> > ##binfmt_flat.c[543]->load_flat_binary()
> > ##binfmt_flat.c[569]->load_flat_binary()
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > kernel BUG at page_alloc.c:229!
> > kernel BUG at filemap.c:74!<2> - extra data = 00124780
> > kernel BUG at swap.c:93!
> > ##binfmt_flat.c[572]->load_flat_binary()
> > ##binfmt_flat.c[579]->load_flat_binary()
> > ##binfmt_flat.c[585]->load_flat_binary()
> > Mapping is e00000, Entry point is 40, data_start is 8200
> > Load /bin/init: TEXT=e00040-e08240 DATA=e08200-e09b90 
> BSS=e09b90-e0c6d0
> > ........
> >
> >
> > Why I put initrd.img at address 0xe00000 and kmalloc() 
> return 0xe00000
> > to
> > do_mmap(), which will reture a space of len memory to the relocation
> > application.
> >
> > Doese there any body met the same problem?
> >
> >
> > Any suggestion will be appreciated!!
> >
> > Regards,
> >
> >   kovacs
> > This message resent by the uclinux-dev at uclinux.org list server
> > http://www.uClinux.org/
> > This message resent by the uclinux-dev at uclinux.org list server
> http://www.uClinux.org/
> >
> This message resent by the uclinux-dev at uclinux.org list 
> server http://www.uClinux.org/
> 
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list