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.

Internal error: Oops: 807 when closing communication to the DSP

Other Parts Discussed in Thread: TMS320DM8148

Hello,

my application is sending messages between arm and dsp on the Davinci platform, using syslinks MessageQ. When the application exits, I always get this error:

[d0795004] *pgd=84c35011, *pte=00000000, *ppte=00000000
Internal error: Oops: 807 [#2]
last sysfs file: /sys/devices/system/cpu/online
Modules linked in: g_zero bufferclass_ti omaplfb pvrsrvkm g_ffs ti81xxfb vpss syslink ipv6
CPU: 0    Tainted: G      D      (2.6.37-kk-5050200 #2)
PC is at remove_wait_queue+0x20/0x44
LR is at OsalSemaphore_pend+0x224/0x2a8 [syslink]
pc : [<c008479c>]    lr : [<bf0723ec>]    psr: 80000093
sp : c4de3df8  ip : 80000013  fp : c4de3e04
r10: d0792008  r9 : 0007a120  r8 : d0795004
r7 : 0000c350  r6 : fffffe00  r5 : d0795000  r4 : c4de2000
r3 : 00100100  r2 : d0795004  r1 : c4de3e14  r0 : d0795004
Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 84c98019  DAC: 00000015
Process DSPListenerThre (pid: 1361, stack limit = 0xc4de22e8)
Stack: (0xc4de3df8 to 0xc4de4000)
3de0:                                                       c4de3e4c c4de3e08
3e00: bf0723ec c0084788 0007a120 c00687d4 00000004 00000001 c4cd3080 c006ac78
3e20: d0795004 d0795004 bf0680c4 00000000 00000000 c4de3ecc d0792000 d0792010
3e40: c4de3e8c c4de3e50 bf07bf08 bf0721d4 c4de3ecc 0007a120 c4de3e7c c4de3e68
3e60: c023fde8 00000000 c018f361 0000001b 0000001b 000003dc c4de2000 448d8d20
3e80: c4de3ef4 c4de3e90 bf0bde24 bf07bdb0 c018f361 448d8d20 d0792000 0007a120
3ea0: 00000000 007f78fc 00719824 45300ee8 c4de3edc a0000013 c4de3ee4 c4de3ec8
3ec0: c0243c84 c006884c c4de3f3c 00000000 00000000 c4d33a00 0000001b 0000001b
3ee0: 448d8d20 00000000 c4de3f04 c4de3ef8 c00d50d0 bf0bdcf8 c4de3f74 c4de3f08
3f00: c00d57e0 c00d50b4 00000000 00000000 448d8cf8 c4c9cf88 00000014 00000002
3f20: c6cfa5f0 00000000 c4de2000 00000000 c4de3f6c c4de3f40 c00c8934 c00f3824
3f40: 00000000 00000014 00000000 00000000 448d8d20 c018f361 0000001b c4d33a00
3f60: c4de2000 00000000 c4de3fa4 c4de3f78 c00d5878 c00d52ec c4de3fac 00000001
3f80: c03d6a84 448d8d20 c018f361 0082b20c 00000036 c0044fa8 00000000 c4de3fa8
3fa0: c0044e00 c00d582c 448d8d20 c018f361 0000001b c018f361 448d8d20 00000002
3fc0: 448d8d20 c018f361 0082b20c 00000036 007198dc 00719850 00719838 007198b8
3fe0: 007f9a68 448d8cf4 004ccaac 427a006c 20000010 0000001b 00000000 00000000
Backtrace:
[<c008477c>] (remove_wait_queue+0x0/0x44) from [<bf0723ec>] (OsalSemaphore_pend+0x224/0x2a8 [syslink])
[<bf0721c8>] (OsalSemaphore_pend+0x0/0x2a8 [syslink]) from [<bf07bf08>] (MessageQ_get+0x164/0x290 [syslink])
 r8:d0792010 r7:d0792000 r6:c4de3ecc r5:00000000 r4:00000000
[<bf07bda4>] (MessageQ_get+0x0/0x290 [syslink]) from [<bf0bde24>] (MessageQDrv_ioctl+0x138/0x9b8 [syslink])
[<bf0bdcec>] (MessageQDrv_ioctl+0x0/0x9b8 [syslink]) from [<c00d50d0>] (vfs_ioctl+0x28/0x44)
[<c00d50a8>] (vfs_ioctl+0x0/0x44) from [<c00d57e0>] (do_vfs_ioctl+0x500/0x540)
[<c00d52e0>] (do_vfs_ioctl+0x0/0x540) from [<c00d5878>] (sys_ioctl+0x58/0x7c)
[<c00d5820>] (sys_ioctl+0x0/0x7c) from [<c0044e00>] (ret_fast_syscall+0x0/0x30)
 r8:c0044fa8 r7:00000036 r6:0082b20c r5:c018f361 r4:448d8d20
Code: f10c0080 e59f3020 e5910010 e591200c (e5802000)
---[ end trace 4ee6d56f5050c3ff ]---

The function that closes the connections is a slightly modified version of the syslink demos:

Void dspcom_close(  )
{
    Int status=0;

    Osal_printf( "About to close DSP Communication\n");

	switch (gbl_com_handles.cleanupCode) {

        case 4:
        {
            Osal_printf( "About to delete message queue DSPToARMTeleQ\n");
            status = MessageQ_delete (&gbl_com_handles.DSPToARMTeleQ);
            if (status < 0)
			{
                Osal_printf ("MessageQ_delete DSPToARMTeleQ failed. Status [0x%xx]\n", status);
            }
            Osal_printf( "Message queue DSPToARMTeleQ deleted\n" );

            Osal_printf( "About to delete message queue DSPToARMResultQ\n");
            status = MessageQ_delete (&gbl_com_handles.DSPToARMResultQ);
            if (status < 0)
			{
                Osal_printf ("MessageQ_delete DSPToARMResultQ failed. Status [0x%xx]\n", status);
            }
            Osal_printf( "Message queue DSPToARMResultQ deleted\n" );
        }

        case 3:
        {
            Osal_printf( "About to close message queue ARMToDSPTeleQId\n");
            status = MessageQ_close (&gbl_com_handles.ARMToDSPTeleQId);
            if (status < 0) {
                Osal_printf ("MessageQ_close failed. Status [0x%xx]\n",
                             status);
            }
            else
            {
                Osal_printf ("MessageQ_close ARMToDSPTeleQId ok\n");
            }
        }

        case 2:
        {
            Osal_printf("About to unregister heapId %d\n", gbl_app_info.heapId );
            MessageQ_unregisterHeap (gbl_app_info.heapId);
            Osal_printf("unregistered heapId %d\n", gbl_app_info.heapId );

            Osal_printf("About to delete heapHandle %d\n", gbl_com_handles.heapHandle );
            status = HeapMemMP_delete (&gbl_com_handles.heapHandle);
            if (status < 0) {
                Osal_printf ("HeapMemMP_delete failed. Status [0x%xx]\n",
                             status);
            }
            else
            {
                Osal_printf ("HeapMemMP_delete ok\n");
            }
        }

        case 1:
        {
            Osal_printf("About to free shared memory heap\n");
            Memory_free (gbl_com_handles.srHeap, gbl_com_handles.pSharedMem, gbl_com_handles.heapSize);
            Osal_printf("Shared memory heap freed\n");
        }
        break;
    }
    Osal_printf ("Closed messageQs.\n");

    Osal_printf( "About to unregister notify events\n");
    Notify_unregisterEventSingle( DSP_PROC_ID, 0, DSPERROR_EVENT_NO );
    Osal_printf( "Notify events unregistered\n");

} // END dspcom_close

The output of the exiting application is

About to close DSP Communication
About to delete message queue DSPToARMTeleQ
Message queue DSPToARMTeleQ deleted
About to delete message queue DSPToARMResultQ
Message queue DSPToARMResultQ deleted
About to close message queue ARMToDSPTeleQId
MessageQ_close ARMToDSPTeleQId ok
About to unregister heapId 0
unregistered heapId 0
About to delete heapHandle 9227264
HeapMemMP_delete ok
About to free shared memory heap
Shared memory heap freed
Closed messageQs.
About to unregister notify events
Notify events unregistered

I see nothing unusual in my output. Another thread suggests, that the heap is deleted twice or not even initialized. I'm sure the latter is not the case, since communication worked perfect. I have no idea, where the former could happen. Any suggestions?

TIA,
Markus 

 

  • Hi Markus,

    Which Davinci platform are you using, and what version of SysLink?  Were you able to run the SysLink messageQ example between the Arm and the DSP?

    Best regards,

        Janet

  • Hello Janet,

    it's the TMS320DM8148, using Syslink 2.20.02.20, ipc 1.24.03.32.

    MessageQ is working like a charm, and has been for years now. It's very possible, that the mentionen error (which seems to have no further consequences) is there as long, but I've seen it only recently.

  • Ok, good to know the SysLink MessageQ example is working.  Looking at the kernel dump some more, it looks like a process call "DSPListenerThre" was waiting on MessageQ_get() when the problem occurred.  Is this your process?  Could you have deleted the MessageQ it was waiting on?

    Best regards,

        Janet

  • Hello Janet,

    Yes, that will be the reason. I have a thread that's waiting constantly for messages from the DSP and times out only every few minutes.

    So, how can I interrupt this MessageQ_get() when I want to quit the program?

    Thanks for your help,

    Markus

  • Could you have the DSP send the thread a message indicating that it's shutting down?  This will unblock the MessageQ_get().  In the App_delete() function of the SysLink MessageQ example, there is handshaking to make sure resources aren't deleted that are still being used.  Maybe you can try that sort of model.

    Best regards,

        Janet

  • Hi Markus,

    There is another possible solution that may be better for you.  A function called MessageQ_unblock() has been added to SysLink for this type of situation.  Here is the documentation for MessageQ_unblock():

     *  Unblocks a reader thread that is blocked on a MessageQ_get().  The
     *  MessageQ_get() call will return with status #MessageQ_E_UNBLOCKED indicating
     *  that it returned due to a MessageQ_unblock() rather than a timeout or a
     *  received message.  This call should only be used during a shutdown sequence
     *  in order to ensure that there is no blocked reader on a queue before
     *  deleting the queue.  A queue may not be used after it has been unblocked.
     *
     *  MessageQ_unblock() works by raising a flag in the queue indicating that it
     *  is unblocked and then signaling the synchronizer that is configured with
     *  the target queue.  If MessageQ_unblock() is called upon a queue that has
     *  no blocked listeners, then any subsequent MessageQ_get will not block and
     *  will immediately return #MessageQ_E_UNBLOCKED regardless of whether there
     *  is a message on the queue.
     *
     *  Restrictions:
     *  -  A queue may not be used after it has been unblocked.
     *  -  MessageQ_unblock() may only be called on a local queue.
     *  -  May only be used with a queue configured with a blocking synchronizer.

    So your dspcom_close() function can call MessageQ_unblock() with the MessageQ handle that the listener thread is blocked on.  When the listener thread returns from MessageQ_get(), it should check the status to see if it is MessageQ_E_UNBLOCKED.  I think this will be easier to use than having the DSP send a message that it is shutting down.

    Best regards,

        Janet

  • Hello Janet,

    thanks for your help, this looks promising :)

    I'll try the MessageQ_unblock soon, I hope next week.

    cu

    Markus