x86/MCE: adjust S3 resume handling
PATCH 1/1 x86/MCE: adjust S3 resume handling
The BSP resume path calls mcheck_init() with the address of boot_cpu_data, thus rendering comparisons against that pointer ineffective. The additional "bsp" boolean needs to be used (and propagated as necessary) instead.
While touching intel_init_thermal(), constify its 1st parameter, which in turn requires touching intel_thermal_supported() as well.
---
While I'm pretty sure about the change for the first of the printk()s in intel_init_thermal(), the 2nd one there is less clear. IOW there could be an argument for keeping the conditional as is there.
xen/arch/x86/cpu/mcheck/mce_amd.c +2 -2
@@ -318,7 +318,7 @@ amd_mcheck_init(const struct cpuinfo_x86mcequirk_amd_apply (quirkflag);if (cpu_has (c,X86_FEATURE_AMD_PPIN ) && - (c == &boot_cpu_data || ppin_msr) ) + (bsp || ppin_msr) ) {uint64_t val;
@@ -333,7 +333,7 @@ amd_mcheck_init(const struct cpuinfo_x86if ( !(val &PPIN_ENABLE ) ) ppin_msr =0 ; -else if ( c == &boot_cpu_data ) +else if ( bsp ) ppin_msr =MSR_AMD_PPIN ; }
xen/arch/x86/cpu/mcheck/mce_intel.c +9 -9
@@ -85,7 +85,7 @@ static void cf_check intel_thermal_inter }/* Thermal monitoring depends on APIC, ACPI and clock modulation */ -static bool intel_thermal_supported (struct cpuinfo_x86 *c) +static bool intel_thermal_supported (const struct cpuinfo_x86 *c) {if ( !cpu_has_apic )return false;
@@ -108,7 +108,7 @@ static void __init mcheck_intel_therm_in }/* P4/Xeon Thermal regulation detect and init */ -static void intel_init_thermal (struct cpuinfo_x86 *c) +static void intel_init_thermal (const struct cpuinfo_x86 *c,bool bsp) {uint64_t msr_content;uint32_t val;
@@ -141,7 +141,7 @@ static void intel_init_thermal(struct cpif ( (msr_content & (1ULL <<3 )) && (val &APIC_DM_MASK ) ==APIC_DM_SMI ) { -if ( c == &boot_cpu_data ) +if ( bsp )printk (KERN_DEBUG "Thermal monitoring handled by SMI\n" );return ;/* -EBUSY */ }
@@ -152,7 +152,7 @@ static void intel_init_thermal(struct cp/* check whether a vector already exists, temporarily masked? */ if ( val &APIC_VECTOR_MASK ) { -if ( c == &boot_cpu_data ) +if ( bsp )printk (KERN_DEBUG "Thermal LVT vector (%#x) already installed\n" , val &APIC_VECTOR_MASK );return ;/* -EBUSY */
@@ -850,7 +850,7 @@ static void intel_init_mce(bool bsp) mce_uhandler_num =ARRAY_SIZE (intel_mce_uhandlers); } -static void intel_init_ppin (const struct cpuinfo_x86 *c) +static void intel_init_ppin (const struct cpuinfo_x86 *c,bool bsp) {/* * Even if testing the presence of the MSR would be enough, we don't
@@ -878,7 +878,7 @@ static void intel_init_ppin(const structcase 0x6c :/* Icelake D */ case 0x8f :/* Sapphire Rapids X */ -if ( (c != &boot_cpu_data && !ppin_msr) || +if ( (!bsp && !ppin_msr) ||rdmsr_safe (MSR_PPIN_CTL , val) )return ;
@@ -891,7 +891,7 @@ static void intel_init_ppin(const structif ( !(val &PPIN_ENABLE ) ) ppin_msr =0 ; -else if ( c == &boot_cpu_data ) +else if ( bsp ) ppin_msr =MSR_PPIN ;break ;
@@ -992,9 +992,9 @@ enum mcheck_type intel_mcheck_init(strucintel_init_cmci (c); -intel_init_thermal (c); +intel_init_thermal (c, bsp); -intel_init_ppin (c); +intel_init_ppin (c, bsp);return mcheck_intel; }
Quoted 9 lines · Jan Beulich
The BSP resume path calls
mcheck_init()with the address ofboot_cpu_data, thus rendering comparisons against that pointer ineffective. The additional "bsp" boolean needs to be used (and propagated as necessary) instead.While touching
intel_init_thermal(), constify its 1st parameter, which in turn requires touchingintel_thermal_supported()as well.Signed-off-by Jan Beulich <[email protected]>
This is all horrible.