2022-05-23 08:33:07

by Liu, Congyu

[permalink] [raw]
Subject: [PATCH] tracing: disable kcov on trace_preemptirq.c

Functions in trace_preemptirq.c could be invoked from early interrupt
code that bypasses kcov trace function's in_task() check. Disable kcov
on this file to reduce random code coverage.

Signed-off-by: Congyu Liu <[email protected]>
---
kernel/trace/Makefile | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index d77cd8032213..0d261774d6f3 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -31,6 +31,10 @@ ifdef CONFIG_GCOV_PROFILE_FTRACE
GCOV_PROFILE := y
endif

+# Functions in this file could be invoked from early interrupt
+# code and produce random code coverage.
+KCOV_INSTRUMENT_trace_preemptirq.o := n
+
CFLAGS_bpf_trace.o := -I$(src)

CFLAGS_trace_benchmark.o := -I$(src)
--
2.34.1



2022-05-23 08:53:47

by Dmitry Vyukov

[permalink] [raw]
Subject: Re: [PATCH] tracing: disable kcov on trace_preemptirq.c

On Mon, 23 May 2022 at 08:30, Congyu Liu <[email protected]> wrote:
>
> Functions in trace_preemptirq.c could be invoked from early interrupt
> code that bypasses kcov trace function's in_task() check. Disable kcov
> on this file to reduce random code coverage.
>
> Signed-off-by: Congyu Liu <[email protected]>

Acked-by: Dmitry Vyukov <[email protected]>

> ---
> kernel/trace/Makefile | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
> index d77cd8032213..0d261774d6f3 100644
> --- a/kernel/trace/Makefile
> +++ b/kernel/trace/Makefile
> @@ -31,6 +31,10 @@ ifdef CONFIG_GCOV_PROFILE_FTRACE
> GCOV_PROFILE := y
> endif
>
> +# Functions in this file could be invoked from early interrupt
> +# code and produce random code coverage.
> +KCOV_INSTRUMENT_trace_preemptirq.o := n
> +
> CFLAGS_bpf_trace.o := -I$(src)
>
> CFLAGS_trace_benchmark.o := -I$(src)
> --
> 2.34.1
>