From: Eric Biggers <ebiggers@kernel.org>
To: x86@kernel.org, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Dapeng Mi <dapeng1.mi@linux.intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Jiaming Zhang <r772577952@gmail.com>,
Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 3/4] perf/x86/intel: Remove redundant cpu_has_xfeatures() checks
Date: Sat, 5 Dec 2026 21:12:24 -0800 [thread overview]
Message-ID: <20261206051225.298193-4-ebiggers@kernel.org> (raw)
In-Reply-To: <20261206051225.298193-1-ebiggers@kernel.org>
Remove the cpu_has_xfeatures() checks from
__intel_update_pmu_xregs_caps(), since they are redundant with the
corresponding X86_FEATURE_* checks. fpu__init_system_xstate() already
disables XSAVE (and therefore XSAVES), AVX, AVX512F, SHSTK (and
USER_SHSTK), and APX if their required xstate components are missing.
Also simplify the AVX-512 case to OR in XFEATURE_MASK_AVX512 directly.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
arch/x86/events/intel/core.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index e752111f5ecd7..2f6ad6121a815 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -6255,8 +6255,7 @@ static inline void __intel_update_pmu_xregs_caps(struct pmu *pmu)
if (!boot_cpu_has(X86_FEATURE_XSAVES))
return;
- if (!boot_cpu_has(X86_FEATURE_XMM) ||
- !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
+ if (!boot_cpu_has(X86_FEATURE_XMM))
return;
/*
@@ -6266,22 +6265,13 @@ static inline void __intel_update_pmu_xregs_caps(struct pmu *pmu)
*/
x86_pmu.ext_regs_mask |= XFEATURE_MASK_SSE;
- if (boot_cpu_has(X86_FEATURE_AVX) &&
- cpu_has_xfeatures(XFEATURE_MASK_YMM, NULL))
+ if (boot_cpu_has(X86_FEATURE_AVX))
x86_pmu.ext_regs_mask |= XFEATURE_MASK_YMM;
- if (boot_cpu_has(X86_FEATURE_APX) &&
- cpu_has_xfeatures(XFEATURE_MASK_APX, NULL))
+ if (boot_cpu_has(X86_FEATURE_APX))
x86_pmu.ext_regs_mask |= XFEATURE_MASK_APX;
- if (boot_cpu_has(X86_FEATURE_AVX512F)) {
- if (cpu_has_xfeatures(XFEATURE_MASK_OPMASK, NULL))
- x86_pmu.ext_regs_mask |= XFEATURE_MASK_OPMASK;
- if (cpu_has_xfeatures(XFEATURE_MASK_ZMM_Hi256, NULL))
- x86_pmu.ext_regs_mask |= XFEATURE_MASK_ZMM_Hi256;
- if (cpu_has_xfeatures(XFEATURE_MASK_Hi16_ZMM, NULL))
- x86_pmu.ext_regs_mask |= XFEATURE_MASK_Hi16_ZMM;
- }
- if (cpu_feature_enabled(X86_FEATURE_USER_SHSTK) &&
- cpu_has_xfeatures(XFEATURE_MASK_CET_USER, NULL))
+ if (boot_cpu_has(X86_FEATURE_AVX512F))
+ x86_pmu.ext_regs_mask |= XFEATURE_MASK_AVX512;
+ if (cpu_feature_enabled(X86_FEATURE_USER_SHSTK))
x86_pmu.ext_regs_mask |= XFEATURE_MASK_CET_USER;
dest_pmu->capabilities |= PERF_PMU_CAP_EXTENDED_REGS;
--
2.56.1
next prev parent reply other threads:[~2026-12-06 5:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 5:12 [PATCH 0/4] x86/fpu: Complete the removal of cpu_has_xfeatures() Eric Biggers
2026-12-06 5:12 ` [PATCH 1/4] x86/fpu: Check for missing CET_USER xstate component Eric Biggers
2026-12-06 5:12 ` [PATCH 2/4] x86/fpu: Check for missing APX " Eric Biggers
2026-12-06 5:12 ` Eric Biggers [this message]
2026-12-06 5:12 ` [PATCH 4/4] x86/fpu: Remove cpu_has_xfeatures() Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261206051225.298193-4-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=bp@alien8.de \
--cc=dapeng1.mi@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hch@lst.de \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=r772577952@gmail.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®