xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 1/5] xen: add tainted state and show warning is gcov is enabled
Date: Fri, 2 Sep 2016 12:47:05 +0100	[thread overview]
Message-ID: <1472816829-15551-2-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1472816829-15551-1-git-send-email-wei.liu2@citrix.com>

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

Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 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@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-09-02 11:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 11:47 [PATCH 0/5] gcov: more cleanup Wei Liu
2016-09-02 11:47 ` Wei Liu [this message]
2016-09-02 11:56   ` [PATCH 1/5] xen: add tainted state and show warning is gcov is enabled Jan Beulich
2016-09-02 12:01     ` Wei Liu
2016-09-02 12:06       ` Jan Beulich
2016-09-02 12:13         ` Andrew Cooper
2016-09-02 12:26           ` Jan Beulich
2016-09-02 12:30             ` Andrew Cooper
2016-09-02 13:34               ` Wei Liu
2016-09-02 13:21       ` Julien Grall
2016-09-02 13:34         ` Wei Liu
2016-09-02 11:47 ` [PATCH 2/5] gcov: collect more sections to constructor list Wei Liu
2016-09-02 11:58   ` Jan Beulich
2016-09-02 12:12     ` Wei Liu
2016-09-05 10:10   ` Julien Grall
2016-09-02 11:47 ` [PATCH 3/5] xen: replace TEST_COVERAGE with CONFIG_GCOV Wei Liu
2016-09-02 11:59   ` Jan Beulich
2016-09-19 14:30   ` Ian Jackson
2016-09-02 11:47 ` [PATCH 4/5] gcov: add option to determine gcov format Wei Liu
2016-09-02 12:01   ` Jan Beulich
2016-09-02 12:08     ` Wei Liu
2016-09-02 15:43       ` Wei Liu
2016-09-06  8:34   ` Wei Liu
2016-09-02 11:47 ` [PATCH 5/5] gcov: split out gcc version specific stuff Wei Liu
2016-09-02 12:04 ` [PATCH 0/5] gcov: more cleanup Andrew Cooper
2016-09-02 12:06   ` Wei Liu
2016-09-02 12:15     ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472816829-15551-2-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).