Commit 6590d00b authored by Sean Christopherson's avatar Sean Christopherson Committed by Will Deacon
Browse files

UPSTREAM: perf/core: Use static_call to optimize perf_guest_info_callbacks



Use static_call to optimize perf's guest callbacks on arm64 and x86,
which are now the only architectures that define the callbacks.  Use
DEFINE_STATIC_CALL_RET0 as the default/NULL for all guest callbacks, as
the callback semantics are that a return value '0' means "not in guest".

static_call obviously avoids the overhead of CONFIG_RETPOLINE=y, but is
also advantageous versus other solutions, e.g. per-cpu callbacks, in that
a per-cpu memory load is not needed to detect the !guest case.

Based on code from Peter and Like.

Suggested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Link: https://lore.kernel.org/r/20211111020738.2512932-10-seanjc@google.com


(cherry picked from commit 87b940a0)
Signed-off-by: default avatarWill Deacon <willdeacon@google.com>
Bug: 233587962
Bug: 233588291
Change-Id: Ia6b15724966e0b07b1d0794490ff067a7319c18a
parent 5945311c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment