]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
xen/hvc: make sure console output is always emitted, with explicit polling
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Tue, 20 Oct 2009 06:28:21 +0000 (15:28 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:22:40 +0000 (16:22 -0800)
commit 7825cf10e31c64ece3cac66fb01a742f1094da51 upstream.

We never want to rely on the hvc workqueue to emit output, because the
most interesting output is when the kernel is broken.  This will
improve oops/crash/console message for better debugging.

Instead, we force-poll until all output is emitted.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/hvc_xen.c

index eba999f8598d07a8a29fe03bac5bb4de18d39f62..ae453cc25a661d6f43a840809d5e4256ccbcb0fa 100644 (file)
@@ -55,7 +55,7 @@ static inline void notify_daemon(void)
        notify_remote_via_evtchn(xen_start_info->console.domU.evtchn);
 }
 
-static int write_console(uint32_t vtermno, const char *data, int len)
+static int __write_console(const char *data, int len)
 {
        struct xencons_interface *intf = xencons_interface();
        XENCONS_RING_IDX cons, prod;
@@ -76,6 +76,29 @@ static int write_console(uint32_t vtermno, const char *data, int len)
        return sent;
 }
 
+static int write_console(uint32_t vtermno, const char *data, int len)
+{
+       int ret = len;
+
+       /*
+        * Make sure the whole buffer is emitted, polling if
+        * necessary.  We don't ever want to rely on the hvc daemon
+        * because the most interesting console output is when the
+        * kernel is crippled.
+        */
+       while (len) {
+               int sent = __write_console(data, len);
+
+               data += sent;
+               len -= sent;
+
+               if (unlikely(len))
+                       HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+       }
+
+       return ret;
+}
+
 static int read_console(uint32_t vtermno, char *buf, int len)
 {
        struct xencons_interface *intf = xencons_interface();