2011-05-03 06:55:26     munmap error while trying to unmap frame buffer

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-05-03 06:55:26     munmap error while trying to unmap frame buffer

Chandrashekhar Lavania (INDIA)

Message: 100375   

 

Hi,

 

I am using standard bfin linux frame buffer driver (loaded using modprobe bfin-lq035q1-fb) for sharp LQ035Q1 Display.

 

I am using 2010R1-RC5 with commit 9703 (which provides no mmu for the uvc driver).

 

I am also using a patch for the mm/nommu file provided by Bob Liu. The discussion and patch can be found at https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=45219&action=ForumBrowse&forum_id=39

 

 

 

Now I was trying to unmap the frame buffer by using munmap.

 

For this I modified the main() function of the video_test file. The modified file is attached.

 

When I execute the binary I get a munmap error.

 

 

root:/home> ./Display_Test_V1_0                                                

munmap: Invalid argument                                                       

root:/home>

 

My executable is called Display_Test_V1_0

 

How can this issue be resolved?

 

Also the actual video_test file provided with the distribution does not unmap the memory. What is the reason behind this?

 

Regards,

Shekhar

 

PS: I am using a BF527 based board

 

 

diaplay_test.c

QuoteReplyEditDelete

 

 

2011-05-04 01:50:54     Re: munmap error while trying to unmap frame buffer

Bob Liu (CHINA)

Message: 100399   

 

I can't reproduce your problem on 2010R1 with those patches, please confirm.

 

root:/> ./diaplay_test

 

Munmap Successfulroot:/>

 

root:/> ./diaplay_test

 

Munmap Successfulroot:/>

 

Thanks

QuoteReplyEditDelete

 

 

2011-05-04 06:46:30     Re: munmap error while trying to unmap frame buffer

Chandrashekhar Lavania (INDIA)

Message: 100416   

 

Hi Bob,

 

No, still doesn't work.

 

I created a diff file in which I compared my new nommu.c with the one in 2010R1-RC5. The result is attached.

 

I used the following command:

 

diff -Naur olddir newdir > dir.patch

 

where the olddir = 2010R1-RC5 nommu.c file

 

where the newdir = modified nommu.c file

 

 

 

Regards,

 

Shekhar

 

2010R1_nommu.patch

QuoteReplyEditDelete

 

 

2011-05-04 22:54:37     Re: munmap error while trying to unmap frame buffer

Bob Liu (CHINA)

Message: 100427   

 

I am still can't reproduce this issue with 2010R1_nommu.patch.

 

Would you please open the debug printk in file mm/nommu.c and attach the log also.

 

Thanks.

QuoteReplyEditDelete

 

 

2011-05-05 01:40:28     Re: munmap error while trying to unmap frame buffer

Chandrashekhar Lavania (INDIA)

Message: 100428   

 

Hi Bob,

 

I have attached the /var/log/messages file.

 

This is how I did it:

 

root:/home> modprobe bfin-lq035q1-fb                                           

Console: switching to colour frame buffer device 40x15                         

bfin-lq035q1 bfin-lq035q1: 320x240 16-bit RGB FrameBuffer initialized          

root:/home> ./Display_Test_V1_0                                                

munmap: Invalid argument                                                       

root:/home> lsz /var/log/messages                                              

**B00root:/home>

 

The name of my executable was Display_Test_V1_0

 

 

Regards,

Shekhar

 

messages

QuoteReplyEditDelete

 

 

2011-05-05 01:55:43     Re: munmap error while trying to unmap frame buffer

Bob Liu (CHINA)

Message: 100429   

 

It seems that this issue was caused by  2010R1_nommu.patch.

 

Would you please revert mm/nommu.c and try again?

 

Since this test has nothing related with uvc camera.

QuoteReplyEditDelete

 

 

2011-05-05 03:38:51     Re: munmap error while trying to unmap frame buffer

Chandrashekhar Lavania (INDIA)

Message: 100436   

 

Hi Bob,

 

I used the mm/nommu.c file provided with the 2010R1-RC5 distribution

 

The error is still there. I have attached the /var/log/messages file .

 

Here is what I did:

 

root:/home> modprobe bfin-lq035q1-fb                                           

Console: switching to colour frame buffer device 40x15                         

bfin-lq035q1 bfin-lq035q1: 320x240 16-bit RGB FrameBuffer initialized          

root:/home> ./Display_Test_V1_0                                                

munmap: Invalid argument                                                       

root:/home> lsz /var/log/messages                                              

**B00root:/home>

 

Regards,

Shekhar

 

messages_2010R1_nommu

QuoteReplyEditDelete

 

 

2011-05-05 05:59:29     Re: munmap error while trying to unmap frame buffer

Bob Liu (CHINA)

Message: 100437   

 

Try attached patch after 2010R1-nommu.patch.

 

a.patch

QuoteReplyEditDelete

 

 

2011-05-05 06:53:09     Re: munmap error while trying to unmap frame buffer

Chandrashekhar Lavania (INDIA)

Message: 100440   

 

Hi Bob,

 

I applied a.patch but unfortunateky, the built image did not boot. I go the following messages:

 

Data access CPLB protection violation                                          

<5> - Attempted read or write to Supervisor resource,                          

<5>   or illegal data memory access.                                           

Kernel OOPS in progress                                                        

Deferred Exception context                                                     

CURRENT PROCESS:                                                               

COMM=swapper PID=1  CPU=0                                                      

invalid mm                                                                     

return address: [0xffa01606]; contents of:                                     

0xffa015e0:  3190  020a  1012  6103  089a  180c  67fa  3408                    

0xffa015f0:  3107  3400  3040  e355  635f  3080  3838  3081                    

0xffa01600:  0010  e082  0002 [9a01] 0010  0000  0988  186f                    

0xffa01610:  c682  8481  0a02  1826  c682  8508  c682  8789                    

                                                                               

ADSP-BF527-0.2 500(MHz CCLK) 100(MHz SCLK) (mpu off)                           

