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] pv-grub: fix boot crash when no fb is available

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] pv-grub: fix boot crash when no fb is available
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Date: Sun, 4 Apr 2010 19:18:46 +0200
Cc: dpquigl@xxxxxxxxxxxxx, jeremy@xxxxxxxx
Delivery-date: Sun, 04 Apr 2010 10:19:22 -0700
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, dpquigl@xxxxxxxxxxxxx, jeremy@xxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
pv-grub: fix boot crash when no fb is available

When no fb is available, init_fbfront will return, so the local
semaphore for synchronization with the kbd thread would get dropped.
Using a global static semaphore instead fixes this.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

diff -r 8dada4c897c9 stubdom/grub/mini-os.c
--- a/stubdom/grub/mini-os.c    Sat Mar 06 13:31:42 2010 +0000
+++ b/stubdom/grub/mini-os.c    Sun Apr 04 19:13:06 2010 +0200
@@ -651,12 +651,11 @@
     return 0;
 }
 
+static DECLARE_MUTEX_LOCKED(kbd_sem);
 static void kbd_thread(void *p)
 {
-    struct semaphore *sem = p;
-
     kbd_dev = init_kbdfront(NULL, 1);
-    up(sem);
+    up(&kbd_sem);
 }
 
 struct fbfront_dev *fb_open(void *fb, int width, int height, int depth)
@@ -665,10 +664,9 @@
     int linesize = width * (depth / 8);
     int memsize = linesize * height;
     int numpages = (memsize + PAGE_SIZE - 1) / PAGE_SIZE;
-    DECLARE_MUTEX_LOCKED(sem);
     int i;
 
-    create_thread("kbdfront", kbd_thread, &sem);
+    create_thread("kbdfront", kbd_thread, &kbd_sem);
 
     mfns = malloc(numpages * sizeof(*mfns));
     for (i = 0; i < numpages; i++) {
@@ -681,7 +679,7 @@
     if (!fb_dev)
         return NULL;
 
-    down(&sem);
+    down(&kbd_sem);
     if (!kbd_dev)
         return NULL;
 

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