|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 1/3] 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) right before finishing
using the console.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/setup.c | 3 +++
xen/common/Makefile | 1 +
xen/common/warning.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
xen/include/xen/warning.h | 7 +++++++
4 files changed, 61 insertions(+)
create mode 100644 xen/common/warning.c
create mode 100644 xen/include/xen/warning.h
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6f6a6a7..3ef8c43 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -28,6 +28,7 @@
#include <xen/tmem_xen.h>
#include <xen/virtual_region.h>
#include <xen/watchdog.h>
+#include <xen/warning.h>
#include <public/version.h>
#include <compat/platform.h>
#include <compat/xen.h>
@@ -1582,6 +1583,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)
init_constructors();
+ warning_print();
+
console_endboot();
/* Hide UART from DOM0 if we're using it */
diff --git a/xen/common/Makefile b/xen/common/Makefile
index e9893e2..600b5ce 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-y += warning.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..8a3e904
--- /dev/null
+++ b/xen/common/warning.c
@@ -0,0 +1,50 @@
+#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;
+
+ for ( i = 0; i < nr_warnings; i++ )
+ printk("%s", warnings[i]);
+
+ 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/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
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |