• Peter Zijlstra's avatar
    time/sched_clock: Provide sched_clock_noinstr() · 5949a68c
    Peter Zijlstra authored
    
    
    With the intent to provide local_clock_noinstr(), a variant of
    local_clock() that's safe to be called from noinstr code (with the
    assumption that any such code will already be non-preemptible),
    prepare for things by providing a noinstr sched_clock_noinstr() function.
    
    Specifically, preempt_enable_*() calls out to schedule(), which upsets
    noinstr validation efforts.
    
    As such, pull out the preempt_{dis,en}able_notrace() requirements from
    the sched_clock_read() implementations by explicitly providing it in
    the sched_clock() function.
    
    This further requires said sched_clock_read() functions to be noinstr
    themselves, for ARCH_WANTS_NO_INSTR users. See the next few patches.
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Tested-by: Michael Kelley <mikelley@microsoft.com>  # Hyper-V
    Link: https://lore.kernel.org/r/20230519102715.302350330@infradead.org
    5949a68c
sched_clock.c 7.95 KB