-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: kernel: mem_protect: sys_sem: failed when CONFIG_FPU is activated #28014
Comments
^^ @erwango |
Just a guess here, but this might be some kind of stack corruption. There are some complexities related to saving/restoring FPU state on this arch, and it's done lazily by the CPU. |
I made the same guess during my analysis.
but without success. |
I don't mean to say a stack overflow problem (you get specific fatal errors labeled "Stack Overflow" for that), but possibly stack frame corruption due to the "lazy stacking" mechanism this CPU does with FPU state. |
@ABOSTM I am not able to reproduce this issue (on v2.4.0-rc1 tag) on any of the platforms below, with CONFIG_FPU=y
...when I am using a GNU ARM Embedded toolchain. I can reproduce this with the Zephyr SDK, though. @andrewboie the lazy stacking feature is not enabled in this scenario (it requires CONFIG_FPU_SHARING=y as well). So I do not think there's a memory corruption of this kind. I tried increasing the STACK_SIZE from 512 to 1024 in this test and I could still reproduce the problem. It is probably something else. Could it be related to the toolchain flags which get enabled with CONFIG_FPU? |
Raising priority to medium, for now. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
I think this might be related to the other open bugs related to FPU register corruption. |
Describe the bug
tests/kernel/mem_protect/sys_sem/ fails on stm32f3_disco (on test bench).
Issue appears with commit that enable MPU (sha1: 6f55614)
Probably because CONFIG_USERSPACE=y is required to reproduce the issue.
In this test, 3 tasks, with 3 different priorities (low mid high) are waiting on the same semaphore:
multiple_thread_sem
When in function
test_sem_take_multiple()
the semaphore is released 1 time (line 371), only high priority task should be scheduled.In fact, I observed that after high priority task ends, the mid priority task check again for the semaphore (while loop of sys_sem_take()) and it should be suspended by execution of k_futex_wait().
But k_futex_wait() fails: it return -60 (-ETIMEDOUT), so task continues its execution and it generates the error.
After some investigations, I found that CONFIG_FPU is enabled by default on stm32f3_disco, and if I disable it, issue vanished.
And the same for stm32373c_eval board.
So I tried the reverse: I activated CONFIG_FPU on some other boards (that don't have it by default),
the status is the same:
when CONFIG_FPU is Deactivated there is no issue,
but when CONFIG_FPU is activated, problem occurs.
So issue seems independent from vendor, but linked to FPU activation (and ARM_MPU).
Note: when I activated CONFIG_NO_OPTIMIZATIONS for debug purpose, I could not reproduce the issue.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
test passed
Logs and console output
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: