Commit f4b239e4 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/64s/powernv: Ratelimit harmless HMI error printing

Harmless HMI errors can be triggered by guests in some cases, and don't
contain much useful information anyway. Ratelimit these to avoid
flooding the console/logs.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
[mpe: Use dedicated ratelimit state, not printk_ratelimit()]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201128070728.825934-6-npiggin@gmail.com
parent 1d15ffdf
...@@ -213,6 +213,8 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt) ...@@ -213,6 +213,8 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt)
"A hypervisor resource error occurred", "A hypervisor resource error occurred",
"CAPP recovery process is in progress", "CAPP recovery process is in progress",
}; };
static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);
/* Print things out */ /* Print things out */
if (hmi_evt->version < OpalHMIEvt_V1) { if (hmi_evt->version < OpalHMIEvt_V1) {
...@@ -240,19 +242,22 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt) ...@@ -240,19 +242,22 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt)
break; break;
} }
printk("%s%s Hypervisor Maintenance interrupt [%s]\n", if (hmi_evt->severity != OpalHMI_SEV_NO_ERROR || __ratelimit(&rs)) {
level, sevstr, printk("%s%s Hypervisor Maintenance interrupt [%s]\n",
hmi_evt->disposition == OpalHMI_DISPOSITION_RECOVERED ? level, sevstr,
"Recovered" : "Not recovered"); hmi_evt->disposition == OpalHMI_DISPOSITION_RECOVERED ?
error_info = hmi_evt->type < ARRAY_SIZE(hmi_error_types) ? "Recovered" : "Not recovered");
hmi_error_types[hmi_evt->type] error_info = hmi_evt->type < ARRAY_SIZE(hmi_error_types) ?
: "Unknown"; hmi_error_types[hmi_evt->type]
printk("%s Error detail: %s\n", level, error_info); : "Unknown";
printk("%s HMER: %016llx\n", level, be64_to_cpu(hmi_evt->hmer)); printk("%s Error detail: %s\n", level, error_info);
if ((hmi_evt->type == OpalHMI_ERROR_TFAC) || printk("%s HMER: %016llx\n", level,
(hmi_evt->type == OpalHMI_ERROR_TFMR_PARITY)) be64_to_cpu(hmi_evt->hmer));
printk("%s TFMR: %016llx\n", level, if ((hmi_evt->type == OpalHMI_ERROR_TFAC) ||
(hmi_evt->type == OpalHMI_ERROR_TFMR_PARITY))
printk("%s TFMR: %016llx\n", level,
be64_to_cpu(hmi_evt->tfmr)); be64_to_cpu(hmi_evt->tfmr));
}
if (hmi_evt->version < OpalHMIEvt_V2) if (hmi_evt->version < OpalHMIEvt_V2)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment