eclipse-threadx / threadx

Eclipse ThreadX is an advanced real-time operating system (RTOS) designed specifically for deeply embedded applications.
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx/index.md
MIT License
2.88k stars 784 forks source link

Dead lock in TX_DISABLE in smp system #179

Closed carll00226 closed 1 year ago

carll00226 commented 2 years ago

Now we use a two-core smp system and found that when core0 execute TX_DISABLE, it found the tx_thread_smp_protect_in_force is 1, and goto _try_to_get_lock , but core1 did not own the lock and nobody will clear the tx_thread_smp_protect_in_force to 0, so core0 get into dead lock. Now I don't know how to debug this problem and it's a low probability event,would you please give me some advices? thank a lot !

goldscott commented 2 years ago

What port are you using?

carll00226 commented 2 years ago

I’m using arm cortex-R8 smp system and port from threadx/ports_smp/cortex_a9_smp/gnu.

carll00226 commented 2 years ago

I find that the tx_thread_smp_protect_in_force operation has changed into LDAXR in arm-v8 in latest release, but it's still LDR in arm-v7, why?

goldscott commented 2 years ago

Hi @carll00226, we know about this deadlock issue and are actively working on it. We should have it fixed in our next release. If you would like it sooner, please contact azure-rtos-support@microsoft.com.

Regarding your question about LDAXR, I believe we need to bring these changes from v8-A into the v7-A ports. Thanks for bringing this up!

vks3 commented 2 years ago

Hi, I'm not sure if it's the same issue or not. But, we face a similar issue with the Cortex-A7 smp port. We have a 2-core device, but currently are using only the first core. Still, when multiple threads (3~4) then after a while there's a deadlock, because tx_thread_smp_protect_in_force is 1, but tx_thread_smp_protect_core is 0xFFFFFFFF. Although we are using a single core somehow we end up in a state where the the core is waiting to get a lock forever.

carll00226 commented 2 years ago

Hi: I remember that in our case, when core0 falls into dead lock, the tx_thread_smp_protect_in_force is 1 and the tx_thread_smp_protect_core is also 1. So it should be a smp issue in my system.. 发件人: vks3 @.> 发送时间: 2022年4月18日 0:38 收件人: azure-rtos/threadx @.> 抄送: 凌剑 @.>; Mention @.> 主题: Re: [azure-rtos/threadx] Dead lock in TX_DISABLE in smp system (Issue #179)

Hi, I'm not sure if it's the same issue or not. But, we face a similar issue with the Cortex-A7 smp port. We have a 2-core device, but currently are using only the first core. Still, when multiple threads (3~4) then after a while there's a deadlock, because tx_thread_smp_protect_in_force is 1, but tx_thread_smp_protect_core is 0xFFFFFFFF. Although we are using a single core somehow we end up in a state where the the core is waiting to get a lock forever.

— Reply to this email directly, view it on GitHubhttps://github.com/azure-rtos/threadx/issues/179#issuecomment-1100912240, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVAAVZ3PD6DVVWFIFASXTJDVFQ5AHANCNFSM5RAQGCJQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

goldscott commented 2 years ago

We have just removed the FIFO queuing from our ARMv8-A SMP ports. That will be available in our 6.1.11 release at the end of this month. The ARMv7-A SMP ports will be fixed in the next release around July. If you would like the fix sooner, please email azure-rtos-support@microsoft.com.

TiejunMS commented 1 year ago

No activity for a long time. Closing.