]> xenbits.xensource.com Git - xen.git/commit
x86/intel: Fix PERF_GLOBAL fixup when virtualised
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 21 Jan 2025 16:56:26 +0000 (16:56 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 28 Jan 2025 11:19:45 +0000 (11:19 +0000)
commitdd05d265b8abda4cc7206b29cd71b77fb46658bf
treee50242c80239d0e47571355b07705d9ed0d3240d
parent8306d773b03acec6062c0547ac05e3dd4a6960f6
x86/intel: Fix PERF_GLOBAL fixup when virtualised

Logic using performance counters needs to look at
MSR_MISC_ENABLE.PERF_AVAILABLE before touching any other resources.

When virtualised under ESX, Xen dies with a #GP fault trying to read
MSR_CORE_PERF_GLOBAL_CTRL.

Factor this logic out into a separate function (it's already too squashed to
the RHS), and insert a check of MSR_MISC_ENABLE.PERF_AVAILABLE.

This also avoids setting X86_FEATURE_ARCH_PERFMON if MSR_MISC_ENABLE says that
PERF is unavailable, although oprofile (the only consumer of this flag)
cross-checks too.

Fixes: 6bdb965178bb ("x86/intel: ensure Global Performance Counter Control is setup correctly")
Reported-by: Jonathan Katz <jonathan.katz@aptar.com>
Link: https://xcp-ng.org/forum/topic/10286/nesting-xcp-ng-on-esx-8
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Tested-by: Jonathan Katz <jonathan.katz@aptar.com>
xen/arch/x86/cpu/intel.c