Commit 87b940a
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: Peter Zijlstra (Intel) <peterz@infradead.org>
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-10-seanjc@google.com1 parent 2aef6f3 commit 87b940a
2 files changed
Lines changed: 23 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1244 | 1244 | | |
1245 | 1245 | | |
1246 | 1246 | | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
1258 | 1252 | | |
1259 | 1253 | | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
| 1254 | + | |
1263 | 1255 | | |
1264 | 1256 | | |
1265 | 1257 | | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
1271 | | - | |
1272 | | - | |
| 1258 | + | |
1273 | 1259 | | |
1274 | 1260 | | |
1275 | 1261 | | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
| 1262 | + | |
1281 | 1263 | | |
1282 | 1264 | | |
1283 | 1265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6524 | 6524 | | |
6525 | 6525 | | |
6526 | 6526 | | |
| 6527 | + | |
| 6528 | + | |
| 6529 | + | |
| 6530 | + | |
6527 | 6531 | | |
6528 | 6532 | | |
6529 | 6533 | | |
6530 | 6534 | | |
6531 | 6535 | | |
6532 | 6536 | | |
| 6537 | + | |
| 6538 | + | |
| 6539 | + | |
| 6540 | + | |
| 6541 | + | |
| 6542 | + | |
| 6543 | + | |
6533 | 6544 | | |
6534 | 6545 | | |
6535 | 6546 | | |
| |||
6539 | 6550 | | |
6540 | 6551 | | |
6541 | 6552 | | |
| 6553 | + | |
| 6554 | + | |
| 6555 | + | |
| 6556 | + | |
6542 | 6557 | | |
6543 | 6558 | | |
6544 | 6559 | | |
| |||
0 commit comments