xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: xen-devel@lists.xensource.com
Cc: dpquigl@tycho.nsa.gov, jeremy@goop.org
Subject: [PATCH] pv-grub: fix boot crash when no fb is available
Date: Sun, 4 Apr 2010 19:18:46 +0200	[thread overview]
Message-ID: <20100404171846.GL3973@const.famille.thibault.fr> (raw)

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@ens-lyon.org>

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;

             reply	other threads:[~2010-04-04 17:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-04 17:18 Samuel Thibault [this message]
2010-04-05 13:40 ` [PATCH] pv-grub: fix boot crash when no fb is available David P. Quigley
2010-04-05 15:16   ` Samuel Thibault
2010-04-05 15:17     ` David P. Quigley
2010-04-05 21:57       ` Samuel Thibault
2010-04-06 15:42         ` David P. Quigley
2010-04-06 18:16           ` Jeremy Fitzhardinge
2010-04-06 18:22             ` David P. Quigley
2010-04-06 19:17               ` Jeremy Fitzhardinge
2010-04-06 22:28                 ` Daniel Stodden
2010-04-06 21:47           ` Samuel Thibault
2010-04-13 14:55             ` David P. Quigley
2010-04-13 15:12               ` Keir Fraser
2010-04-13 17:16               ` Jeremy Fitzhardinge
2011-04-28 10:56               ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100404171846.GL3973@const.famille.thibault.fr \
    --to=samuel.thibault@ens-lyon.org \
    --cc=dpquigl@tycho.nsa.gov \
    --cc=jeremy@goop.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).