AnsweredAssumed Answered

BF537 with uCLinux - memory allocation problems

Question asked by MichaelWd on Apr 15, 2013
Latest reply on Apr 22, 2013 by MichaelWd

Dear Members,

 

I have a custom BF537 board with 8MB FLASH and 16MB SDRAM. Linux kernel (with mtd gpio driver) correctly see and use all of the FLASH memory, using one GPIO line as ADDR21, but I have problems with SDRAM allocation. For example I can not load bfin-can module or create 1MB file on /tmp. After startup with very minimal system I've get:

 

Kernel managed physical pages: 3840

Memory available: 11604k/16384k RAM, (1904k init code, 1089k kernel code, 443k data, 1024k dma, 320k reserved)


For me it means that kernel see and can use all available memory. Meminfo says:

MemTotal:      13508 kB
MemFree:        4588 kB
Buffers:           0 kB
Cached:         3952 kB
SwapCached:        0 kB
Active:            0 kB
Inactive:          0 kB
Active(anon):      0 kB
Inactive(anon):    0 kB
Active(file):      0 kB
Inactive(file):    0 kB
Unevictable:    3952 kB
Mlocked:           0 kB
MmapCopy:       3100 kB
SwapTotal:         0 kB
SwapFree:          0 kB
Dirty:             0 kB
Writeback:         0 kB
AnonPages:         0 kB
Mapped:            0 kB
Shmem:             0 kB
Slab:           1656 kB
SReclaimable:    944 kB
SUnreclaim:      712 kB
KernelStack:     200 kB
PageTables:        0 kB
NFS_Unstable:      0 kB
Bounce:            0 kB
WritebackTmp:      0 kB
CommitLimit:    6752 kB
Committed_AS:      0 kB
VmallocTotal:      0 kB
VmallocUsed:       0 kB
VmallocChunk:      0 kB

 

For me it means that I have about 4.5MB free ram and almost another 4MB (3.9) cache, that also can be used for allocation - is that correct?

However after loading for example bfin-can I've get:

 

modprobe bfin-can

mdev: page allocation failure: order:7, mode:0xd0

Hardware Trace:

   0 Target : <0x0011139c> /* kernel dynamic memory */

     Source : <0x0003d9ca> /* kernel dynamic memory */ JUMP.L

   1 Target : <0x0003d9ca> /* kernel dynamic memory */

     Source : <0x001115ca> /* kernel dynamic memory */ RTS

   2 Target : <0x001115c6> /* kernel dynamic memory */

     Source : <0x0000d2fc> /* kernel dynamic memory */ RTS

   3 Target : <0x0000d2f2> /* kernel dynamic memory */

     Source : <0xffa00ae6> /* kernel dynamic memory */ RTI

   4 Target : <0xffa00a84> /* kernel dynamic memory */

     Source : <0xffa008d0> /* kernel dynamic memory */ RTS

   5 Target : <0xffa008d0> /* kernel dynamic memory */

     Source : <0xffa008a6> /* kernel dynamic memory */ IF !CC JUMP pcrel

   6 Target : <0xffa00878> /* kernel dynamic memory */

     Source : <0xffa00a80> /* kernel dynamic memory */ JUMP.L

   7 Target : <0xffa00a7e> /* kernel dynamic memory */

     Source : <0xffa00216> /* kernel dynamic memory */ RTS

   8 Target : <0xffa0020e> /* kernel dynamic memory */

     Source : <0x00037ec0> /* kernel dynamic memory */ RTS

   9 Target : <0x00037eba> /* kernel dynamic memory */

     Source : <0x00037eac> /* kernel dynamic memory */ IF CC JUMP pcrel (BP)

  10 Target : <0x00037ea6> /* kernel dynamic memory */

     Source : <0x00037e16> /* kernel dynamic memory */ RTS

  11 Target : <0x00037e10> /* kernel dynamic memory */

     Source : <0x00037dee> /* kernel dynamic memory */ IF !CC JUMP pcrel

  12 Target : <0x00037dd8> /* kernel dynamic memory */

     Source : <0x00037ea2> /* kernel dynamic memory */ CALL pcrel

  13 Target : <0x00037e70> /* kernel dynamic memory */

     Source : <0x0001127e> /* kernel dynamic memory */ CALL pcrel

  14 Target : <0x0001127a> /* kernel dynamic memory */

     Source : <0x00011252> /* kernel dynamic memory */ IF CC JUMP pcrel

  15 Target : <0x00011250> /* kernel dynamic memory */

     Source : <0x000265c2> /* kernel dynamic memory */ RTS

Stack info:

SP: [0x00567c68] <0x00567c68> /* kernel dynamic memory */

FP: (0x00567fe0)

Memory from 0x00567c60 to 00568000

00567c60: 00567c68  00000007 [00000000] 0003d9ce  0017dd58  000000d0  00000000  00554ba0

