[PATCH v2 1/2] vmcoreinfo: expose hardware error recovery statistics via sysfs

Breno Leitao leitao at debian.org
Tue Jul 7 07:13:19 PDT 2026


Hello Baoquan,

On Wed, Feb 11, 2026 at 10:01:05AM +0800, Baoquan He wrote:
> On 02/02/26 at 06:27am, Breno Leitao wrote:
> > Add a sysfs directory at /sys/kernel/hwerr_recovery_stats/ to expose
> > hardware error recovery statistics that are already tracked by the
> > kernel. This allows userspace monitoring tools to track recovered
> > hardware errors without requiring kernel crashes.
> > 
> > This is useful to track recoverable hardware errors in a time series,
> > even if the host doesn't crash.
> > 
> > The sysfs directory contains one file per error subsystem:
> > 
> >   /sys/kernel/hwerr_recovery_stats/cpu     - CPU-related errors (MCE, ARM errors)
> >   /sys/kernel/hwerr_recovery_stats/memory  - Memory-related errors
> >   /sys/kernel/hwerr_recovery_stats/pci     - PCI/PCIe AER non-fatal errors
> >   /sys/kernel/hwerr_recovery_stats/cxl     - CXL errors
> >   /sys/kernel/hwerr_recovery_stats/others  - Other hardware errors
> > 
> > Each file contains a single integer representing the count of recovered
> > errors for that subsystem.
> > 
> > These statistics provide visibility into the health of the system's
> > hardware and can be used by system administrators to proactively detect
> > failing components before they cause system crashes.
> > 
> > Signed-off-by: Breno Leitao <leitao at debian.org>
> > ---
> >  kernel/vmcore_info.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 55 insertions(+)
> > 
> > diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c
> > index e2784038bbed7..b7fcd21be7c59 100644
> > --- a/kernel/vmcore_info.c
> > +++ b/kernel/vmcore_info.c
> 
> Since we agreed hwerr_recovery_stats has nothing to do with vmcore, it
> seems inappropriate to put its sysfs handling code in
> kernel/vmcore_info.c. File kernel/vmcore_info.c is only used to build
> vmcore info for later vmcore dumping. And hwerr_log_error_type() should
> not be put in kernel/vmcore_info.c. either. I didn't check this
> carefully before, sorry. Please reconsider if these can be handled better.

I've sent an RFC to move it to RAS code, which I think it belongs
better. Does it make more sense?

https://lore.kernel.org/all/20260707-hwerr-ras-v1-1-4aea4a79d085@debian.org/

Thanks,
--breno



More information about the linux-arm-kernel mailing list