WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch] fix serial locking

To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [patch] fix serial locking
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Wed, 15 Jun 2005 16:00:49 -0500
Delivery-date: Wed, 15 Jun 2005 21:01:37 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>