|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/2] x86/MCE: reduce number of MSR reads/lookups
MSRs mcheck_mca_logout() already reads don't need re-reading by functions it calls, even less so when it calls them exclusively. Seeing reports like [1], this also makes sure that what we use internally also is propagated to the MCE log. While touching function signatures, also switch bank number parameters to unsigned int. [1] https://lists.xen.org/archives/html/xen-devel/2026-10/msg01825.html Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- mcheck_cmn_handler()'s read of MSR_IA32_MCG_STATUS could likely also be dropped, by having mcheck_mca_logout() provide the value it read. --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -138,12 +138,8 @@ void mcabanks_free(struct mca_banks *ban xfree(banks); } -static void mcabank_clear(int banknum) +static void mcabank_clear(unsigned int banknum, uint64_t status) { - uint64_t status; - - status = mca_rdmsr(MSR_IA32_MCx_STATUS(banknum)); - if ( status & MCi_STATUS_ADDRV ) mca_wrmsr(MSR_IA32_MCx_ADDR(banknum), 0x0ULL); if ( status & MCi_STATUS_MISCV ) @@ -165,7 +161,8 @@ const struct mca_error_handler *__read_m unsigned int __read_mostly mce_dhandler_num; unsigned int __read_mostly mce_uhandler_num; -static void mca_init_bank(enum mca_source who, struct mc_info *mi, int bank) +static void mca_init_bank(enum mca_source who, struct mc_info *mi, + unsigned int bank, uint64_t status) { struct mcinfo_bank *mib; @@ -179,20 +176,20 @@ static void mca_init_bank(enum mca_sourc return; } - mib->mc_status = mca_rdmsr(MSR_IA32_MCx_STATUS(bank)); + mib->mc_status = status; mib->mc_bank = bank; mib->mc_domid = DOMID_INVALID; - if ( mib->mc_status & MCi_STATUS_MISCV ) + if ( status & MCi_STATUS_MISCV ) mib->mc_misc = mca_rdmsr(MSR_IA32_MCx_MISC(bank)); - if ( mib->mc_status & MCi_STATUS_ADDRV ) + if ( status & MCi_STATUS_ADDRV ) mib->mc_addr = mca_rdmsr(MSR_IA32_MCx_ADDR(bank)); - if ( (mib->mc_status & MCi_STATUS_MISCV) && - (mib->mc_status & MCi_STATUS_ADDRV) && - alternative_call(mce_callbacks.check_addr, mib->mc_status, + if ( (status & MCi_STATUS_MISCV) && + (status & MCi_STATUS_ADDRV) && + alternative_call(mce_callbacks.check_addr, status, mib->mc_misc, MC_ADDR_PHYSICAL) && (who == MCA_POLLER || who == MCA_CMCI_HANDLER) && (mfn_valid(_mfn(paddr_to_pfn(mib->mc_addr)))) ) @@ -211,14 +208,13 @@ static void mca_init_bank(enum mca_sourc } } -static int mca_init_global(uint32_t flags, struct mcinfo_global *mig) +static int mca_init_global(uint32_t flags, struct mcinfo_global *mig, + uint64_t status) { - uint64_t status; int cpu_nr; const struct vcpu *curr = current; /* Set global information */ - status = mca_rdmsr(MSR_IA32_MCG_STATUS); mig->mc_gstatus = status; mig->mc_domid = DOMID_INVALID; mig->mc_vcpuid = XEN_MC_VCPUID_INVALID; @@ -331,7 +327,7 @@ mcheck_mca_logout(enum mca_source who, s mig = x86_mcinfo_reserve(mci, sizeof(*mig), MC_TYPE_GLOBAL); /* mc_info should at least hold up the global information */ ASSERT(mig); - mca_init_global(mc_flags, mig); + mca_init_global(mc_flags, mig, gstatus); /* A hook here to get global extended msrs */ if ( IS_ENABLED(CONFIG_INTEL) && boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) @@ -351,7 +347,7 @@ mcheck_mca_logout(enum mca_source who, s /* uc = true, recover = true, we need not panic. */ recover = alternative_call(mce_callbacks.recoverable_scan, status); - mca_init_bank(who, mci, i); + mca_init_bank(who, mci, i, status); if ( mce_callbacks.info_collect ) alternative_vcall(mce_callbacks.info_collect, mci, i, status); @@ -359,7 +355,7 @@ mcheck_mca_logout(enum mca_source who, s /* By default, need_clear = true */ if ( who != MCA_MCE_SCAN && need_clear ) /* Clear bank */ - mcabank_clear(i); + mcabank_clear(i, status); else if ( who == MCA_MCE_SCAN && need_clear ) mcabanks_set(i, clear_bank); } @@ -548,7 +544,7 @@ void mcheck_mca_clearbanks(struct mca_ba { if ( !mcabanks_test(i, bankmask) ) continue; - mcabank_clear(i); + mcabank_clear(i, mca_rdmsr(MSR_IA32_MCx_STATUS(i))); } }
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |