Re: [PATCH v4] vmcoreinfo: Track and log recoverable hardware errors

Breno Leitao
2025-08-01T15:13:31Z

Hello Dave,

On Fri, Aug 01, 2025 at 07:52:17AM -0700, Dave Hansen wrote:
> On 8/1/25 05:31, Breno Leitao wrote:
> > Introduce a generic infrastructure for tracking recoverable hardware
> > errors (HW errors that are visible to the OS but does not cause a panic)
> > and record them for vmcore consumption.
> ...
>
> Are there patches for the consumer side of this, too? Or do humans
> looking at crash dumps have to know what to go digging for?
>
> In either case, don't we need documentation for this new ABI?

I have considered this, but the documentation for vmcoreinfo
(admin-guide/kdump/vmcoreinfo.rst) solely documents what is explicitly
exposed by vmcore, which differs from the nature of these counters.

Where would be a good place to document it?

> > @@ -1690,6 +1691,9 @@ noinstr void do_machine_check(struct pt_regs *regs)
> > }
> >
> > out:
> > + /* Given it didn't panic, mark it as recoverable */
> > + hwerr_log_error_type(HWERR_RECOV_MCE);
> > +
>
> Does "MCE" mean anything outside of x86?

AFAIK this is a MCE concept.

> I wonder if this would be better left as "HWERR_RECOV_ARCH" or something.

Sure. I can update it to be more generic.

> > +void hwerr_log_error_type(enum hwerr_error_type src)
> > +{
> > + if (src < 0 || src >= HWERR_RECOV_MAX)
> > + return;
> > +
> > + /* No need to atomics/locks given the precision is not important */
>
> Sure, but it's not even more lines of code to do:
>
> atomic_inc(&hwerr_data[src].count);
> WRITE_ONCE(hwerr_data[src].timestamp, ktime_get_real_seconds());
>
> So why not?

Sure, we can do that, I will update it also.

> > + hwerr_data[src].count++;
> > + hwerr_data[src].timestamp = ktime_get_real_seconds();
> > +}
> > +EXPORT_SYMBOL_GPL(hwerr_log_error_type);
>
> I'd also love to hear more about _actual_ users of this. Surely, someone
> hit a real world problem and thought this would be a nifty solution. Who
> was that? What problem did they hit? How does this help them?

Yes, this has been extensively discussed in the very first version of
the patch. Borislav raised the same question, which was discussed in the
following link:

https://lore.kernel.org/all/20250715125327.GGaHZPRz9QLNNO-7q8@fat_crate.local/

Thanks for the review,
--breno