]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf/x86/intel: Fix ARCH_PERFMON_NUM_COUNTER_LEAF
authorKan Liang <kan.liang@linux.intel.com>
Wed, 29 Jan 2025 15:48:19 +0000 (07:48 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 13:01:29 +0000 (14:01 +0100)
commitaa7a1bee54f98395cea97743cc7102783cf4939f
treec0d885c7bfc72fb67dbafb8b4ed3b220f11ed52c
parent55057ec275f7ad8016f74f274e45468fb0ed78a9
perf/x86/intel: Fix ARCH_PERFMON_NUM_COUNTER_LEAF

commit 47a973fd75639fe80d59f9e1860113bb2a0b112b upstream.

The EAX of the CPUID Leaf 023H enumerates the mask of valid sub-leaves.
To tell the availability of the sub-leaf 1 (enumerate the counter mask),
perf should check the bit 1 (0x2) of EAS, rather than bit 0 (0x1).

The error is not user-visible on bare metal. Because the sub-leaf 0 and
the sub-leaf 1 are always available. However, it may bring issues in a
virtualization environment when a VMM only enumerates the sub-leaf 0.

Introduce the cpuid35_e?x to replace the macros, which makes the
implementation style consistent.

Fixes: eb467aaac21e ("perf/x86/intel: Support Architectural PerfMon Extension leaf")
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20250129154820.3755948-3-kan.liang@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/events/intel/core.c
arch/x86/include/asm/perf_event.h