Skip to contentSkip to conversation

gcov: more cleanup

PATCH In review Wei Liu 4 participants 15 messages Sep 6, 2016 – Sep 7, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover gcov: more cleanup

Wei Liu (4):
xen: indicate gcov in log messages
gcov: collect more sections to constructor list
xen: replace TEST_COVERAGE with CONFIG_GCOV
xen: make clear gcov support limitation in Kconfig

 xen/Kconfig.debug           | 6 ++++++
 xen/Rules.mk                | 2 +-
 xen/arch/arm/traps.c        | 5 +++--
 xen/arch/arm/xen.lds.S      | 2 ++
 xen/arch/x86/x86_64/traps.c | 5 +++--
 xen/arch/x86/xen.lds.S      | 2 ++
 xen/common/sysctl.c         | 2 +-
 xen/drivers/char/console.c  | 5 +++--
 xen/include/xen/gcov.h      | 2 +-
 xen/include/xen/lib.h       | 6 ++++++
 10 files changed, 28 insertions(+), 9 deletions(-)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

PATCH v2 1/4 xen: indicate gcov in log messages

---
Cc: Stefano Stabellini <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/arm/traps.c        | 5 +++--
 xen/arch/x86/x86_64/traps.c | 5 +++--
 xen/drivers/char/console.c  | 5 +++--
 xen/include/xen/lib.h       | 6 ++++++
 4 files changed, 15 insertions(+), 6 deletions(-)
xen/arch/arm/traps.c +3 -2
index 683bcb2..3bac8e8 100644
@@ -141,14 +141,15 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  %s  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  %s  debug=%c gcov=%c  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
 #ifdef CONFIG_ARM_32
            "arm32",
 #else
            "arm64",
 #endif
-           debug_build() ? 'y' : 'n', print_tainted(taint_str));
+           debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n',
+           print_tainted(taint_str));
 }
 
 #ifdef CONFIG_ARM_32
xen/arch/x86/x86_64/traps.c +3 -2
index 2d8ecf5..0708cc7 100644
@@ -30,9 +30,10 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c gcov=%c %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
-           debug_build() ? 'y' : 'n', print_tainted(taint_str));
+           debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n',
+           print_tainted(taint_str));
 }
 
 enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest };
xen/drivers/char/console.c +3 -2
index 650035d..e773076 100644
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            xen_compile_by(), xen_compile_domain(),
-           xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date());
+           xen_compiler(), debug_build() ? 'y' : 'n',
+           gcov_build() ? 'y' : 'n', xen_compile_date());
     printk("Latest ChangeSet: %s\n", xen_changeset());
 
     if ( opt_sync_console )
xen/include/xen/lib.h +6 -0
index e518adc..464fb05 100644
@@ -26,6 +26,12 @@
 #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
 #endif
 
+#ifdef CONFIG_GCOV
+#define gcov_build() 1
+#else
+#define gcov_build() 0
+#endif
+
 #ifndef NDEBUG
 #define ASSERT(p) \
     do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v2 1/4] xen: indicate gcov in log messages

Quoted 57 lines · Wei Liu

---
Cc: Stefano Stabellini <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/arm/traps.c        | 5 +++--
 xen/arch/x86/x86_64/traps.c | 5 +++--
 xen/drivers/char/console.c  | 5 +++--
 xen/include/xen/lib.h       | 6 ++++++
 4 files changed, 15 insertions(+), 6 deletions(-)
xen/arch/arm/traps.c +3 -2
index 683bcb2..3bac8e8 100644
@@ -141,14 +141,15 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  %s  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  %s  debug=%c gcov=%c  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
 #ifdef CONFIG_ARM_32
            "arm32",
 #else
            "arm64",
 #endif
-           debug_build() ? 'y' : 'n', print_tainted(taint_str));
+           debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n',
+           print_tainted(taint_str));
 }
 
 #ifdef CONFIG_ARM_32
xen/arch/x86/x86_64/traps.c +3 -2
index 2d8ecf5..0708cc7 100644
@@ -30,9 +30,10 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c gcov=%c %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
-           debug_build() ? 'y' : 'n', print_tainted(taint_str));
+           debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n',
+           print_tainted(taint_str));
 }
 
 enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest };
xen/drivers/char/console.c +0 -0
index 650035d..e773076 100644

xen/drivers/char/console.c void __init console_init_preirq(void) · line 738

Quoted 5 lines
xen/drivers/char/console.c +1 -1
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",

Please instead use

printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" #ifdef CONFIG_GCOV
" gcov=y"
#endif
" %s\n",

Enabling gcov will be extremely rare in the grand scheme of things, and this method causes zero overhead for the case where gcov is compiled out. (Similarly elsewhere.)

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH v2 1/4] xen: indicate gcov in log messages

Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:47, <[email protected]> wrote:

xen/drivers/char/console.c void __init console_init_preirq(void) · line 738

Quoted 8 lines · Wei Liu
xen/drivers/char/console.c +1 -1
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",

Please instead use

printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" #ifdef CONFIG_GCOV
" gcov=y"
#endif
" %s\n",

Quoted 3 lines

Enabling gcov will be extremely rare in the grand scheme of things, and this method causes zero overhead for the case where gcov is compiled out. (Similarly elsewhere.)

How about instead of the kind of ugly #ifdef-ery above, instead of

+#ifdef CONFIG_GCOV
+#define gcov_build() 1
+#else
+#define gcov_build() 0
+#endif

we'd have

+#ifdef CONFIG_GCOV
+#define gcov_string "gcov=y"
+#else
+#define gcov_string ""
+#endif

(with the identifier name open for improvement), which can then be embedded easily into any string literal?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw

Re: [PATCH v2 1/4] xen: indicate gcov in log messages

Quoted 39 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:47, <[email protected]> wrote:

xen/drivers/char/console.c void __init console_init_preirq(void) · line 738

Quoted 8 lines · Wei Liu
xen/drivers/char/console.c +1 -1
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",

Please instead use

printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" #ifdef CONFIG_GCOV
" gcov=y"
#endif
" %s\n",

Quoted 3 lines

Enabling gcov will be extremely rare in the grand scheme of things, and this method causes zero overhead for the case where gcov is compiled out. (Similarly elsewhere.)

How about instead of the kind of ugly #ifdef-ery above, instead of

(quoted diff) +5 -0
+#ifdef CONFIG_GCOV
+#define gcov_build() 1
+#else
+#define gcov_build() 0
+#endif

we'd have

(quoted diff) +5 -0
+#ifdef CONFIG_GCOV
+#define gcov_string "gcov=y"
+#else
+#define gcov_string ""
+#endif
Quoted 3 lines

(with the identifier name open for improvement), which can then be embedded easily into any string literal?

Now this patch looks like

---8<---
From 56718288f632d3a25bd3fe89777df99008a13d6e Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Fri, 2 Sep 2016 14:43:25 +0100
Subject: [PATCH] xen: indicate gcov in log messages

---
v3: simplify code

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
---
 xen/arch/arm/traps.c        | 2 +-
 xen/arch/x86/x86_64/traps.c | 2 +-
 xen/drivers/char/console.c  | 2 +-
 xen/include/xen/lib.h       | 6 ++++++
 4 files changed, 9 insertions(+), 3 deletions(-)
xen/arch/arm/traps.c +1 -1
index 9353ee7..39a05fd 100644
@@ -141,7 +141,7 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  %s  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  %s  debug=%c " gcov_string "  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
 #ifdef CONFIG_ARM_32
            "arm32",
xen/arch/x86/x86_64/traps.c +1 -1
index 16de0be..fc8cde6 100644
@@ -31,7 +31,7 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c " gcov_string "  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            debug_build() ? 'y' : 'n', print_tainted(taint_str));
 }
xen/drivers/char/console.c +1 -1
index 650035d..55ae31a 100644
@@ -735,7 +735,7 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c " gcov_string " %s\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            xen_compile_by(), xen_compile_domain(),
            xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date());
xen/include/xen/lib.h +6 -0
index e518adc..d1171b7 100644
@@ -26,6 +26,12 @@
 #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
 #endif
 
+#ifdef CONFIG_GCOV
+#define gcov_string "gcov=y"
+#else
+#define gcov_string ""
+#endif
+
 #ifndef NDEBUG
 #define ASSERT(p) \
     do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#5 lore raw

Re: [PATCH v2 1/4] xen: indicate gcov in log messages

Quoted 41 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 16:06, <[email protected]> wrote:
Quoted 39 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:47, <[email protected]> wrote:

xen/drivers/char/console.c void __init console_init_preirq(void) · line 738

Quoted 8 lines · Wei Liu
xen/drivers/char/console.c +1 -1
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",

Please instead use

printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" #ifdef CONFIG_GCOV
" gcov=y"
#endif
" %s\n",

Quoted 3 lines

Enabling gcov will be extremely rare in the grand scheme of things, and this method causes zero overhead for the case where gcov is compiled out. (Similarly elsewhere.)

How about instead of the kind of ugly #ifdef-ery above, instead of

xen/include/xen/lib.h +5 -0
+#ifdef CONFIG_GCOV
+#define gcov_build() 1
+#else
+#define gcov_build() 0
+#endif

we'd have

xen/include/xen/lib.h +5 -0
+#ifdef CONFIG_GCOV
+#define gcov_string "gcov=y"
+#else
+#define gcov_string ""
+#endif
Quoted 5 lines
Quoted 3 lines

(with the identifier name open for improvement), which can then be embedded easily into any string literal?

Now this patch looks like

And this way it can have my ack.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by
#6 lore raw

Re: [PATCH v2 1/4] xen: indicate gcov in log messages

In reply to Wei Liu
Quoted 43 lines · Wei Liu
Quoted 37 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:47, <[email protected]> wrote:

xen/drivers/char/console.c void __init console_init_preirq(void) · line 738

Quoted 8 lines · Wei Liu
xen/drivers/char/console.c +1 -1
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",

Please instead use

printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" #ifdef CONFIG_GCOV
" gcov=y"
#endif
" %s\n",

Quoted 3 lines

Enabling gcov will be extremely rare in the grand scheme of things, and this method causes zero overhead for the case where gcov is compiled out. (Similarly elsewhere.)

How about instead of the kind of ugly #ifdef-ery above, instead of

xen/include/xen/lib.h +5 -0
+#ifdef CONFIG_GCOV
+#define gcov_build() 1
+#else
+#define gcov_build() 0
+#endif

we'd have

xen/include/xen/lib.h +5 -0
+#ifdef CONFIG_GCOV
+#define gcov_string "gcov=y"
+#else
+#define gcov_string ""
+#endif
Quoted 3 lines

(with the identifier name open for improvement), which can then be embedded easily into any string literal?

Now this patch looks like

Quoted 7 lines

---8<---
From 56718288f632d3a25bd3fe89777df99008a13d6e Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Fri, 2 Sep 2016 14:43:25 +0100
Subject: [PATCH] xen: indicate gcov in log messages

Quoted 60 lines

---
v3: simplify code

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
---
 xen/arch/arm/traps.c        | 2 +-
 xen/arch/x86/x86_64/traps.c | 2 +-
 xen/drivers/char/console.c  | 2 +-
 xen/include/xen/lib.h       | 6 ++++++
 4 files changed, 9 insertions(+), 3 deletions(-)
xen/arch/arm/traps.c +1 -1
index 9353ee7..39a05fd 100644
@@ -141,7 +141,7 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  %s  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  %s  debug=%c " gcov_string "  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
 #ifdef CONFIG_ARM_32
            "arm32",
xen/arch/x86/x86_64/traps.c +1 -1
index 16de0be..fc8cde6 100644
@@ -31,7 +31,7 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c " gcov_string "  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            debug_build() ? 'y' : 'n', print_tainted(taint_str));
 }
xen/drivers/char/console.c +1 -1
index 650035d..55ae31a 100644
@@ -735,7 +735,7 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c " gcov_string " %s\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            xen_compile_by(), xen_compile_domain(),
            xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date());
xen/include/xen/lib.h +0 -0
index e518adc..d1171b7 100644
@@ -26,6 +26,12 @@
 #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
 #endif

xen/include/xen/lib.h line 37

Quoted 10 lines
xen/include/xen/lib.h +6 -0
 
+#ifdef CONFIG_GCOV
+#define gcov_string "gcov=y"
+#else
+#define gcov_string ""
+#endif
+
 #ifndef NDEBUG
 #define ASSERT(p) \
     do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v2 1/4
#7 lore raw

Re: [PATCH v2 1/4] xen: indicate gcov in log messages

In reply to Wei Liu
Quoted 1 line · Wei Liu
Quoted 88 lines
Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
---
 xen/arch/arm/traps.c        | 5 +++--
 xen/arch/x86/x86_64/traps.c | 5 +++--
 xen/drivers/char/console.c  | 5 +++--
 xen/include/xen/lib.h       | 6 ++++++
 4 files changed, 15 insertions(+), 6 deletions(-)
xen/arch/arm/traps.c +3 -2
index 683bcb2..3bac8e8 100644
@@ -141,14 +141,15 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  %s  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  %s  debug=%c gcov=%c  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
 #ifdef CONFIG_ARM_32
            "arm32",
 #else
            "arm64",
 #endif
-           debug_build() ? 'y' : 'n', print_tainted(taint_str));
+           debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n',
+           print_tainted(taint_str));
 }
 
 #ifdef CONFIG_ARM_32
xen/arch/x86/x86_64/traps.c +3 -2
index 2d8ecf5..0708cc7 100644
@@ -30,9 +30,10 @@ static void print_xen_info(void)
 {
     char taint_str[TAINT_STRING_MAX_LEN];
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+    printk("----[ Xen-%d.%d%s  x86_64  debug=%c gcov=%c %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
-           debug_build() ? 'y' : 'n', print_tainted(taint_str));
+           debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n',
+           print_tainted(taint_str));
 }
 
 enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest };
xen/drivers/char/console.c +3 -2
index 650035d..e773076 100644
@@ -735,10 +735,11 @@ void __init console_init_preirq(void)
     spin_lock(&console_lock);
     __putstr(xen_banner());
     spin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n",
+    printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            xen_compile_by(), xen_compile_domain(),
-           xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date());
+           xen_compiler(), debug_build() ? 'y' : 'n',
+           gcov_build() ? 'y' : 'n', xen_compile_date());
     printk("Latest ChangeSet: %s\n", xen_changeset());
 
     if ( opt_sync_console )
xen/include/xen/lib.h +6 -0
index e518adc..464fb05 100644
@@ -26,6 +26,12 @@
 #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
 #endif
 
+#ifdef CONFIG_GCOV
+#define gcov_build() 1
+#else
+#define gcov_build() 0
+#endif
+
 #ifndef NDEBUG
 #define ASSERT(p) \
     do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
Signature · 1 line
2.1.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#8 lore raw

PATCH v2 2/4 gcov: collect more sections to constructor list

In reply to Wei Liu

The version of gcc (4.9.2) I use put constructors into .init_array* section(s). Collect those sections into constructor list as well.

Modify both arm and x86 scripts to keep them in sync.

---
v2: move .init_arry before .init_array.*

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
---
 xen/arch/arm/xen.lds.S | 2 ++
 xen/arch/x86/xen.lds.S | 2 ++
 2 files changed, 4 insertions(+)
xen/arch/arm/xen.lds.S +2 -0
index b24e93b..3c5e7ba 100644
@@ -166,7 +166,9 @@ SECTIONS
 
        . = ALIGN(8);
        __ctors_start = .;
+       *(.ctors)
        *(.init_array)
+       *(SORT(.init_array.*))
        __ctors_end = .;
   } :text
   __init_end_efi = .;
xen/arch/x86/xen.lds.S +2 -0
index 67cfda1..d903c31 100644
@@ -205,6 +205,8 @@ SECTIONS
        . = ALIGN(8);
        __ctors_start = .;
        *(.ctors)
+       *(.init_array)
+       *(SORT(.init_array.*))
        __ctors_end = .;
   } :text
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 2/4
#9 lore raw

Re: [PATCH v2 2/4] gcov: collect more sections to constructor list

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:41, <[email protected]> wrote:

The version of gcc (4.9.2) I use put constructors into .init_array* section(s). Collect those sections into constructor list as well.

Modify both arm and x86 scripts to keep them in sync.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#10 lore raw

PATCH v2 3/4 xen: replace TEST_COVERAGE with CONFIG_GCOV

In reply to Wei Liu

The sole purpose of TEST_COVERAGE macro is to guard the availability of gcov sysctl. Now we have a proper CONFIG_GCOV, use it.

---
 xen/Rules.mk           | 2 +-
 xen/common/sysctl.c    | 2 +-
 xen/include/xen/gcov.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
xen/Rules.mk +1 -1
index 696aaa8..a9fda71 100644
@@ -116,7 +116,7 @@ subdir-all := $(subdir-y) $(subdir-n)
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
 ifeq ($(CONFIG_GCOV),y)
-$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage
 endif
 
 ifeq ($(lto),y)
xen/common/sysctl.c +1 -1
index 55f2077..8aea6ef 100644
@@ -396,7 +396,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
     }
     break;
 
-#ifdef TEST_COVERAGE
+#ifdef CONFIG_GCOV
     case XEN_SYSCTL_coverage_op:
         ret = sysctl_coverage_op(&op->u.coverage_op);
         break;
xen/include/xen/gcov.h +1 -1
index 27c5c37..a7d4a35 100644
@@ -86,7 +86,7 @@ struct gcov_info
 /**
  * Sysctl operations for coverage
  */
-#ifdef TEST_COVERAGE
+#ifdef CONFIG_GCOV
 int sysctl_coverage_op(xen_sysctl_coverage_op_t *op);
 #endif
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#11 lore raw

PATCH v2 4/4 xen: make clear gcov support limitation in Kconfig

In reply to Wei Liu

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/Kconfig.debug | 6 ++++++
 1 file changed, 6 insertions(+)
xen/Kconfig.debug +6 -0
index 06afd80..12a1193 100644
@@ -33,6 +33,12 @@ config GCOV
        ---help---
          Enable gcov (a test coverage program in GCC) support.
 
+         Currently the data structure and hypercall interface are tied
+         to GCC 3.4 gcov format. You need to have a version of GCC
+         that is compatible with that format to make gcov work.
+
+         If unsure, say N here.
+
 config LOCK_PROFILE
 	bool "Lock Profiling"
 	---help---
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 4/4
#12 lore raw

Re: [PATCH v2 4/4] xen: make clear gcov support limitation in Kconfig

Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:41, <[email protected]> wrote:

with one possible further request:

xen/Kconfig.debug config GCOV · line 38

Quoted 9 lines
xen/Kconfig.debug +3 -0
@@ -33,6 +33,12 @@ config GCOV
        ---help---
          Enable gcov (a test coverage program in GCC) support.
 
+         Currently the data structure and hypercall interface are tied
+         to GCC 3.4 gcov format. You need to have a version of GCC
+         that is compatible with that format to make gcov work.

Is it known up to which gcc version that format did get used? I ask because mentioning 3.4 when our minimum requirement is 4.1 now is a little odd. If the format had changed by 4.1, we may want to consider to make GCOV depend on BROKEN.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw

Re: [PATCH v2 4/4] xen: make clear gcov support limitation in Kconfig

Quoted 12 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 14:41, <[email protected]> wrote:

with one possible further request:

Quoted 6 lines
xen/Kconfig.debug +0 -0
@@ -33,6 +33,12 @@ config GCOV
        ---help---
          Enable gcov (a test coverage program in GCC) support.
 
Quoted 7 lines

xen/Kconfig.debug config GCOV · line 38

Quoted 3 lines
xen/Kconfig.debug +3 -0
+         Currently the data structure and hypercall interface are tied
+         to GCC 3.4 gcov format. You need to have a version of GCC
+         that is compatible with that format to make gcov work.

Is it known up to which gcc version that format did get used? I ask because mentioning 3.4 when our minimum requirement is 4.1 now is a little odd. If the format had changed by 4.1, we may want to consider to make GCOV depend on BROKEN.

The GCC GCOV version is not the GCC Version.

GCC GCOV version 3.4 is used up until GCC 4.3 or 4.4 (can't remember which). The previous GCOV support in Xen definitely did function properly with GCC 4.1.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#14 lore raw
In reply to Wei Liu
Quoted 6 lines · Wei Liu

Wei Liu (4):
xen: indicate gcov in log messages
gcov: collect more sections to constructor list
xen: replace TEST_COVERAGE with CONFIG_GCOV
xen: make clear gcov support limitation in Kconfig

I believe this series has got sufficient reviews / acks and all questions answered (with help from Andrew), so I pushed it just now.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel