[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [patch] fix serial locking


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Hollis Blanchard <hollisb@xxxxxxxxxx>
  • Date: Wed, 15 Jun 2005 16:00:49 -0500
  • Delivery-date: Wed, 15 Jun 2005 21:01:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi Keir, I'm having trouble with the serial locking patch from a couple
weeks ago, specifically serial_getc():
            spin_lock_irqsave(&port->lock, flags);
            ...
            if ( port->driver->getc(port, &c) )
                break;

            spin_unlock_irqrestore(&port->lock, flags);

That leaves port->lock locked, as soon as the first char is successfully
received. This patch fixes it for me:

--- 1.36/xen/drivers/char/serial.c      2005-06-10 13:20:06 -05:00
+++ edited/drivers/char/serial.c        2005-06-15 15:54:11 -05:00
@@ -171,6 +171,8 @@
     do {
         for ( ; ; )
         {
+            int received;
+
             spin_lock_irqsave(&port->lock, flags);

             if ( port->rxbufp != port->rxbufc )
@@ -179,10 +181,12 @@
                 break;
             }

-            if ( port->driver->getc(port, &c) )
-                break;
+            received = port->driver->getc(port, &c);

             spin_unlock_irqrestore(&port->lock, flags);
+
+            if (received)
+                break;

             cpu_relax();
         }


Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

Should I take this to mean that almost nobody uses serial console?

-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.