From: Yunseong Kim <yunseong.kim@est.tech>
To: Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
James Morris <jmorris@namei.org>,
Randy Dunlap <rdunlap@infradead.org>,
Andrey Konovalov <andreyknvl@gmail.com>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun@kernel.org>, Waiman Long <longman@redhat.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Aaron Tomlin <atomlin@atomlin.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
Joel Fernandes <joelagnelf@nvidia.com>,
Josh Triplett <josh@joshtriplett.org>,
Uladzislau Rezki <urezki@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang@linux.dev>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com, workflows@vger.kernel.org,
linux-modules@vger.kernel.org, rcu@vger.kernel.org,
linux-mm@kvack.org, linux-kbuild@vger.kernel.org,
Yunseong Kim <yunseong.kim@est.tech>
Subject: [PATCH RFC 2/2] x86/kcov: allow instrumenting noisy objects for early boot coverage
Date: Tue, 27 Oct 2026 17:34:09 +0100 [thread overview]
Message-ID: <20261027-early-kcov-v1-2-6f2f053255ad@est.tech> (raw)
In-Reply-To: <20261027-early-kcov-v1-0-6f2f053255ad@est.tech>
A few x86 objects are excluded from KCOV only because their coverage
is noise for syscall fuzzing: the APIC code (interrupts land in random
places), delay.o, and the stack trace, dumpstack and unwinder objects.
Use $(kcov-noisy) for them, so that CONFIG_KCOV_INSTRUMENT_NOISY=y
includes them in early boot coverage. With the option off nothing
changes.
The objects excluded because the kernel does not boot or hangs when
they are instrumented (head64.o, cpu/common.o, perf_event.o, tlb.c,
mem_encrypt*.c, pgprot.c) stay excluded, as do machine_kexec_64.o and
physaddr.o, which must not use KCOV during kexec once load_segments()
has invalidated the GS base.
With FRED, the system vector wrappers in apic.c are not noinstr and run
before the hardirq count is raised, so with this change interrupt PCs
such as the LAPIC timer can be recorded as if init_task executed them.
The same already happens for the wrappers in irq.c, smp.c and others.
Signed-off-by: Yunseong Kim <yunseong.kim@est.tech>
---
arch/x86/kernel/Makefile | 12 ++++++------
arch/x86/kernel/apic/Makefile | 2 +-
arch/x86/lib/Makefile | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 31f46fd005278..44cfd3781c30a 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -37,12 +37,12 @@ KMSAN_SANITIZE_nmi.o := n
KCOV_INSTRUMENT_head$(BITS).o := n
# These are called from save_stack_trace() on debug paths,
# and produce large amounts of uninteresting coverage.
-KCOV_INSTRUMENT_stacktrace.o := n
-KCOV_INSTRUMENT_dumpstack.o := n
-KCOV_INSTRUMENT_dumpstack_$(BITS).o := n
-KCOV_INSTRUMENT_unwind_orc.o := n
-KCOV_INSTRUMENT_unwind_frame.o := n
-KCOV_INSTRUMENT_unwind_guess.o := n
+KCOV_INSTRUMENT_stacktrace.o := $(kcov-noisy)
+KCOV_INSTRUMENT_dumpstack.o := $(kcov-noisy)
+KCOV_INSTRUMENT_dumpstack_$(BITS).o := $(kcov-noisy)
+KCOV_INSTRUMENT_unwind_orc.o := $(kcov-noisy)
+KCOV_INSTRUMENT_unwind_frame.o := $(kcov-noisy)
+KCOV_INSTRUMENT_unwind_guess.o := $(kcov-noisy)
# Disable KCOV to prevent crashes during kexec: load_segments() invalidates
# the GS base, which KCOV relies on for per-CPU data.
diff --git a/arch/x86/kernel/apic/Makefile b/arch/x86/kernel/apic/Makefile
index 581db89477f92..146cbd766c924 100644
--- a/arch/x86/kernel/apic/Makefile
+++ b/arch/x86/kernel/apic/Makefile
@@ -5,7 +5,7 @@
# Leads to non-deterministic coverage that is not a function of syscall inputs.
# In particular, smp_apic_timer_interrupt() is called in random places.
-KCOV_INSTRUMENT := n
+KCOV_INSTRUMENT := $(kcov-noisy)
obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_common.o apic_noop.o ipi.o vector.o init.o
obj-y += hw_nmi.o
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 2dba7f83ef97c..151ecee2229f3 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -4,7 +4,7 @@
#
# Produces uninteresting flaky coverage.
-KCOV_INSTRUMENT_delay.o := n
+KCOV_INSTRUMENT_delay.o := $(kcov-noisy)
# KCSAN uses udelay for introducing watchpoint delay; avoid recursion.
KCSAN_SANITIZE_delay.o := n
--
2.47.3
next prev parent reply other threads:[~2026-10-27 16:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:34 [PATCH RFC 0/2] kcov: collect early boot coverage of init_task Yunseong Kim
2026-10-27 16:34 ` [PATCH RFC 1/2] " Yunseong Kim
2026-10-28 16:35 ` sashiko-bot
2026-10-27 16:34 ` Yunseong Kim [this message]
2026-10-28 16:35 ` [PATCH RFC 2/2] x86/kcov: allow instrumenting noisy objects for early boot coverage sashiko-bot
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=20261027-early-kcov-v1-2-6f2f053255ad@est.tech \
--to=yunseong.kim@est.tech \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=atomlin@atomlin.com \
--cc=boqun@kernel.org \
--cc=bp@alien8.de \
--cc=bsegall@google.com \
--cc=corbet@lwn.net \
--cc=da.gomez@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=dietmar.eggemann@arm.com \
--cc=dvyukov@google.com \
--cc=frederic@kernel.org \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=jiangshanlai@gmail.com \
--cc=jmorris@namei.org \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=juri.lelli@redhat.com \
--cc=kasan-dev@googlegroups.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-modules@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mcgrof@kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=nsc@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=petr.pavlu@suse.com \
--cc=qiang.zhang@linux.dev \
--cc=rcu@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=skhan@linuxfoundation.org \
--cc=tglx@kernel.org \
--cc=urezki@gmail.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=will@kernel.org \
--cc=workflows@vger.kernel.org \
--cc=x86@kernel.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