From: Peter Zijlstra <peterz@infradead.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org,
linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
elver@google.com, glider@google.com, nogikh@google.com,
tarasmadan@google.com
Subject: Re: [PATCH 1/4] x86/entry: Remove unwanted instrumentation in common_interrupt()
Date: Tue, 4 Jun 2024 21:38:53 +0200 [thread overview]
Message-ID: <20240604193853.GR40213@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <3f15814c-de9c-4aa6-b56d-82761bb6520a@intel.com>
On Tue, Jun 04, 2024 at 09:00:59AM -0700, Dave Hansen wrote:
> On 6/4/24 06:45, Dmitry Vyukov wrote:
> > The manifestation is that KCOV produces spurious coverage
> > in kvm_set_cpu_l1tf_flush_l1d() in random places because
> > the call happens when preempt count is not yet updated
> > to say that we are in an interrupt.
> >
> > Mark kvm_set_cpu_l1tf_flush_l1d() as __always_inline and move
> > out of instrumentation_begin/end() section.
> > It only calls __this_cpu_write() which is already safe to call
> > in noinstr contexts.
>
> I've internalized the main rules around noinstr to basically be: Only
> call noinstr functions before begin_instrumentation(). Second, try to
> minimize the amount of noinstr code.
>
> This patch seems to be adding another rule which is that all code before
> preempt_count manipulation needs to be noinstr.
>
> _Is_ that a new rule, or was it something I was missing?
Specifically, the problem here appears to be that the instrumentation
cannot correctly identify the context because the HARDIRQ_MASK bits
aren't yet set in preempt_count.
So the preempt_count manipulations as such are not the problem, but the
fact that we call into instrumentation code that seems to rely on using
the preempt_count to determine context is.
Does that clarify?
next prev parent reply other threads:[~2024-06-04 19:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1717507310.git.dvyukov@google.com>
2024-06-04 13:45 ` Dmitry Vyukov
2024-06-04 15:04 ` Alexander Potapenko
2024-06-04 16:00 ` Dave Hansen
2024-06-04 16:07 ` Dmitry Vyukov
2024-06-04 19:38 ` Peter Zijlstra [this message]
2024-06-04 13:45 ` [PATCH 2/4] kcov: add interrupt handling self test Dmitry Vyukov
2024-06-04 15:26 ` Alexander Potapenko
2024-06-05 9:09 ` Marco Elver
2024-06-05 9:18 ` Dmitry Vyukov
2024-06-05 9:33 ` Marco Elver
2024-06-11 7:52 ` Dmitry Vyukov
2024-06-04 13:45 ` [PATCH 3/4] module: Fix KCOV-ignored file name Dmitry Vyukov
2024-06-04 15:03 ` Alexander Potapenko
2024-06-04 13:45 ` [PATCH 4/4] x86: Ignore stack unwinding in KCOV Dmitry Vyukov
2024-06-04 15:06 ` Alexander Potapenko
2024-06-05 8:26 ` Marco Elver
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=20240604193853.GR40213@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nogikh@google.com \
--cc=syzkaller@googlegroups.com \
--cc=tarasmadan@google.com \
--cc=tglx@linutronix.de \
--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
Powered by JetHome