multithread problem in zephyr application


Li, Jun R
 

Hi everyone,

 

I got a strange issue on my multi-threaded application. Sometimes, my application crashes due to the error like below:

 

  Executing thread ID (thread): 0x20000c4c

  Faulting instruction address:  0x8010c16

  Imprecise data bus error

Fatal fault in ISR! Spinning...

 

I checked the address 0x8010c16 and found the crashed point is below:

/* must be called with interrupts locked */

static inline void _thread_priority_set(struct k_thread *thread, int prio)

{

    if (_is_thread_ready(thread)) {

        _remove_thread_from_ready_q(thread);

8010c04:   f000 fbe2   bl  80113cc <_remove_thread_from_ready_q>

        thread->base.prio = prio;

8010c08:   72a5        strb    r5, [r4, #10]

        _add_thread_to_ready_q(thread);

8010c0a:   4620        mov r0, r4

            'y' : 'n',

            new_prio, mutex->owner->base.prio);

 

        _thread_priority_set(mutex->owner, new_prio);

    }

}

8010c0c:   e8bd 4038   ldmia.w sp!, {r3, r4, r5, lr}

8010c10:   f000 bbb4   b.w 801137c <_add_thread_to_ready_q>

    } else {

        thread->base.prio = prio;

8010c14:   72a5        strb    r5, [r4, #10]

8010c16:   bd38        pop {r3, r4, r5, pc}

 

I have no idea why the application crashes at this address, is it like a thread racing condition problem or the thread stack overflow happened?

 

By the way, how can I check which thread crashes with the thread ID “20000c4c”?

 

Thank you!

 

Regards,

Jun Li

 


Boie, Andrew P
 

Ø I have no idea why the application crashes at this address, is it like a thread racing condition problem or the thread stack overflow happened?

 

My money would be on stack overflow. You can try to enable the MPU (if supported) or enable CONFIG_STACK_SENTINEL to try to establish if this is the case. Stack overflows tend to cause all kinds of impossible/baffling behavior.

 

Ø By the way, how can I check which thread crashes with the thread ID “20000c4c”?

 

The address should resolve to an instance of struct k_thread in the symbol table.

 

HTH,

Andrew