You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "tmedicci (via GitHub)" <gi...@apache.org> on 2023/03/29 20:17:40 UTC
[GitHub] [nuttx] tmedicci opened a new issue, #8927: Potential problem regarding `sigdeliver` when SMP is enabled
tmedicci opened a new issue, #8927:
URL: https://github.com/apache/nuttx/issues/8927
## Summary
While delivering a signal to a task that is currently running on the other core (SMP-enabled), the `<arch>_sig_deliver` needs to leave the critical section first (previously forced). This should use the interrupt state (PS register on Xtensa, for instance) of the previously set registers explicitly for the signal handler. In most cases, however, `leave_critical_section` is called with the saved interrupt state as the input argument.
The saved state (saved registers prior to the task's interruption to treat the signal) should only be used when restoring the task's registers after signal handling.
## How to Reproduce
This problem was first identified on ESP32: it crashes while trying to deliver a signal to a task running on the other CPU. This behavior can be verified by selecting `EXAMPLES_ALARM` app and - in order to force the task to be running - omitting the `usleep` on `alarm_main.c`. Prior to this [PR](https://github.com/apache/nuttx/pull/8926), the application crashed while delivering the signal to the app.
## Is it a "System Bug"?
Potentially! `xtensa_sig_deliver` seems to have been inspired by other multi-core architectures. They are all very similar: `nuttx/arch/arm/src/armv7-m/arm_sigdeliver.c` is an example.
## What Have I Done?
I fixed it to Xtensa devices. Please refer to https://github.com/apache/nuttx/pull/8926
I can't test on other architectures, so I hope the community can help with it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] tmedicci commented on issue #8927: Potential problem regarding `sigdeliver` when SMP is enabled
Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on issue #8927:
URL: https://github.com/apache/nuttx/issues/8927#issuecomment-1489259655
Some more thoughts about it:
The `EXAMPLES_ALARM` app requires RTC driver to create a daemon and set an alarm that will deliver a signal to the application. This issue, however, has nothing to do with the RTC: I just used this app to test it. A simpler application could be implemented: the important thing is: SMP and forcing the app to be running on the other core (usually an infinite loop would force this).
I think @acassis was able to test `Spresense` (`armv7-m`). In fact, it failed to deliver a signal while the `alarm_daemon` is running indefinitely (without the `usleep`). It didn't crash, but the signal was not delivered (which worked with the unmodified version of the alarm app). However, this happened even without SMP being enabled. It does not seem to be related to this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] tmedicci commented on issue #8927: Potential problem regarding `sigdeliver` when SMP is enabled
Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on issue #8927:
URL: https://github.com/apache/nuttx/issues/8927#issuecomment-1505882700
As explained in the updated PR's description (https://github.com/apache/nuttx/pull/8926). The bug is specific to xtensa devices and should not affect other architectures.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] tmedicci closed issue #8927: Potential problem regarding `sigdeliver` when SMP is enabled
Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci closed issue #8927: Potential problem regarding `sigdeliver` when SMP is enabled
URL: https://github.com/apache/nuttx/issues/8927
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org