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

[Xen-devel] [PATCH] xen, x86: turn the selftests ASSERT into a warning



On selftests failure, print a very visible warning instead of crashing
over an ASSERT.

Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

diff --git a/xen/arch/x86/extable.c b/xen/arch/x86/extable.c
index 72f30d9..9b834a2 100644
--- a/xen/arch/x86/extable.c
+++ b/xen/arch/x86/extable.c
@@ -9,6 +9,7 @@
 #include <xen/domain_page.h>
 #include <xen/virtual_region.h>
 #include <xen/livepatch.h>
+#include <xen/warning.h>
 
 #define EX_FIELD(ptr, field) ((unsigned long)&(ptr)->field + (ptr)->field)
 
@@ -145,6 +146,7 @@ static int __init stub_selftest(void)
     };
     unsigned long addr = this_cpu(stubs.addr) + STUB_BUF_SIZE / 2;
     unsigned int i;
+    bool fail = false;
 
     printk("Running stub recovery selftests...\n");
 
@@ -168,8 +170,15 @@ static int __init stub_selftest(void)
                        _ASM_EXTABLE(.Lret%=, .Lfix%=)
                        : [exn] "+m" (res)
                        : [stb] "r" (addr), "a" (tests[i].rax));
-        ASSERT(res == tests[i].res.raw);
+        if ( res != tests[i].res.raw )
+        {
+            printk("Selftest nr=%d failed!\n", i);
+            fail = true;
+        }
     }
+    if ( fail )
+        warning_add("THE HARDWARE IS DEFECTIVE\n"
+                    "CORRECT BEHAVIOR CANNOT BE GUARANTEED\n");
 
     return 0;
 }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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