At the first (and maybe second) glance the call to setup_clear_cpu_cap()
(which is __init) from psr_cpu_init() (which isn't) looks wrong. The
earlier cpu_has_pqe makes it safe, though. Nevertheless we can do better,
by simply moving the check ahead of the BSP invocation of the function.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -1583,12 +1583,6 @@ static void psr_cpu_init(void)
if ( !psr_alloc_feat_enabled() || !cpu_has_pqe )
goto assoc_init;
- if ( boot_cpu_data.cpuid_level < PSR_CPUID_LEVEL_CAT )
- {
- setup_clear_cpu_cap(X86_FEATURE_PQE);
- goto assoc_init;
- }
-
socket = cpu_to_socket(cpu);
info = socket_info + socket;
if ( info->feat_init )
@@ -1708,6 +1702,9 @@ static int __init cf_check psr_presmp_in
if ( psr_cpu_prepare() )
psr_free();
+ if ( boot_cpu_data.cpuid_level < PSR_CPUID_LEVEL_CAT )
+ setup_clear_cpu_cap(X86_FEATURE_PQE);
+
psr_cpu_init();
if ( psr_cmt_enabled() || psr_alloc_feat_enabled() )
register_cpu_notifier(&cpu_nfb);
On 27/08/2025 9:16 am, Jan Beulich wrote: > At the first (and maybe second) glance the call to setup_clear_cpu_cap() > (which is __init) from psr_cpu_init() (which isn't) looks wrong. The > earlier cpu_has_pqe makes it safe, though. Nevertheless we can do better, > by simply moving the check ahead of the BSP invocation of the function. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> This is still terribly convoluted code.
© 2016 - 2025 Red Hat, Inc.