mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
9808c130f0
commit
ee3fd57acd
4 files changed
+66
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
*/
|
||||
@@ -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");
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef _WARNING_H_
|
||||
#define _WARNING_H_
|
||||
|
||||
void warning_add(const char *warning);
|
||||
void warning_print(void);
|
||||
|
||||
#endif
|
||||