]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86/amd: Add idle hooks for branch sampling
authorStephane Eranian <eranian@google.com>
Tue, 22 Mar 2022 22:15:13 +0000 (15:15 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Apr 2022 08:24:38 +0000 (10:24 +0200)
commit59562dfb11c80d4fd3e537be78f7ac10127a234d
treede075a68f6b4b1265a8ecd0f0cf1bf65e08d084e
parent7e00c7369ec9976bd73f728a41df6747c38a7861
perf/x86/amd: Add idle hooks for branch sampling

On AMD Fam19h Zen3, the branch sampling (BRS) feature must be disabled before
entering low power and re-enabled (if was active) when returning from low
power. Otherwise, the NMI interrupt may be held up for too long and cause
problems. Stopping BRS will cause the NMI to be delivered if it was held up.

Define a perf_amd_brs_lopwr_cb() callback to stop/restart BRS.  The callback
is protected by a jump label which is enabled only when AMD BRS is detected.
In all other cases, the callback is never called.

Signed-off-by: Stephane Eranian <eranian@google.com>
[peterz: static_call() and build fixes]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220322221517.2510440-10-eranian@google.com
arch/x86/events/amd/brs.c
arch/x86/events/amd/core.c
arch/x86/events/perf_event.h
arch/x86/include/asm/perf_event.h