Re: [PATCH 1/4] x86/entry: Remove unwanted instrumentation in common_interrupt()

From: Dave Hansen
Date: Tue Jun 04 2024 - 12:01:17 EST


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?