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

[Xen-devel] [PATCH] xen/console: Add domain ID to output if VERBOSE



When compiling with VERBOSE, any domain can output to the serial
console; add a domain ID prefix similar to the (XEN) prefix used by the
hypervisor to make it possible to distinguish the source of each
message. This is especially useful for debugging stub domains.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 xen/drivers/char/console.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index e10bed5..ccef303 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -324,6 +324,10 @@ static long guest_console_write(XEN_GUEST_HANDLE(char) 
buffer, int count)
 {
     char kbuf[128], *kptr;
     int kcount;
+#ifdef VERBOSE
+    static domid_t active = DOMID_IDLE;
+    char pbuf[10];
+#endif
 
     while ( count > 0 )
     {
@@ -339,6 +343,18 @@ static long guest_console_write(XEN_GUEST_HANDLE(char) 
buffer, int count)
 
         spin_lock_irq(&console_lock);
 
+#ifdef VERBOSE
+        snprintf(pbuf, sizeof(pbuf), "(%d) ", current->domain->domain_id);
+        if (active != current->domain->domain_id) {
+            sercon_puts(pbuf);
+            vga_puts(pbuf);
+
+            active = current->domain->domain_id;
+        }
+        if (strchr(kbuf, '\n'))
+            active = DOMID_IDLE;
+#endif
+
         sercon_puts(kbuf);
         vga_puts(kbuf);
 
-- 
1.7.11.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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