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 2022/02/06 19:07:47 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5429: serial/pty: Don't use shced_[lock|unlock] to protect pp_locked

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


   ## Summary
   since the sched lock can't work in SMP context
   
   - serial/pty: Destroy pp_slavesem in pty_destroy to avoid the leak
   - serial/pty: Should return -ENOTTY not ENOTTY when ioctl can't be handled
   
   ## Impact
   Fix the issue on SMP
   
   ## Testing
   Local test
   


-- 
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] [incubator-nuttx] xiaoxiang781216 commented on pull request #5429: serial/pty: Don't use shced_[lock|unlock] to protect pp_locked

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5429:
URL: https://github.com/apache/incubator-nuttx/pull/5429#issuecomment-1032159373


   ping @acassis 


-- 
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] [incubator-nuttx] acassis merged pull request #5429: serial/pty: Don't use shced_[lock|unlock] to protect pp_locked

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #5429:
URL: https://github.com/apache/incubator-nuttx/pull/5429


   


-- 
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] [incubator-nuttx] acassis commented on a change in pull request #5429: serial/pty: Don't use shced_[lock|unlock] to protect pp_locked

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



##########
File path: drivers/serial/pty.c
##########
@@ -278,67 +278,51 @@ static int pty_open(FAR struct file *filep)
   DEBUGASSERT(dev != NULL && dev->pd_devpair != NULL);
   devpair = dev->pd_devpair;
 
+  /* Get exclusive access to the device structure */
+
+  ret = pty_semtake(devpair);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   /* Wait if this is an attempt to open the slave device and the slave
    * device is locked.
    */
 
   if (!dev->pd_master)
     {
-      /* Slave... Check if the slave driver is locked.  We need to lock the
-       * scheduler while we are running to prevent asyncrhonous modification
-       * of pp_locked by pty_ioctl().
-       */
+      /* Slave... Check if the slave driver is locked. */
 
-      sched_lock();
       while (devpair->pp_locked)
         {
+          /* Release the exclusive acces before wait */

Review comment:
       ```suggestion
             /* Release the exclusive access before wait */
   ```




-- 
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] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5429: serial/pty: Don't use shced_[lock|unlock] to protect pp_locked

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



##########
File path: drivers/serial/pty.c
##########
@@ -278,67 +278,51 @@ static int pty_open(FAR struct file *filep)
   DEBUGASSERT(dev != NULL && dev->pd_devpair != NULL);
   devpair = dev->pd_devpair;
 
+  /* Get exclusive access to the device structure */
+
+  ret = pty_semtake(devpair);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   /* Wait if this is an attempt to open the slave device and the slave
    * device is locked.
    */
 
   if (!dev->pd_master)
     {
-      /* Slave... Check if the slave driver is locked.  We need to lock the
-       * scheduler while we are running to prevent asyncrhonous modification
-       * of pp_locked by pty_ioctl().
-       */
+      /* Slave... Check if the slave driver is locked. */
 
-      sched_lock();
       while (devpair->pp_locked)
         {
+          /* Release the exclusive acces before wait */

Review comment:
       Done.




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