00567c80: 00000007  000000d0  0003dd08  0017dd58  00000000  0003dd22  00000000  000000d0

00567ca0: 00000001  00000001  000000d0  00000000  00000007  0017dd58  00000001  00000040

00567cc0: 0017d32c  00000000  00566008  00566000  00566008  00566000  00000040  00566000

00567ce0: 01554b54  000200d0  00000000  00000080  00000001  00000001  00000040  00000000

00567d00: 00000040  0017d32c  00000000  00000000  0017d32c  0017d32c  0051d2c0  000481e2

00567d20: 00017980  0051e580  00000000  00000007  00000077  00000007  00000004  00000000

00567d40: 00000007  00554a00  00000000  0000ffbf  00567d6c  0007e000  0000007e  00519dac

00567d60: 00053780  0007e000  00044582  00017980  0007b464  00353a00  00519dac  00000000

00567d80: 00000000  0007e000  00566000  00000000  0005a2e0  00000007  00000002  00000000

00567da0: 0007b9cc  0007d93c  00566000  00071c64  00071c60  00000000  00000000  00000000

00567dc0: 00000007  00000002  00000000  00000000  00000000  00000000  00000000  00000000

00567de0: 00000002  00000006  00000000  00000004  00002f36  0000bcd8  04000000  44000000

00567e00: e0a20500  00000001  000016b0  0005a2e0  601c0700  362f0000  0001ff54  00000000

00567e20: 00003f53  0007d93c  00000000  00000000  00000000  00000000  00000000  00000000

00567e40: 00000000  00000000  00000000  80000040  00353a00 <0005307a> 001781bc  0007b464

00567e60: 00177e28  fffffff8  00000000  00567ef4  00000000  00000007  00567ef4  003641a0

00567e80: 00353a02  000000e9  0080f000  00053e7a  00567eb8  00353a00  00305be8  00000000

00567ea0: 00178eec  00566000  00000001  a01088c0  00305be8  9a989001  00554b20  00000000

00567ec0: 00567fd0  ffa00624  00530ea0  00314bc0  00000000  00566000  00000000  00000000

00567ee0: 00000000  8048ba60  43534586  00567f0c  00567ef4  00000000  00000000  00000000

00567f00: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

00567f20: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

00567f40: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

00567f60: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

00567f80: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

00567fa0: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

00567fc0: 00000000  00000000  00000000  00000000  00000000  00019ec4  00000000  00000000

00567fe0:(00000000)<0000161e> 00000000  00000000  00000000  00000000  ffffffff  00000006

Return addresses in stack:

    address : <0x0005307a> /* kernel dynamic memory */

   frame  1 : <0x0000161e> /* kernel dynamic memory */

Mem-Info:

DMA per-cpu:

CPU    0: hi:    0, btch:   1 usd:   0

active_anon:0 inactive_anon:0 isolated_anon:0

active_file:0 inactive_file:0 isolated_file:0

unevictable:978 dirty:0 writeback:0 unstable:0

free:1145 slab_reclaimable:236 slab_unreclaimable:177

mapped:0 shmem:0 pagetables:0 bounce:0

DMA free:4580kB min:4096kB low:5120kB high:6144kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:3912o

lowmem_reserve[]: 0 0 0

DMA: 11*4kB 1*8kB 1*16kB 1*32kB 2*64kB 0*128kB 1*256kB 0*512kB 2*1024kB 1*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 4580kB

978 total pagecache pages

3840 pages RAM

463 pages reserved

0 pages shared

2204 pages non-shared

Allocation of length 516096 from process 233 (mdev) failed

DMA per-cpu:

CPU    0: hi:    0, btch:   1 usd:   0

active_anon:0 inactive_anon:0 isolated_anon:0

active_file:0 inactive_file:0 isolated_file:0

unevictable:978 dirty:0 writeback:0 unstable:0

free:1145 slab_reclaimable:236 slab_unreclaimable:177

mapped:0 shmem:0 pagetables:0 bounce:0

DMA free:4580kB min:4096kB low:5120kB high:6144kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:3912o

lowmem_reserve[]: 0 0 0

DMA: 11*4kB 1*8kB 1*16kB 1*32kB 2*64kB 0*128kB 1*256kB 0*512kB 2*1024kB 1*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 4580kB

978 total pagecache pages

Unable to allocate RAM for process text/data, errno 12

 

Very similar message I have after trying to create file with:

dd if=/dev/urandom of=/tmp/bigfile bs=1k count=1k


There is an allocation error and system freezes. What can be wrong? I'm almost sure that free ram is still available, but Linux can not allocate it. Are there any "magical" kernel options or configurations that I can try? I'm using a custom kernel but I've tried to make it similar to BF537-STAMP config.

 

Thank You in advance,

Michael Widlok



Outcomes