linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] riscv: Allow building with kcov coverage
       [not found] <20200625183941.23093-1-tklauser@distanz.ch>
@ 2020-06-26 12:40 ` Tobias Klauser
  2020-06-26 14:28   ` Dmitry Vyukov
  2020-07-11  4:27   ` Palmer Dabbelt
  0 siblings, 2 replies; 3+ messages in thread
From: Tobias Klauser @ 2020-06-26 12:40 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: linux-riscv, linux-kernel, Björn Töpel, Dmitry Vyukov

Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig.
Also disable instrumentation of some early boot code and vdso.

Boot-tested on QEMU's riscv64 virt machine.

Cc: Björn Töpel <bjorn.topel@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 arch/riscv/Kconfig              | 2 ++
 arch/riscv/boot/Makefile        | 2 ++
 arch/riscv/kernel/vdso/Makefile | 1 +
 arch/riscv/mm/Makefile          | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 089293e4ad46..a7d7f8184f15 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -19,6 +19,7 @@ config RISCV
 	select ARCH_HAS_DEBUG_WX
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_GIGANTIC_PAGE
+	select ARCH_HAS_KCOV
 	select ARCH_HAS_MMIOWB
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_SET_DIRECT_MAP
@@ -57,6 +58,7 @@ config RISCV
 	select HAVE_DMA_CONTIGUOUS if MMU
 	select HAVE_EBPF_JIT if MMU
 	select HAVE_FUTEX_CMPXCHG if FUTEX
+	select HAVE_GCC_PLUGINS
 	select HAVE_GENERIC_VDSO if MMU && 64BIT
 	select HAVE_PCI
 	select HAVE_PERF_EVENTS
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
index 3530c59b3ea7..c59fca695f9d 100644
--- a/arch/riscv/boot/Makefile
+++ b/arch/riscv/boot/Makefile
@@ -14,6 +14,8 @@
 # Based on the ia64 and arm64 boot/Makefile.
 #
 
+KCOV_INSTRUMENT := n
+
 OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 
 targets := Image loader
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 29cf052f6541..4b0d3bcc44e5 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -29,6 +29,7 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+KCOV_INSTRUMENT := n
 
 # Force dependency
 $(obj)/vdso.o: $(obj)/vdso.so
diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
index 363ef01c30b1..c0185e556ca5 100644
--- a/arch/riscv/mm/Makefile
+++ b/arch/riscv/mm/Makefile
@@ -5,6 +5,8 @@ ifdef CONFIG_FTRACE
 CFLAGS_REMOVE_init.o = -pg
 endif
 
+KCOV_INSTRUMENT_init.o := n
+
 obj-y += init.o
 obj-y += extable.o
 obj-$(CONFIG_MMU) += fault.o pageattr.o
-- 
2.27.0


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

* Re: [PATCH v2] riscv: Allow building with kcov coverage
  2020-06-26 12:40 ` [PATCH v2] riscv: Allow building with kcov coverage Tobias Klauser
@ 2020-06-26 14:28   ` Dmitry Vyukov
  2020-07-11  4:27   ` Palmer Dabbelt
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Vyukov @ 2020-06-26 14:28 UTC (permalink / raw)
  To: Tobias Klauser
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv, LKML,
	Björn Töpel

On Fri, Jun 26, 2020 at 2:40 PM Tobias Klauser <tklauser@distanz.ch> wrote:
>
> Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig.
> Also disable instrumentation of some early boot code and vdso.
>
> Boot-tested on QEMU's riscv64 virt machine.
>
> Cc: Björn Töpel <bjorn.topel@gmail.com>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>


Assuming it boots now :)

Acked-by: Dmitry Vyukov <dvyukov@google.com>

> ---
>  arch/riscv/Kconfig              | 2 ++
>  arch/riscv/boot/Makefile        | 2 ++
>  arch/riscv/kernel/vdso/Makefile | 1 +
>  arch/riscv/mm/Makefile          | 2 ++
>  4 files changed, 7 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 089293e4ad46..a7d7f8184f15 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -19,6 +19,7 @@ config RISCV
>         select ARCH_HAS_DEBUG_WX
>         select ARCH_HAS_GCOV_PROFILE_ALL
>         select ARCH_HAS_GIGANTIC_PAGE
> +       select ARCH_HAS_KCOV
>         select ARCH_HAS_MMIOWB
>         select ARCH_HAS_PTE_SPECIAL
>         select ARCH_HAS_SET_DIRECT_MAP
> @@ -57,6 +58,7 @@ config RISCV
>         select HAVE_DMA_CONTIGUOUS if MMU
>         select HAVE_EBPF_JIT if MMU
>         select HAVE_FUTEX_CMPXCHG if FUTEX
> +       select HAVE_GCC_PLUGINS
>         select HAVE_GENERIC_VDSO if MMU && 64BIT
>         select HAVE_PCI
>         select HAVE_PERF_EVENTS
> diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
> index 3530c59b3ea7..c59fca695f9d 100644
> --- a/arch/riscv/boot/Makefile
> +++ b/arch/riscv/boot/Makefile
> @@ -14,6 +14,8 @@
>  # Based on the ia64 and arm64 boot/Makefile.
>  #
>
> +KCOV_INSTRUMENT := n
> +
>  OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
>
>  targets := Image loader
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 29cf052f6541..4b0d3bcc44e5 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -29,6 +29,7 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
>
>  # Disable gcov profiling for VDSO code
>  GCOV_PROFILE := n
> +KCOV_INSTRUMENT := n
>
>  # Force dependency
>  $(obj)/vdso.o: $(obj)/vdso.so
> diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
> index 363ef01c30b1..c0185e556ca5 100644
> --- a/arch/riscv/mm/Makefile
> +++ b/arch/riscv/mm/Makefile
> @@ -5,6 +5,8 @@ ifdef CONFIG_FTRACE
>  CFLAGS_REMOVE_init.o = -pg
>  endif
>
> +KCOV_INSTRUMENT_init.o := n
> +
>  obj-y += init.o
>  obj-y += extable.o
>  obj-$(CONFIG_MMU) += fault.o pageattr.o
> --
> 2.27.0
>

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

* Re: [PATCH v2] riscv: Allow building with kcov coverage
  2020-06-26 12:40 ` [PATCH v2] riscv: Allow building with kcov coverage Tobias Klauser
  2020-06-26 14:28   ` Dmitry Vyukov
@ 2020-07-11  4:27   ` Palmer Dabbelt
  1 sibling, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2020-07-11  4:27 UTC (permalink / raw)
  To: tklauser
  Cc: Paul Walmsley, aou, linux-riscv, linux-kernel, Bjorn Topel, dvyukov

On Fri, 26 Jun 2020 05:40:56 PDT (-0700), tklauser@distanz.ch wrote:
> Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig.
> Also disable instrumentation of some early boot code and vdso.
>
> Boot-tested on QEMU's riscv64 virt machine.

Thanks.  This is on for-next (with the ack).  I'm boot testing a config with

    CONFIG_KCOV=y
    CONFIG_KCOV_ENABLE_COMPARISONS=y

but LMK if there's something more interesting to test.  I don't see anything
coverage-related in the boot log...

> Cc: Björn Töpel <bjorn.topel@gmail.com>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
>  arch/riscv/Kconfig              | 2 ++
>  arch/riscv/boot/Makefile        | 2 ++
>  arch/riscv/kernel/vdso/Makefile | 1 +
>  arch/riscv/mm/Makefile          | 2 ++
>  4 files changed, 7 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 089293e4ad46..a7d7f8184f15 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -19,6 +19,7 @@ config RISCV
>  	select ARCH_HAS_DEBUG_WX
>  	select ARCH_HAS_GCOV_PROFILE_ALL
>  	select ARCH_HAS_GIGANTIC_PAGE
> +	select ARCH_HAS_KCOV
>  	select ARCH_HAS_MMIOWB
>  	select ARCH_HAS_PTE_SPECIAL
>  	select ARCH_HAS_SET_DIRECT_MAP
> @@ -57,6 +58,7 @@ config RISCV
>  	select HAVE_DMA_CONTIGUOUS if MMU
>  	select HAVE_EBPF_JIT if MMU
>  	select HAVE_FUTEX_CMPXCHG if FUTEX
> +	select HAVE_GCC_PLUGINS
>  	select HAVE_GENERIC_VDSO if MMU && 64BIT
>  	select HAVE_PCI
>  	select HAVE_PERF_EVENTS
> diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
> index 3530c59b3ea7..c59fca695f9d 100644
> --- a/arch/riscv/boot/Makefile
> +++ b/arch/riscv/boot/Makefile
> @@ -14,6 +14,8 @@
>  # Based on the ia64 and arm64 boot/Makefile.
>  #
>
> +KCOV_INSTRUMENT := n
> +
>  OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
>
>  targets := Image loader
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 29cf052f6541..4b0d3bcc44e5 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -29,6 +29,7 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
>
>  # Disable gcov profiling for VDSO code
>  GCOV_PROFILE := n
> +KCOV_INSTRUMENT := n
>
>  # Force dependency
>  $(obj)/vdso.o: $(obj)/vdso.so
> diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
> index 363ef01c30b1..c0185e556ca5 100644
> --- a/arch/riscv/mm/Makefile
> +++ b/arch/riscv/mm/Makefile
> @@ -5,6 +5,8 @@ ifdef CONFIG_FTRACE
>  CFLAGS_REMOVE_init.o = -pg
>  endif
>
> +KCOV_INSTRUMENT_init.o := n
> +
>  obj-y += init.o
>  obj-y += extable.o
>  obj-$(CONFIG_MMU) += fault.o pageattr.o

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

end of thread, other threads:[~2020-07-11  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200625183941.23093-1-tklauser@distanz.ch>
2020-06-26 12:40 ` [PATCH v2] riscv: Allow building with kcov coverage Tobias Klauser
2020-06-26 14:28   ` Dmitry Vyukov
2020-07-11  4:27   ` Palmer Dabbelt

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).