summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorSandipan Das <sandipan.das@amd.com>2026-11-02 15:52:07 +0530
committerPeter Zijlstra <peterz@infradead.org>2026-11-06 11:45:14 +0100
commit0ae655bce1934857fa3e316ddcb4be38c30dbd38 (patch)
treea383f83a2f87bdf902eaefaf5465498ae31a9437 /tools/perf/scripts/python
parent6f083fbccd5f06889bc08e1182bd02c0383b9121 (diff)
perf/x86/amd/uncore: Avoid context migration from non-owners
Each uncore context is owned by a single CPU that hosts all events for the corresponding uncore domain and is advertised through the sysfs cpumask attribute. When a CPU goes offline, the context is migrated to an online sibling if the departing CPU is the owner. Before commit d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management"), uncore_down_prepare() checked whether the CPU going offline owned the context. The check was lost when the function was replaced by amd_uncore_ctx_move(). Hence, when a CPU that is not the owner goes offline, ownership is always handed over to the first online sibling in the uncore domain irrespective of whether another sibling already owns it. This goes unnoticed as long as the owner is the lowest-numbered online CPU in the domain, since the first online sibling is then the owner itself. Once ownership has moved, that no longer holds. For example, consider an L3 domain spanning CPUs 8-15,136-143 and owned by CPU 8. $ cat /sys/bus/event_source/devices/amd_l3/cpumask 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120 $ echo 0 | sudo tee /sys/devices/system/cpu/cpu8/online $ cat /sys/bus/event_source/devices/amd_l3/cpumask 0,9,16,24,32,40,48,56,64,72,80,88,96,104,112,120 $ echo 1 | sudo tee /sys/devices/system/cpu/cpu8/online $ cat /sys/bus/event_source/devices/amd_l3/cpumask 0,9,16,24,32,40,48,56,64,72,80,88,96,104,112,120 $ echo 0 | sudo tee /sys/devices/system/cpu/cpu10/online $ cat /sys/bus/event_source/devices/amd_l3/cpumask 0,8-9,16,24,32,40,48,56,64,72,80,88,96,104,112,120 Offlining CPU 8 correctly moves ownership to CPU 9 and onlining it again leaves CPU 9 as the owner. However, offlining CPU 10 then makes CPU 8 the owner while existing events remain on CPU 9. Both CPUs are now advertised for the same domain, so tools that open an event on every CPU in the cpumask count the domain twice, and the context gets modified from two CPUs without any synchronization. Restore the ownership check that was lost during the refactor. Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management") Signed-off-by: Sandipan Das <sandipan.das@amd.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/273135a6d33a40f442fb18e140a90689fae7cd32.1793614726.git.sandipan.das@amd.com
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions