+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Full Member level 3
    Points: 2,020, Level: 10
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    158
    Helped
    0 / 0
    Points
    2,020
    Level
    10

    Debugging embedded board-linux

    Hi
    I have a power PC board from freescale which runs a linux application for about 20 minutes and then crashes with seg fault. The most predominant message appearing on prompt is "vmap allocation for size 8192 failed: use vmalloc=<size> to increase size" . I have searched all over that recommend increase in size of vmap, but conceptually I do not understand why system crashes exactly after 20 min. If there were problem in vmap allocation, the application should not have run in the first place?

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 74,332, Level: 66
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    12,180
    Helped
    4033 / 4033
    Points
    74,332
    Level
    66

    Re: Debugging embedded board-linux

    It could be a lot of things but most likely this is a memory leak. At each pass of some routine, more memory is requested but not released afterwards. The cumulative effect over time is insufficient memory to continue. It could be difficult to debug but I would start by stepping each routine and noting how much memory is being used. If a routine exits with less memory than when it was started, it is holding some back.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  3. #3
    Full Member level 3
    Points: 2,020, Level: 10
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    158
    Helped
    0 / 0
    Points
    2,020
    Level
    10

    Re: Debugging embedded board-linux

    Hi
    Could you tell me as what would be the best starting point to debug?



    •   AltAdvertisment

        
       

  4. #4
    Super Moderator
    Points: 27,962, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,341
    Helped
    1056 / 1056
    Points
    27,962
    Level
    40
    Blog Entries
    6

    Re: Debugging embedded board-linux

    You did not tell anything about your system, as for example the programming language, but in general a well wrote code has a debug mode selection, which is a variable or preprocessor that once enabled, makes the code logging either at console or to a text file (or even via UART), a lot of information about where it is at each pass, as well as showing value of critical variables. This way you can check what the last event recordered and than try to increase the level of detailing of the debug in the last passed routine; that is, it is an experiment of trial and error, converging to the exact point where some allocated memory has certainly not been released.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisment

        
       

  5. #5
    Full Member level 3
    Points: 2,020, Level: 10
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    158
    Helped
    0 / 0
    Points
    2,020
    Level
    10

    Re: Debugging embedded board-linux

    Hi andre,
    Programming language is "C". But may be I found the clue. This system crashes after a predetermined time if a device driver is linked with the application. Without device driver invocation, the program runs fine. This brings the suspicion about the driver code. Just to clarify, I am running an application in an infinite loop. Before the while(1) function, I open the driver, but I am not closing it ( within the while loop). It is perpetually open. Whether this might be causing the problem?



  6. #6
    Super Moderator
    Points: 27,962, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,341
    Helped
    1056 / 1056
    Points
    27,962
    Level
    40
    Blog Entries
    6

    Re: Debugging embedded board-linux

    Before the while(1) function, I open the driver, but I am not closing it ( within the while loop). It is perpetually open. Whether this might be causing the problem?
    If you are trying to instantiate a device that is already open this would indeed generate an error, but usually in code this is avoided by checks like this:

    FILE * pDev = open ("Device_To_Open");
    if (pDev == NULL)
    {
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  7. #7
    Full Member level 3
    Points: 2,020, Level: 10
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    158
    Helped
    0 / 0
    Points
    2,020
    Level
    10

    Re: Debugging embedded board-linux

    Hi Andre,
    Well i discovered that file instantiation is not a problem. my next guess is the usage of ioremap in my driver. What are best ways to use ioremap function. I declared as a= ioremap((volatile unsigned long)<phyaddress>,4) then i passed values *a= data1;*a=data2; and so -on. In particular this code did not work in the beginning. the compiler seems to optimizing two write functions into one. So ihad to declare a1 and a2 mapping to the same phy address and then *a1=data1; *a2=data2 really worked. When i run this code , the system hangs with seg fault after 20 min.



  8. #8
    Full Member level 3
    Points: 4,476, Level: 15

    Join Date
    Apr 2001
    Location
    California, USA
    Posts
    188
    Helped
    25 / 25
    Points
    4,476
    Level
    15

    Re: Debugging embedded board-linux

    I guess that you user trying to use return value from ioremap directly. This is wrong. Please read this link: https://lwn.net/Articles/653585/.



    •   AltAdvertisment

        
       

  9. #9
    Super Moderator
    Points: 66,800, Level: 63
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    13,636
    Helped
    3120 / 3120
    Points
    66,800
    Level
    63

    Re: Debugging embedded board-linux

    Hi,

    Before the while(1) function, I open the driver, but I am not closing it ( within the while loop). It is perpetually open.
    If you want it to be open all the time: Then OPEN it before the while(1) loop.

    Otherwise
    * OPEN and CLOSE it within the while loop.
    * Or you OPEN it only when it is not opened already.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  10. #10
    Full Member level 3
    Points: 2,020, Level: 10
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    158
    Helped
    0 / 0
    Points
    2,020
    Level
    10

    Re: Debugging embedded board-linux

    Hi cfant

    Do you recommend using memremap instead of ioremap?



--[[ ]]--