AnsweredAssumed Answered

MMAP fails every second execution

Question asked by kai.ps on Aug 14, 2012
Latest reply on Aug 21, 2012 by grace

Hey,

 

I'm using the source from the MMAP example 2 from the wiki (http://docs.blackfin.uclinux.org/doku.php?id=mmap&s[]=mmap) and everything works fine - until i want to execute the user-space app a second time.

 

In this case, the mmap fails with an exception:

page allocation failure: order:10, mode:0xd0
Hardware Trace:
   0 Target : <0x00183c30> { _dump_stack + 0x0 }
     Source : <0x0003a53e> { _warn_alloc_failed + 0x7a } CALL pcrel
   1 Target : <0x0003a53e> { _warn_alloc_failed + 0x7a }
     Source : <0x00183e04> { _printk + 0x14 } RTS
   2 Target : <0x00183e00> { _printk + 0x10 }
     Source : <0x0001103c> { _vprintk + 0x160 } RTS
   3 Target : <0x0001101a> { _vprintk + 0x13e }
     Source : <0x0001114a> { _vprintk + 0x26e } JUMP.S
   4 Target : <0x0001114a> { _vprintk + 0x26e }
     Source : <0x00010c40> { _console_unlock + 0x1a4 } RTS
   5 Target : <0x00010c1a> { _console_unlock + 0x17e }
     Source : <0x00010c0c> { _console_unlock + 0x170 } IF CC JUMP pcrel (BP)
   6 Target : <0x00010c04> { _console_unlock + 0x168 }
     Source : <0x00026aae> { _up + 0x3a } RTS
   7 Target : <0x00026aa8> { _up + 0x34 }
     Source : <0x00026a9a> { _up + 0x26 } IF CC JUMP pcrel (BP)
   8 Target : <0x00026a74> { _up + 0x0 }
     Source : <0x00010c00> { _console_unlock + 0x164 } CALL pcrel
   9 Target : <0x00010bde> { _console_unlock + 0x142 }
     Source : <0x00010af6> { _console_unlock + 0x5a } IF CC JUMP pcrel 
  10 Target : <0x00010ace> { _console_unlock + 0x32 }
     Source : <0x00010b2c> { _console_unlock + 0x90 } IF CC JUMP pcrel (BP)
  11 Target : <0x00010b24> { _console_unlock + 0x88 }
     Source : <0x0001061e> { __call_console_drivers + 0x62 } RTS
  12 Target : <0x00010618> { __call_console_drivers + 0x5c }
     Source : <0x000105f2> { __call_console_drivers + 0x36 } IF CC JUMP pcrel 
  13 Target : <0x000105e2> { __call_console_drivers + 0x26 }
     Source : <0x000105d2> { __call_console_drivers + 0x16 } IF !CC JUMP pcrel (BP)
  14 Target : <0x000105bc> { __call_console_drivers + 0x0 }
     Source : <0x00010b20> { _console_unlock + 0x84 } CALL pcrel
  15 Target : <0x00010b1a> { _console_unlock + 0x7e }
     Source : <0x00010bca> { _console_unlock + 0x12e } JUMP.S
Stack info:
 SP: [0x00d09dc0] <0x00d09dc0> /* kernel dynamic memory */
 FP: (0x00d09eec)
 Memory from 0x00d09dc0 to 00d0a000
00d09dc0:[000000d0] 0003a542  0022ed94  000000d0  00000000  00c36c64  0000000a  000000d0 
00d09de0: 0003a87a  00000000  000000d0  00000001  00000001  000000d0  00000000  0000000a 
00d09e00: 0022ed94  00000001  00000040  0022e380  00000000  00d08008  00d08000  00d08008 
00d09e20: 00d08000  00000040  00d08000  01d09ec4  000200d0  00000400  0000003c  0000003c 
00d09e40: 00000040  00000010  00000000  00000040  0022e380  00000000  00000000  0022e380 
00d09e60: 0022e380  00cc2a20  000446fa  00000000  00c436a4  015098d0  0000000a  00000073 
00d09e80: 00000000  000000f7  0000003c  0000000a  0000c786  00000000  00000000  00000000 
00d09ea0: 00c36ac0  00372000  00000372  00000000  00000020  00cffd64  00044df4  00000000 
00d09ec0: 00371400  023251a0  00d08000  00cc2a20  00000002  00000003  00c36ac0  00000005 
00d09ee0: 023251a0  00000003  00000002 (00000000)<ffa0085e> 00044db0  000000c0  00000000 
00d09f00: ffffe000  00000000  00000003  ffffe000  00cfff70  0000fffe  00000002  00000003 
00d09f20: 00000000  015cd280 
00d09f40: 00d38b72  ffa00e50  02003065  015dda7d  0023c59f  015dda32  0023c59e  00000000 
00d09f60: 00000000  00000000  00000000  00000000  00000000  00000000  7ffff000  000000c0 
00d09f80: 00000137  00000000  00000000  00000000  00000000  0000005b  00001802  00000001 
00d09fa0: fffffffc  00000007  00000003  00d3907c  00d38f30  00cffd58  00cffd64  00d281c8 
00d09fc0: 00d281c8  023251a0  00000000  015cd24c  000000c0  00000000  00cfff50  00000000 
00d09fe0: 00000003  00000002  00000003  00371400  00000000  00000000  000000c0  00000006 
Return addresses in stack:
   frame  1 : <0xffa0085e> { _system_call + 0x6a }
    address : <0x00008000> { _decode_address + 0x3dc }
MMAP failed!

 

 

I've tried solving that with munmap call at the end of the application, but it doesn't change the behaviour of the second launch.

 

What's the problem?

What can I do to fix that?

 

Thanks,

Kai

Outcomes