This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSP/BIOS DM6437 SYS abort LOCK NOT CALLED IN TSK CONTEXT

Hello:

Could anyone tell me what this message means?  I have recently added a dynamically created (SEM_create) semaphore to my system.   It runs for about a minute and crashes like this.   The call stack says nothing.

I am not trying to call the binary Post or Pend from a ISR. 

How can I debug a SYS abort message? 

This is from the kernel message viewer.

86116670   PRD: begin PRD0 (0x8522bfb4)
86116671   SEM: post <unknown handle> (0x8160f32c) count = 0
86116672   SWI: post  KNL_swi (TSK scheduler) (0x8521cba8)
86116673   SYS abort called with message '***LOCK NOT CALLED IN TSK CONTEXT'

Thanks.

--B

 

  • There is a function callability table in appendix A of SPRU403o that shows what you can call where in a BIOS application, in this particular case it sounds like you may have put SEM_create in a context that is not a TSK, essentially SEM_create cannot be safely be called by a SWI or HWI.

    The reason is because SEM_create calls a MEM_alloc which will lead to a LCK_pend call that could block and cause a context switch which cannot happen in a HWI or SWI as the scheduler is disabled, this would mean the system is halted, which is why you get the "LOCK NOT CALLED IN TSK CONTEXT" error.

  • I am not calling it from a HWI or SWI.  Its just a userspace application.  Maybe I'm stomping on the handle.   Should I expect a different error if that was the case?

  • If the handle or internal data structures are corrupted you could get anything, but the most common cause for this particular error is calling a function that should not be called in a particular context. You could also get this if you disabled the scheduler in the task that you are calling this from. If you are worried about corruption it may be worth increasing your stack and heap space to see if that has any effect.

    Is it really just the adding of this one function that is causing the error, or perhaps adding this is inadvertently leading to an incorrect call in another piece of code? It has been a while since I worked with one of these errors, but it seems very strange that it does a post to the KNL_swi (the task scheduler) when it triggers this, along with it running for a minute first which is also strange, it is possible that you are seeing some corner case bug in BIOS. If it turns out this is the case it may be worth upgrading to a newer BIOS version to see if the behavior changes or goes away.

  • I didn't intentionally disable the scheduler.    Is there anything in the system that does this automatically?

    Heap sizes seem pretty good.  It runs 539 times before failing.

    This is what I have for code.   Maybe there is something I don't see. This is a generalized version however it captures what the code is doing (i.e. the struct has other entries, and declares the structure correctly, a TSK calls SEM_lock()).  Also note that I don't see an assert when it crashes.   

    I also tried statically creating the SEM instead of the dynamic below.    It gave a different error and I'll retry that and report back.

    FILE A
    -------------------------------

    //Globals:

    SEM_Handle SEM_Write;
    SEM_Attrs  SEM_WriteAttrs;

    include "mySem.h"

    // Create Sempahore
    semCreate() {

       SEM_WriteAttrs.name = "SEM_Write";
       SEM_Write=SEM_create(1, &SEM_WriteAttrs);  //Does MALLOC returns handle.
       semInfo->semLock = SEM_Write;
    }


    FILE B
    -------------------------------
    extern SEM_Handle SEM_Write;   // Only needed for the assert.

    include "mySem.h"

    BOOLEAN SEM_lock(semInfo sInfo)
    {
       assert ( sInfo->semLock == SEM_Write);
      
       if (!SEM_pendBinary(sInfo->semLock, SEM_WAIT_TIMESTAMP_TICS)) {
         printf("%s SEM Timeout", __FUNCTION__);
         return FALSE;
       } 
       return TRUE;
    }

    mySem.h

    ---------------------------------

    typedef struct SEM_INFO {
       SEM_Handle semLock;   // Only needed by the DSP.
    } semInfo;

  • Bandeg said:
    I also tried statically creating the SEM instead of the dynamic below.    It gave a different error and I'll retry that and report back.

    If you still get an error relating to an incorrect context call when creating the SEM statically than perhaps there is something elsewhere that is causing the trouble, I am curious what the alternate error is.

  • After running the static case again, it crashes with the same error as the dynamic case.    I think previously I had something wrong with the static case because it died on the first call.

    Can you think of anyway to pinpoint the problem?    (This is the same code that I am having problems with the new BIOS version, noted on a different thread).    Could there be a larger BIOS problem here?