Commit 3cb3c2f
Peter Zijlstra
perf: Clean up mediated vPMU accounting
The mediated_pmu_account_event() and perf_create_mediated_pmu()
functions implement the exclusion between '!exclude_guest' counters
and mediated vPMUs. Their implementation is basically identical,
except mirrored in what they count/check.
Make sure the actual implementations reflect this similarity.
Notably:
- while perf_release_mediated_pmu() has an underflow check;
mediated_pmu_unaccount_event() did not.
- while perf_create_mediated_pmu() has an inc_not_zero() path;
mediated_pmu_account_event() did not.
Also, the inc_not_zero() path can be outsite of
perf_mediated_pmu_mutex. The mutex must guard the 0->1 (of either
nr_include_guest_events or nr_mediated_pmu_vms) transition, but once a
counter is already non-zero, it can safely be incremented further.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251208115156.GE3707891@noisy.programming.kicks-ass.net1 parent 3006911 commit 3cb3c2f
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6344 | 6344 | | |
6345 | 6345 | | |
6346 | 6346 | | |
6347 | | - | |
| 6347 | + | |
| 6348 | + | |
6348 | 6349 | | |
| 6350 | + | |
6349 | 6351 | | |
6350 | 6352 | | |
6351 | 6353 | | |
| |||
6358 | 6360 | | |
6359 | 6361 | | |
6360 | 6362 | | |
| 6363 | + | |
| 6364 | + | |
| 6365 | + | |
6361 | 6366 | | |
6362 | 6367 | | |
6363 | 6368 | | |
| |||
6373 | 6378 | | |
6374 | 6379 | | |
6375 | 6380 | | |
6376 | | - | |
6377 | 6381 | | |
6378 | 6382 | | |
6379 | 6383 | | |
| 6384 | + | |
6380 | 6385 | | |
6381 | 6386 | | |
6382 | 6387 | | |
| |||
0 commit comments