You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pussuw (via GitHub)" <gi...@apache.org> on 2024/10/22 13:24:16 UTC
[PR] syslog: Don't allow blocking when in signal handler [nuttx]
pussuw opened a new pull request, #14456:
URL: https://github.com/apache/nuttx/pull/14456
## Summary
Blocking while running a signal handler is not advisable, instead write the log string character by character.
There is also a potential for a deadlock, as discussed in #6618
Note: querying for rtcb->sigdeliver is not 100% ideal, as it only tells _if_ a signal handler has been queued, not if it is running. However, it makes syslog safe / usable which is a debug feature anyhow.
## Impact
Fixes syslog deadlock when CONFIG_SMP=y. Happens during ostest signal handler tests.
## Testing
qemu-rv:ksmp64
--
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
Re: [PR] syslog: Don't allow blocking when in signal handler [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #14456:
URL: https://github.com/apache/nuttx/pull/14456#discussion_r1811154657
##########
drivers/syslog/syslog_write.c:
##########
@@ -37,6 +37,39 @@
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: syslog_safe_to_block
+ *
+ * Description:
+ * Check if it is safe to block for write. If not, the write defaults to a
+ * non-blocking method.
+ *
+ * Input Parameters:
+ * None.
+ *
+ * Returned Value:
+ * true if it is safe to block; false otherwise.
+ *
+ ****************************************************************************/
+
+static bool syslog_safe_to_block(void)
+{
+ FAR const struct tcb_s *rtcb;
+
+ if (up_interrupt_context() || sched_idletask())
+ {
+ return false;
+ }
+
Review Comment:
Please include a comment here
--
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
Re: [PR] syslog: Don't allow blocking when in signal handler [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #14456:
URL: https://github.com/apache/nuttx/pull/14456
--
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
Re: [PR] syslog: Don't allow blocking when in signal handler [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #14456:
URL: https://github.com/apache/nuttx/pull/14456#discussion_r1811156390
##########
drivers/syslog/syslog_write.c:
##########
@@ -37,6 +37,39 @@
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: syslog_safe_to_block
+ *
+ * Description:
+ * Check if it is safe to block for write. If not, the write defaults to a
+ * non-blocking method.
+ *
+ * Input Parameters:
+ * None.
+ *
+ * Returned Value:
+ * true if it is safe to block; false otherwise.
+ *
+ ****************************************************************************/
+
+static bool syslog_safe_to_block(void)
+{
+ FAR const struct tcb_s *rtcb;
+
+ if (up_interrupt_context() || sched_idletask())
+ {
+ return false;
+ }
+
+ rtcb = nxsched_self();
Review Comment:
Please include a comment above nxsched_self()
--
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
Re: [PR] syslog: Don't allow blocking when in signal handler [nuttx]
Posted by "nuttxpr (via GitHub)" <gi...@apache.org>.
nuttxpr commented on PR #14456:
URL: https://github.com/apache/nuttx/pull/14456#issuecomment-2429311386
[**\[Experimental Bot, please feedback here\]**](https://github.com/search?q=repo%3Aapache%2Fnuttx+13552&type=issues)
The PR summary is missing some key information:
* **What functional part of the code is being changed?** Be specific, e.g., "the syslog implementation" or "signal handler execution".
* **How does the change exactly work?** Briefly explain the technical approach, like "Instead of blocking on the mutex, the log message is written one character at a time."
**Impact:**
* The impact section should clearly state YES/NO for each item, even if describing it further. For example:
* **Impact on user:** YES (Users relying on syslog within signal handlers will no longer experience deadlocks, particularly in SMP configurations)
* **Impact on build:** While likely NO, confirm this explicitly.
* **Impact on hardware:** This seems relevant as the issue mentions qemu-rv:ksmp64. Clarify if specific architectures or boards are impacted.
* **Impact on documentation:** Does this fix require any documentation updates?
**Testing:**
* The provided testing information is very minimal.
* Specify the build host details (OS, Compiler version).
* Instead of just stating "qemu-rv:ksmp64", describe the specific test case used to reproduce the deadlock before and how the fix addresses it.
**Overall:**
The PR summary needs more detail, and the impact and testing sections require additional information for a comprehensive review.
--
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
Re: [PR] syslog: Don't allow blocking when in signal handler [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #14456:
URL: https://github.com/apache/nuttx/pull/14456#discussion_r1811154657
##########
drivers/syslog/syslog_write.c:
##########
@@ -37,6 +37,39 @@
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: syslog_safe_to_block
+ *
+ * Description:
+ * Check if it is safe to block for write. If not, the write defaults to a
+ * non-blocking method.
+ *
+ * Input Parameters:
+ * None.
+ *
+ * Returned Value:
+ * true if it is safe to block; false otherwise.
+ *
+ ****************************************************************************/
+
+static bool syslog_safe_to_block(void)
+{
+ FAR const struct tcb_s *rtcb;
+
+ if (up_interrupt_context() || sched_idletask())
+ {
+ return false;
+ }
+
Review Comment:
Please include a comment here
--
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