Linux version 2.6.34.7-ADI-2010R1CL_0_16_2010R1-svn9517 (shekhar@TLL-DVITIYA) (1

                                                                               

SEQUENCER STATUS:               Not tainted                                    

SEQSTAT: 00000023  IPEND: 8008  IMASK: ffff  SYSCFG: 0006                     

  EXCAUSE   : 0x23                                                             

  physical IVG3 asserted : <0xffa00760> { _trap + 0x0 }                        

  physical IVG15 asserted : <0xffa00f9c> { _evt_system_call + 0x0 }            

  logical irq   6 mapped  : <0xffa0039c> { _bfin_coretmr_interrupt + 0x0 }     

RETE: <0x00000000> /* Maybe null pointer? */                                  

RETN: <0x0201befc> /* kernel dynamic memory (maybe user-space) */             

RETX: <0x00000480> /* Maybe fixed code section */                             

RETS: <0x004e653a> { _scsi_strcpy_devinfo + 0x2a }                            

PC  : <0xffa01606> { _strncpy + 0x3e }                                        

DCPLB_FAULT_ADDR: <0xffa009c8> { _new_old_task + 0x0 }                         

ICPLB_FAULT_ADDR: <0xffa01606> { _strncpy + 0x3e }                             

PROCESSOR STATE:                                                               

R0 : 0205daa8    R1 : 0060c600    R2 : 00000000    R3 : 00000000              

R4 : 0060c600    R5 : 0205daa8    R6 : 00000008    R7 : 00000000              

P0 : ffa009c8    P1 : 0060c600    P2 : 00000000    P3 : 00650000              

P4 : 00618b64    P5 : 00000001    FP : 0069fec0    SP : 0201be20              

LB0: ffa01606    LT0: ffa01606    LC0: 00000000                               

LB1: 0044fd7e    LT1: 0044fd6e    LC1: 00000000                               

B0 : 00000000    L0 : 00000000    M0 : 0000002c    I0 : 0068a788              

B1 : 00000000    L1 : 00000000    M1 : 00000000    I1 : 00000000              

B2 : 00000000    L2 : 00000000    M2 : 00000000    I2 : 00000000              

B3 : 00000000    L3 : 00000000    M3 : 00000000    I3 : 00000000              

A0.w: 00000000   A0.x: 00000000   A1.w: 00000000   A1.x: 00000000              

USP : 00000000  ASTAT: 02003065                                                

                                                                               

Hardware Trace:                                                                

   0 Target : <0x00402f1c> { _trap_c + 0x0 }                                   

     Source : <0xffa006f4> { _exception_to_level5 + 0xa4 } JUMP.L              

   1 Target : <0xffa00650> { _exception_to_level5 + 0x0 }                      

     Source : <0xffa00504> { _bfin_return_from_exception + 0x18 } RTX          

   2 Target : <0xffa004ec> { _bfin_return_from_exception + 0x0 }               

     Source : <0xffa005a8> { _ex_trap_c + 0x74 } JUMP.S                        

   3 Target : <0xffa00534> { _ex_trap_c + 0x0 }                                

     Source : <0xffa007ba> { _trap + 0x5a } JUMP (P4)                          

   4 Target : <0xffa00760> { _trap + 0x0 }                                     

      FAULT : <0xffa01606> { _strncpy + 0x3e } B[P0++] = R1  (Z)               

     Source : <0xffa01602> { _strncpy + 0x3a } LSETUP <> LC0                   

   5 Target : <0xffa01602> { _strncpy + 0x3a }                                 

     Source : <0xffa015ca> { _strncpy + 0x2 } IF CC JUMP pcrel                 

   6 Target : <0xffa015c8> { _strncpy + 0x0 }                                  

     Source : <0x004e6536> { _scsi_strcpy_devinfo + 0x26 } JUMP.L              

   7 Target : <0x004e652a> { _scsi_strcpy_devinfo + 0x1a }                     

     Source : <0x004ab868> { _strlen + 0x18 } RTS                              

   8 Target : <0x004ab866> { _strlen + 0x16 }                                  

     Source : <0x004ab86c> { _strlen + 0x1c } JUMP.S                           

   9 Target : <0x004ab86a> { _strlen + 0x1a }                                  

     Source : <0x004ab856> { _strlen + 0x6 } IF CC JUMP pcrel                  

  10 Target : <0x004ab850> { _strlen + 0x0 }                                   

     Source : <0x004e6526> { _scsi_strcpy_devinfo + 0x16 } CALL pcrel          

  11 Target : <0x004e6510> { _scsi_strcpy_devinfo + 0x0 }                      

     Source : <0x004e6602> { _scsi_dev_info_list_add_keyed + 0x7a } CALL pcrel 

  12 Target : <0x004e65e6> { _scsi_dev_info_list_add_keyed + 0x5e }            

     Source : <0x0044058c> { _kmem_cache_alloc + 0x68 } RTS                    

  13 Target : <0x00440584> { _kmem_cache_alloc + 0x60 }                        

     Source : <0x00440572> { _kmem_cache_alloc + 0x4e } IF CC JUMP pcrel       

  14 Target : <0x00440540> { _kmem_cache_alloc + 0x1c }                        

     Source : <0x0044059e> { _kmem_cache_alloc + 0x7a } JUMP.S                 

  15 Target : <0x0044059e> { _kmem_cache_alloc + 0x7a }                        

     Source : <0x005ba9b4> { __cond_resched + 0x2c } RTS                       

Kernel Stack                                                                   

Stack info:                                                                    

SP: [0x0201be70] <0x0201be70> /* kernel dynamic memory (maybe user-space) */  

FP: (0x0201bfe4)                                                              

Memory from 0x0201be70 to 0201c000                                            

0201be70:[00000000] 00000000  00000000  00000000  00000000  00000000  00000000 

0201be90: 00000000  00000000  00000000  0000002c  00000000  00000000  00000000 

0201beb0: 00000000  0069fec0  00000001  00618b64  00650000  00000000  0060c600 

0201bed0: 00000000  00000008  0205daa8  0060c600  00000000  00000000  0060c600 

0201bef0: 0205daa8  ffa009c8  00000006  0069fec0  0044059e  020615a0  004e6606 

0201bf10: 0205daa0  00000001  0060c600  00000000  00619050  004e6398  00677344 

0201bf30: 0060c600  00000001  006a0086 <006ac57c> 0065400c  00000000  00000000 

0201bf50: 00000000  00664f38  02042c60  00000000  00000000  00000001  00000000 

0201bf70: 006ad900  00000000  00000000  00616ae0  005ccf3c <00400028><00400028>

0201bf90: 00000000  00670000  004300a8  0066e710  006ad858  00000000  0068e120 

0201bfb0: 006adb58  00000000  00000000  00000000  00000000  006ad858  006ad858 

0201bfd0: 0068e194  006ad858  006ad858  00000000  00000000 (00000000)<004004ae>

0201bff0: 00000000  00000000  ffffffff  00000006                               

Return addresses in stack:                                                     

    address : <0x006ac57c> /* kernel dynamic memory (maybe user-space) */      

    address : <0x00400028> { _do_one_initcall + 0x28 }                         

    address : <0x00400028> { _do_one_initcall + 0x28 }                         

   frame  1 : <0x004004ae> { _kernel_thread_helper + 0x6 }                     

Modules linked in:                                                             

Kernel panic - not syncing: Kernel exception                                   

Hardware Trace:                                                                

Stack info:                                                                    

SP: [0x0201bd44] <0x0201bd44> /* kernel dynamic memory (maybe user-space) */  

FP: (0x0201bdf0)                                                              

Memory from 0x0201bd40 to 0201c000                                            

0201bd40: 00000013 [00601c10] 005ba396  0201be20  00601c10  006594be  006594be 

0201bd60: 0201bd74  00403358  0201be20  00008008  0201be20  0000003f  0000003f >

0201bd80: 0065ddb0  00030009  00000009  0065dddc  0201a000  00000001  00000024 

0201bda0: 00000101  00000004  00000100 <0041415e> 00000000  0042f918  0066e8f4 

0201bdc0: 00650000  00000006  0201befc  ffa00338 <00673a28> 0065400c  00650000 

0201bde0: 00000000  00000000  00619050  00000000 (00000000)<0068b110> ffa00c40 

0201be00: 00656000  00008008  00000023  0205daa8  0060c600  005ba996  00008050 

0201be20: 00000480  00008008  00000023  00000000  0201befc  00000480  ffa01606 

0201be40: 0205daa8  02003065  0044fd7e  ffa01606  0044fd6e  ffa01606  00000000 

0201be60: 00000000  00000000  00000000  00000000  00000000  00000000  00000000 

0201be80: 00000000  00000000  00000000  00000000  00000000  00000000  00000000 

0201bea0: 00000000  00000000  00000000  0068a788  00000000  0069fec0  00000001 

0201bec0: 00650000  00000000  0060c600  ffa009c8  00000000  00000008  0205daa8 

0201bee0: 00000000  00000000  0060c600  0205daa8  0205daa8  ffa009c8  00000006 

0201bf00: 0044059e  020615a0  004e6606  02061560  0205daa0  00000001  0060c600 

0201bf20: 00619050  004e6398  00677344  00000000  0060c600  00000001  006a0086 >

0201bf40: 0065400c  00000000  00000000  00000000  00000000  00664f38  02042c60 

0201bf60: 00000000  00000001  00000000  0069fede  006ad900  00000000  00000000 

0201bf80: 005ccf3c <00400028><00400028> 00000000  00000000  00670000  004300a8 

0201bfa0: 006ad858  00000000  0068e120  006ad900  006adb58  00000000  00000000 

0201bfc0: 00000000  006ad858  006ad858  00000000  0068e194  006ad858  006ad858 

0201bfe0: 00000000  00000000 <004004ae> 00000000  00000000  00000000  ffffffff 

Return addresses in stack:                                                     

    address : <0x0067197c> /* kernel dynamic memory (maybe user-space) */      

    address : <0x0041415e> { ___do_softirq + 0x76 }                            

    address : <0x00673a28> /* kernel dynamic memory (maybe user-space) */      

   frame  1 : <0x0068b110> /* kernel dynamic memory (maybe user-space) */      

    address : <0x006ac57c> /* kernel dynamic memory (maybe user-space) */      

    address : <0x00400028> { _do_one_initcall + 0x28 }                         

    address : <0x00400028> { _do_one_initcall + 0x28 }                         

    address : <0x004004ae> { _kernel_thread_helper + 0x6 } 

 

 

Regards,

Shekhar

QuoteReplyEditDelete

 

 

2011-05-06 04:03:29     Re: munmap error while trying to unmap frame buffer

Bob Liu (CHINA)

Message: 100478   

 

It's strange. It works fine on my bf527

 

Before this patch:

 

root:/> modprobe /lib/modules/2.6.34.7-ADI-2010R1-svn9243/kernel/drivers/video/b

fin-lq035q1-fb  

Console: switching to colour frame buffer device 40x30

bfin-lq035q1 bfin-lq035q1: 320x240 16-bit RGB FrameBuffer initialized

 

root:/>

root:/> ./test2

munmap: Invalid argument

root:/>

root:/>

 

 

 

After:

 

root:/> modprobe /lib/modules/2.6.34.7-ADI-2010R1-svn9243/kernel/drivers/video/b

fin-lq035q1-fb  

Console: switching to colour frame buffer device 40x30

bfin-lq035q1 bfin-lq035q1: 320x240 16-bit RGB FrameBuffer initialized

root:/>

root:/>

root:/> ./test2

Munmap Successful

root:/>

QuoteReplyEditDelete

 

 

2011-05-06 05:45:04     Re: munmap error while trying to unmap frame buffer

Chandrashekhar Lavania (INDIA)

Message: 100483   

 

Hi Bob,

 

It worked...Yay!!......There was a typo from my part. It works fine now.

 

 

 

Thanks a lot.

 

Regards,

 

Shekhar

QuoteReplyEditDelete

Outcomes