Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Breno Leitao" <leitao@debian.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH RFC] RAS: hwerr_tracking: move recoverable hardware error tracking out of vmcoreinfo
Date: Tue, 07 Jul 2026 14:16:51 +0000	[thread overview]
Message-ID: <20260707141651.ED9601F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707-hwerr-ras-v1-1-4aea4a79d085@debian.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The official documentation for hardware recoverable error tracking was not updated to reflect the new configuration gate and conceptual location.

Pre-existing issues:
- [High] Calling ktime_get_real_seconds() from NMI context causes a permanent seqcount deadlock on 32-bit platforms.
--

--- Patch [1]: [PATCH RFC] RAS: hwerr_tracking: move recoverable hardware error tracking out of vmcoreinfo ---
commit 1752de8824c67025df12b2ca7f3f5aa9d829d649
Author: Breno Leitao <leitao@debian.org>

RAS: hwerr_tracking: move recoverable hardware error tracking out of vmcoreinfo

This patch moves recoverable hardware error tracking out of vmcoreinfo
and into a dedicated RAS tracking file. It introduces CONFIG_RAS_HWERR
to allow independent configuration and updates included paths for callers.

Link: https://lore.kernel.org/all/aYvi4Y_HNqk_u1-v@fedora/ [1]

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 15011f5752a99..eee6072dc28f2 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22536,6 +22536,13 @@ L:	linux-edac@vger.kernel.org
>  S:	Maintained
>  F:	drivers/ras/amd/fmpm.c
>  
> +RAS RECOVERABLE HARDWARE ERROR TRACKING
> +M:	Breno Leitao <leitao@kernel.org>
> +L:	linux-edac@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/driver-api/hw-recoverable-errors.rst

[Severity: Low]
Does this patch miss updating the documentation? 

The commit moves the configuration gate from CONFIG_VMCORE_INFO to a new
dedicated CONFIG_RAS_HWERR, and extracts the feature from vmcoreinfo.
However, Documentation/driver-api/hw-recoverable-errors.rst is not updated
in this patch to reflect the new Kconfig dependencies and conceptual
location.

[ ... ]

> diff --git a/drivers/ras/hwerr_tracking.c b/drivers/ras/hwerr_tracking.c
> new file mode 100644
> index 0000000000000..847c01fb24d55
> --- /dev/null
> +++ b/drivers/ras/hwerr_tracking.c
> @@ -0,0 +1,35 @@
[ ... ]
> +void hwerr_log_error_type(enum hwerr_error_type src)
> +{
> +	if (src < 0 || src >= HWERR_RECOV_MAX)
> +		return;
> +
> +	atomic_inc(&hwerr_data[src].count);
> +	WRITE_ONCE(hwerr_data[src].timestamp, ktime_get_real_seconds());

[Severity: High]
This is a pre-existing issue, but can calling ktime_get_real_seconds() from
an NMI context cause a permanent seqcount deadlock on 32-bit platforms?

If a hardware error triggers an NMI (such as x86 Machine Check or APEI
GHES), hwerr_log_error_type() is called to record the error. On 32-bit
architectures, reading the 64-bit time requires a seqcount retry loop:

kernel/time/timekeeping.c:ktime_get_real_seconds() {
    ...
    do {
        seq = read_seqcount_begin(&tk_core.seq);
        seconds = tk->xtime_sec;
    } while (read_seqcount_retry(&tk_core.seq, seq));
    ...
}

If the NMI interrupts a timekeeping update on the exact same CPU, the
sequence counter is odd, and the read side will spin indefinitely waiting
for it to become even. Since the interrupted writer is preempted on the same
CPU, it can never progress, resulting in a hard deadlock.

Would it be safer to use an NMI-safe API such as ktime_get_real_fast_ns()
to prevent a recoverable error from causing a system freeze?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707-hwerr-ras-v1-1-4aea4a79d085@debian.org?part=1

  reply	other threads:[~2026-07-07 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 14:02 [PATCH RFC] RAS: hwerr_tracking: move recoverable hardware error tracking out of vmcoreinfo Breno Leitao
2026-07-07 14:16 ` sashiko-bot [this message]
2026-07-07 16:02 ` Borislav Petkov
2026-07-07 16:53   ` Breno Leitao
2026-07-07 18:35     ` Borislav Petkov
2026-07-08 10:13       ` Breno Leitao
2026-07-10 20:35 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260707141651.ED9601F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox