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

[Xen-changelog] [xen master] xen: add warning infrastructure



commit ee3fd57acd903f1b302290a0a1019d3db95aa259
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Thu Jun 23 16:10:27 2016 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Jun 23 16:57:14 2016 +0100

    xen: add warning infrastructure
    
    Use an array to keep track of warning text, provide a function to add
    warning text to track.  Print warnings (if any) in console_endboot.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/common/Makefile        |  1 +
 xen/common/warning.c       | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 xen/drivers/char/console.c |  3 +++
 xen/include/xen/warning.h  |  7 ++++++
 4 files changed, 66 insertions(+)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index e9893e2..dbf00c6 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -59,6 +59,7 @@ obj-y += vm_event.o
 obj-y += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
+obj-bin-y += warning.init.o
 obj-$(CONFIG_XENOPROF) += xenoprof.o
 obj-y += xmalloc_tlsf.o
 
diff --git a/xen/common/warning.c b/xen/common/warning.c
new file mode 100644
index 0000000..8bdd299
--- /dev/null
+++ b/xen/common/warning.c
@@ -0,0 +1,55 @@
+#include <xen/delay.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/softirq.h>
+#include <xen/warning.h>
+
+#define WARNING_ARRAY_SIZE 20
+static unsigned int __initdata nr_warnings;
+static const char *__initdata warnings[WARNING_ARRAY_SIZE];
+
+void __init warning_add(const char *warning)
+{
+    if ( nr_warnings >= WARNING_ARRAY_SIZE )
+        panic("Too many pieces of warning text.");
+
+    warnings[nr_warnings] = warning;
+    nr_warnings++;
+}
+
+void __init warning_print(void)
+{
+    unsigned int i, j;
+
+    if ( !nr_warnings )
+        return;
+
+    printk("***************************************************\n");
+
+    for ( i = 0; i < nr_warnings; i++ )
+    {
+        printk("%s", warnings[i]);
+        printk("***************************************************\n");
+    }
+
+    for ( i = 0; i < 3; i++ )
+    {
+        printk("%u... ", 3 - i);
+        for ( j = 0; j < 100; j++ )
+        {
+            process_pending_softirqs();
+            mdelay(10);
+        }
+    }
+    printk("\n");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index f4f6141..ac21caf 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -25,6 +25,7 @@
 #include <xen/video.h>
 #include <xen/kexec.h>
 #include <xen/ctype.h>
+#include <xen/warning.h>
 #include <asm/debugger.h>
 #include <asm/div64.h>
 #include <xen/hypercall.h> /* for do_console_io */
@@ -796,6 +797,8 @@ void __init console_endboot(void)
         printk(" (Rate-limited: %s)", loglvl_str(xenlog_guest_upper_thresh));
     printk("\n");
 
+    warning_print();
+
     if ( opt_sync_console )
     {
         printk("**********************************************\n");
diff --git a/xen/include/xen/warning.h b/xen/include/xen/warning.h
new file mode 100644
index 0000000..c0661d5
--- /dev/null
+++ b/xen/include/xen/warning.h
@@ -0,0 +1,7 @@
+#ifndef _WARNING_H_
+#define _WARNING_H_
+
+void warning_add(const char *warning);
+void warning_print(void);
+
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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