tests: SMP: Two threads synchronize failed using mutex or semaphore while both doing irq_lock() #33551
Labels
area: Kernel
area: SMP
Symmetric multiprocessing
area: Tests
Issues related to a particular existing or missing test
bug
The issue is a bug, or the PR is fixing a bug
priority: medium
Medium impact/importance bug
Describe the bug
Given two threads synchronize by using mutex or semaphore, under they both lock interrupt by irq_lock(), it would hang up when the second thread call k_mutex_lock() or k_sem_take().
Please see the new added test case in PR #31010
,which are test_smp_irq_lock_sem() and test_smp_irq_lock_sem().
We know zehpyr has such a mechanism:
while call irq_lock(), interrupts remain disabled only while the thread is running. If the thread performs an operation that allows another thread to run (for example, giving a semaphore or sleeping for N milliseconds), the interrupt lock no longer applies, and
interrupts may be re-enabled while other processing occurs.
We were not sure if this is normal behavior or a correct user case, so please help to clarify this.
To Reproduce
Steps to reproduce the behavior:
or twister -T tests/kernel/smp (failed on qemu_x86_64, qemu_x86_64_kpti, qemu_cortex_a53_smp)
Expected behavior
test cases test_smp_irq_lock_sem() and test_smp_irq_lock_sem() pass as expected.
Impact
If there are user scenarios like this, two threads both lock interrupt and they sync synchronize by using mutex or semaphore, would hang up.
Logs and console output
Environment (please complete the following information):
Additional context
This is an unmerged test case.
The text was updated successfully, but these errors were encountered: