All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix gcov build
@ 2016-08-31 15:26 Wei Liu
  2016-08-31 15:26 ` [PATCH v2 1/4] arm: acpi/boot.c is only used during initialisation Wei Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Wei Liu @ 2016-08-31 15:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

A small series to fix gcov build for both x86 and arm.

Wei Liu (4):
  arm: acpi/boot.c is only used during initialisation
  arm64: use "b" to branch to start_xen
  xen: fix gcov compilation
  xen: add a gcov Kconfig option

 Config.mk                  | 3 ---
 xen/Kconfig.debug          | 5 +++++
 xen/Rules.mk               | 4 +++-
 xen/arch/arm/acpi/Makefile | 2 +-
 xen/arch/arm/acpi/boot.c   | 2 +-
 xen/arch/arm/arm64/head.S  | 4 +++-
 xen/arch/x86/efi/Makefile  | 1 +
 xen/common/Makefile        | 2 +-
 8 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.1.4


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] arm: acpi/boot.c is only used during initialisation
  2016-08-31 15:26 [PATCH v2 0/4] Fix gcov build Wei Liu
@ 2016-08-31 15:26 ` Wei Liu
  2016-08-31 15:26 ` [PATCH v2 2/4] arm64: use "b" to branch to start_xen Wei Liu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-08-31 15:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

That file should contain code and data used during initialisation only.

Mark it as such in build system and correctly annotate enabled_cpus.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/acpi/Makefile | 2 +-
 xen/arch/arm/acpi/boot.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/acpi/Makefile b/xen/arch/arm/acpi/Makefile
index 196c40a..23963f8 100644
--- a/xen/arch/arm/acpi/Makefile
+++ b/xen/arch/arm/acpi/Makefile
@@ -1,2 +1,2 @@
 obj-y += lib.o
-obj-y += boot.o
+obj-y += boot.init.o
diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index 28b3450..c3242a0 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -37,7 +37,7 @@
 #include <asm/setup.h>
 
 /* Processors with enabled flag and sane MPIDR */
-static unsigned int enabled_cpus = 1;
+static unsigned int __initdata enabled_cpus = 1;
 static bool __initdata bootcpu_valid;
 
 /* total number of cpus in this system */
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] arm64: use "b" to branch to start_xen
  2016-08-31 15:26 [PATCH v2 0/4] Fix gcov build Wei Liu
  2016-08-31 15:26 ` [PATCH v2 1/4] arm: acpi/boot.c is only used during initialisation Wei Liu
@ 2016-08-31 15:26 ` Wei Liu
  2016-08-31 15:26 ` [PATCH v2 3/4] xen: fix gcov compilation Wei Liu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-08-31 15:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

The cbz instruction has range limitation. When compiled with gcov
support the object is larger so cbz can't handle that anymore. The error
message is like:

aarch64-linux-gnu-ld    -EL  -T xen.lds -N prelink.o \
    /local/work/xen.git/xen/common/symbols-dummy.o -o /local/work/xen.git/xen/.xen-syms.0
prelink.o: In function `launch':
/local/work/xen.git/xen/arch/arm/arm64/head.S:602:(.text+0x408): relocation truncated to fit: R_AARCH64_CONDBR19 against symbol `start_xen' defined in .init.text section in prelink.o

Use "b" instead.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/arm64/head.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 91e2817..3f63d2a 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -599,7 +599,9 @@ launch:
         mov   x0, x20                /* Marshal args: - phys_offset */
         mov   x1, x21                /*               - FDT */
         mov   x2, x24                /*               - CPU ID */
-        cbz   x22, start_xen         /* and disappear into the land of C */
+        cbnz  x22, 1f
+        b     start_xen              /* and disappear into the land of C */
+1:
         b     start_secondary        /* (to the appropriate entry point) */
 
 /* Fail-stop */
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] xen: fix gcov compilation
  2016-08-31 15:26 [PATCH v2 0/4] Fix gcov build Wei Liu
  2016-08-31 15:26 ` [PATCH v2 1/4] arm: acpi/boot.c is only used during initialisation Wei Liu
  2016-08-31 15:26 ` [PATCH v2 2/4] arm64: use "b" to branch to start_xen Wei Liu
@ 2016-08-31 15:26 ` Wei Liu
  2016-08-31 15:29   ` Ian Jackson
  2016-08-31 15:26 ` [PATCH v2 4/4] xen: add a gcov Kconfig option Wei Liu
  2016-08-31 15:56 ` [PATCH v2 0/4] Fix gcov build Wei Liu
  4 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2016-08-31 15:26 UTC (permalink / raw)
  To: Xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Jan Beulich

Currently enabling gcov in hypervisor won't build because although
26c9d03d ("gcov: Adding support for coverage information") claimed that
%.init.o files were excluded from applying compilation options, it was
in fact not true.

Fix that by filtering out the options correctly. Because the dependency
of stub.o in x86 EFI build can't be eliminated easily and we prefer a
generalised method going forward, we introduce nogcov-y to explicitly
mark objects that don't need to build with gcov support.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <JBeulich@suse.com>
---
v2: Change "Due to" to "Because" and fix a typo in commit message.

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/Rules.mk              | 4 +++-
 xen/arch/x86/efi/Makefile | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index a190ff0..22aca0a 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -115,7 +115,9 @@ subdir-all := $(subdir-y) $(subdir-n)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
-$(obj-$(coverage)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+ifeq ($(coverage),y)
+$(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+endif
 
 ifeq ($(lto),y)
 # Would like to handle all object files as bitcode, but objects made from
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 5099430..d62b14f 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -12,3 +12,4 @@ efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(c
 extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
 
 stub.o: $(extra-y)
+nogcov-$(efi) += stub.o
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] xen: add a gcov Kconfig option
  2016-08-31 15:26 [PATCH v2 0/4] Fix gcov build Wei Liu
                   ` (2 preceding siblings ...)
  2016-08-31 15:26 ` [PATCH v2 3/4] xen: fix gcov compilation Wei Liu
@ 2016-08-31 15:26 ` Wei Liu
  2016-08-31 15:56 ` [PATCH v2 0/4] Fix gcov build Wei Liu
  4 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-08-31 15:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
 Config.mk           | 3 ---
 xen/Kconfig.debug   | 5 +++++
 xen/Rules.mk        | 2 +-
 xen/common/Makefile | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index 9c60896..081ff69 100644
--- a/Config.mk
+++ b/Config.mk
@@ -20,9 +20,6 @@ or       = $(if $(strip $(1)),$(1),$(if $(strip $(2)),$(2),$(if $(strip $(3)),$(
 debug ?= y
 debug_symbols ?= $(debug)
 
-# Test coverage support
-coverage ?= n
-
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
                          -e s/i86pc/x86_32/ -e s/amd64/x86_64/ \
                          -e s/armv7.*/arm32/ -e s/armv8.*/arm64/ \
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 1be6344..06afd80 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -28,6 +28,11 @@ config FRAME_POINTER
 	  maybe slower, but it gives very useful debugging information
 	  in case of any Xen bugs.
 
+config GCOV
+       bool "Gcov Support"
+       ---help---
+         Enable gcov (a test coverage program in GCC) support.
+
 config LOCK_PROFILE
 	bool "Lock Profiling"
 	---help---
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 22aca0a..696aaa8 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -115,7 +115,7 @@ subdir-all := $(subdir-y) $(subdir-n)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
-ifeq ($(coverage),y)
+ifeq ($(CONFIG_GCOV),y)
 $(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
 endif
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index c2e6846..0fed30b 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -75,7 +75,7 @@ obj-$(CONFIG_TMEM) += $(tmem-y)
 
 subdir-$(CONFIG_X86) += hvm
 
-subdir-$(coverage) += gcov
+subdir-$(CONFIG_GCOV) += gcov
 
 subdir-y += libelf
 subdir-$(CONFIG_HAS_DEVICE_TREE) += libfdt
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/4] xen: fix gcov compilation
  2016-08-31 15:26 ` [PATCH v2 3/4] xen: fix gcov compilation Wei Liu
@ 2016-08-31 15:29   ` Ian Jackson
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2016-08-31 15:29 UTC (permalink / raw)
  To: Wei Liu
  Cc: Stefano Stabellini, George Dunlap, Andrew Cooper, Tim Deegan,
	Jan Beulich, Xen-devel

Wei Liu writes ("[PATCH v2 3/4] xen: fix gcov compilation"):
> Currently enabling gcov in hypervisor won't build because although
> 26c9d03d ("gcov: Adding support for coverage information") claimed that
> %.init.o files were excluded from applying compilation options, it was
> in fact not true.
> 
> Fix that by filtering out the options correctly. Because the dependency
> of stub.o in x86 EFI build can't be eliminated easily and we prefer a
> generalised method going forward, we introduce nogcov-y to explicitly
> mark objects that don't need to build with gcov support.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] Fix gcov build
  2016-08-31 15:26 [PATCH v2 0/4] Fix gcov build Wei Liu
                   ` (3 preceding siblings ...)
  2016-08-31 15:26 ` [PATCH v2 4/4] xen: add a gcov Kconfig option Wei Liu
@ 2016-08-31 15:56 ` Wei Liu
  4 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-08-31 15:56 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

On Wed, Aug 31, 2016 at 04:26:48PM +0100, Wei Liu wrote:
> A small series to fix gcov build for both x86 and arm.
> 
> Wei Liu (4):
>   arm: acpi/boot.c is only used during initialisation
>   arm64: use "b" to branch to start_xen
>   xen: fix gcov compilation
>   xen: add a gcov Kconfig option
> 

Series pushed.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-08-31 16:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31 15:26 [PATCH v2 0/4] Fix gcov build Wei Liu
2016-08-31 15:26 ` [PATCH v2 1/4] arm: acpi/boot.c is only used during initialisation Wei Liu
2016-08-31 15:26 ` [PATCH v2 2/4] arm64: use "b" to branch to start_xen Wei Liu
2016-08-31 15:26 ` [PATCH v2 3/4] xen: fix gcov compilation Wei Liu
2016-08-31 15:29   ` Ian Jackson
2016-08-31 15:26 ` [PATCH v2 4/4] xen: add a gcov Kconfig option Wei Liu
2016-08-31 15:56 ` [PATCH v2 0/4] Fix gcov build Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.