]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/entry: Remove unwanted instrumentation in common_interrupt()
authorDmitry Vyukov <dvyukov@google.com>
Tue, 11 Jun 2024 07:50:30 +0000 (09:50 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 8 Aug 2024 15:36:35 +0000 (17:36 +0200)
commit477d81a1c47a1b79b9c08fc92b5dea3c5143800b
treef4d21b16f921f5dde00e59f6596a4f1ec9235044
parentde9c2c66ad8e787abec7c9d7eff4f8c3cdd28aed
x86/entry: Remove unwanted instrumentation in common_interrupt()

common_interrupt() and related variants call kvm_set_cpu_l1tf_flush_l1d(),
which is neither marked noinstr nor __always_inline.

So compiler puts it out of line and adds instrumentation to it.  Since the
call is inside of instrumentation_begin/end(), objtool does not warn about
it.

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 the kernel is in an interrupt.

Mark kvm_set_cpu_l1tf_flush_l1d() as __always_inline and move it out of the
instrumentation_begin/end() section.  It only calls __this_cpu_write()
which is already safe to call in noinstr contexts.

Fixes: 6368558c3710 ("x86/entry: Provide IDTENTRY_SYSVEC")
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexander Potapenko <glider@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/3f9a1de9e415fcb53d07dc9e19fa8481bb021b1b.1718092070.git.dvyukov@google.com
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/idtentry.h