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

[Xen-devel] [PATCH 1/5] xen: add tainted state and show warning is gcov is enabled



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
The location of warning_add() is a bit arbitrary because gcov doesn't
have an initialisation routine.

Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/common/gcov/gcov.c     | 5 +++++
 xen/common/kernel.c        | 6 ++++--
 xen/drivers/char/console.c | 9 +++++++++
 xen/include/xen/lib.h      | 1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/common/gcov/gcov.c b/xen/common/gcov/gcov.c
index b5717b9..6d18729 100644
--- a/xen/common/gcov/gcov.c
+++ b/xen/common/gcov/gcov.c
@@ -23,6 +23,11 @@
 #include <public/xen.h>
 #include <public/gcov.h>
 
+const char __initconst warning_gcov[] =
+    "WARNING: GCOV SUPPORT IS ENABLED\n"
+    "This option is *ONLY* intended to aid testing of Xen.\n"
+    "Please *DO NOT* use this in production.\n";
+
 static struct gcov_info *info_list;
 
 /*
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 2d3db64..324cc24 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -173,6 +173,7 @@ unsigned int tainted;
  *
  *  'C' - Console output is synchronous.
  *  'E' - An error (e.g. a machine check exceptions) has been injected.
+ *  'G' - GCov support is enabled.
  *  'H' - HVM forced emulation prefix is permitted.
  *  'M' - Machine had a machine check experience.
  *
@@ -182,11 +183,12 @@ char *print_tainted(char *str)
 {
     if ( tainted )
     {
-        snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c",
+        snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c",
                  tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
                  tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ',
                  tainted & TAINT_ERROR_INJECT ? 'E' : ' ',
-                 tainted & TAINT_HVM_FEP ? 'H' : ' ');
+                 tainted & TAINT_HVM_FEP ? 'H' : ' ',
+                 tainted & TAINT_GCOV ? 'G' : ' ');
     }
     else
     {
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 650035d..77604f9 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -792,6 +792,10 @@ void __init console_init_postirq(void)
     console_init_ring();
 }
 
+#ifdef CONFIG_GCOV
+extern char warning_gcov[];
+#endif
+
 void __init console_endboot(void)
 {
     printk("Std. Loglevel: %s", loglvl_str(xenlog_lower_thresh));
@@ -802,6 +806,11 @@ void __init console_endboot(void)
         printk(" (Rate-limited: %s)", loglvl_str(xenlog_guest_upper_thresh));
     printk("\n");
 
+#ifdef CONFIG_GCOV
+    warning_add(warning_gcov);
+    add_taint(TAINT_GCOV);
+#endif
+
     warning_print();
 
     video_endboot();
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index e518adc..7bcc910 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -143,6 +143,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
 #define TAINT_MACHINE_CHECK             (1u << 1)
 #define TAINT_ERROR_INJECT              (1u << 2)
 #define TAINT_HVM_FEP                   (1u << 3)
+#define TAINT_GCOV                      (1u << 4)
 extern unsigned int tainted;
 #define TAINT_STRING_MAX_LEN            20
 extern char *print_tainted(char *str);
-- 
2.1.4


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

 


Rackspace

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