perf: Add wrappers for invoking guest callbacks
authorSean Christopherson <seanjc@google.com>
Thu, 11 Nov 2021 02:07:28 +0000 (02:07 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 17 Nov 2021 13:49:08 +0000 (14:49 +0100)
commit1c3430516b0732d923de9fd3bfb3e2e537eeb235
tree5c0f082876f3d6915b25af636d43bd2df7e00f4c
parentb9f5621c9547dd787900f005a9e1c3d5712de512
perf: Add wrappers for invoking guest callbacks

Add helpers for the guest callbacks to prepare for burying the callbacks
behind a Kconfig (it's a lot easier to provide a few stubs than to #ifdef
piles of code), and also to prepare for converting the callbacks to
static_call().  perf_instruction_pointer() in particular will have subtle
semantics with static_call(), as the "no callbacks" case will return 0 if
the callbacks are unregistered between querying guest state and getting
the IP.  Implement the change now to avoid a functional change when adding
static_call() support, and because the new helper needs to return
_something_ in this case.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Link: https://lore.kernel.org/r/20211111020738.2512932-8-seanjc@google.com
arch/arm64/kernel/perf_callchain.c
arch/x86/events/core.c
arch/x86/events/intel/core.c
include/linux/perf_event.h