You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/05/11 02:07:59 UTC

[GitHub] [incubator-nuttx] YuuichiNakamura opened a new pull request #1023: Fix setlogmask() not to use enter_critical_section() in protected build

YuuichiNakamura opened a new pull request #1023:
URL: https://github.com/apache/incubator-nuttx/pull/1023


   ## Summary
   Replace enter/leave_critical_section() to pthread_mutex_lock/unlock() in protected build.
   
   ## Impact
   Affects to non-flat build for user mode library
   
   ## Testing
   Tried to call setlogmask() in RISC-V protected build. The build break was fixed and it worked well.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1023: Fix setlogmask() not to use enter_critical_section() in protected build

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1023:
URL: https://github.com/apache/incubator-nuttx/pull/1023#discussion_r422773452



##########
File path: libs/libc/syslog/lib_setlogmask.c
##########
@@ -91,17 +96,29 @@ uint8_t g_syslog_mask = LOG_ALL;
 int setlogmask(int mask)
 {
   uint8_t oldmask;
+
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)

Review comment:
       The better fix is either:
   1.remove the critical section or
   2.replace with mutex/semphare
   The mix just make the logic more complex and unmaintainable




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1023: Fix setlogmask() not to use enter_critical_section() in protected build

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #1023:
URL: https://github.com/apache/incubator-nuttx/pull/1023#discussion_r422782172



##########
File path: libs/libc/syslog/lib_setlogmask.c
##########
@@ -91,17 +96,29 @@ uint8_t g_syslog_mask = LOG_ALL;
 int setlogmask(int mask)
 {
   uint8_t oldmask;
+
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)

Review comment:
       > 
   > 
   > The better fix is either:
   > 1.remove the critical section or
   > 2.replace with mutex/semphare
   > The mix just make the logic more complex and unmaintainable
   
   A pthread mutex cannot be across task groups (or at least should not because it breaks the usaage model).  "pshared" semaphores (only) would be okay but would probably need to created via sem_open().
   
   Test and set could probably also be used but is not available in all 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] YuuichiNakamura commented on a change in pull request #1023: Fix setlogmask() not to use enter_critical_section() in protected build

Posted by GitBox <gi...@apache.org>.
YuuichiNakamura commented on a change in pull request #1023:
URL: https://github.com/apache/incubator-nuttx/pull/1023#discussion_r422806850



##########
File path: libs/libc/syslog/lib_setlogmask.c
##########
@@ -91,17 +96,29 @@ uint8_t g_syslog_mask = LOG_ALL;
 int setlogmask(int mask)
 {
   uint8_t oldmask;
+
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)

Review comment:
       Thanks and sorry for my incomplete understanding for NuttX task group model. I found that pthread_mutex is not prefer for this case.
   
   As the Greg's last comment in ML, Do I just need to remove the critical section in this case because setlogmask() have no need to concern about MT-safe ?
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org