All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 3/3] drm/xe/ras: Suppress reports for repeated DB-ECC errors
Date: Thu, 03 Dec 2026 11:03:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-247639@kernel.org> (raw)
In-Reply-To: <20261203103632.2379654-8-mallesh.koujalagi@intel.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] drm/xe/ras: ras_send_error_event() drops events after wedging
  errors
- [Medium] drm/xe/ras: removing xe_info() leaves default RAS components
  unlogged
- [Medium] drm/xe/ras: quiet suppression masks failed or first-time page
  offlines
- [Low] drm/xe/ras: TOCTOU on offlined_pages in
  handle_device_memory_errors()
--

commit df9f80dd3af4214c7ee1c52db5140c24a8bb1d09
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>

drm/xe/ras: Suppress reports for repeated DB-ECC errors

This commit suppresses dmesg logs, CPER records, and DRM-RAS error events
when a repeated double-bit ECC error hits an already hard-offlined page
and page offlining succeeds.  It also removes the generic info log from
xe_ras_process_errors() and moves ras_send_error_event() after the
component error handlers.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index fa23325fb691c..d8042ef83dbc5 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c

[ ... ]

> @@ -675,11 +679,18 @@ static u8 handle_device_memory_errors(struct xe_device *xe, struct xe_ras_error_
>  			break;
>  		}
>  
> +		/* Check if the page was already hard-offlined */
> +		recurrent = xe_ras_get_enable_vram_page_offline(xe) &&
> +			    page_is_hard_offlined(xe, info->sw_address);
>  		ret = handle_page_offline(xe, info->sw_address, true);
> -		xe_log_comp(xe, ret ? cper_sev : CPER_SEV_INFORMATIONAL,
> -			    DEVICE_MEMORY, &arr->counter, sizeof(arr->counter),
> -			    "Double-bit ECC error detected at sw address 0x%llx\n",
> -			    info->sw_address);
> +
> +		/* Suppress reporting for repeated errors on hard-offlined pages */
> +		*quiet = recurrent && !ret;
> +		if (!*quiet)
> +			xe_log_comp(xe, ret ? cper_sev : CPER_SEV_INFORMATIONAL,
> +				    DEVICE_MEMORY, &arr->counter, sizeof(arr->counter),
> +				    "Double-bit ECC error detected at sw address 0x%llx\n",
> +				    info->sw_address);

[Severity: Medium]
Can setting *quiet from recurrent && !ret suppress reporting when
handle_page_offline() actually failed or soft-offlined a live page?

In handle_page_offline(), errors from xe_ttm_vram_handle_addr_fault()
other than -EIO, -EEXIST, or -ENOMEM (such as -EOPNOTSUPP or -ENXIO) skip
send_page_offline_cmd() and return 0.  If the page is in
state->offlined_pages, *quiet becomes true and drops the CPER and event.

Probe-time process_offline_pages() also inserts pages into
state->offlined_pages even when handle_page_offline() fails with -ENOMEM,
so a later DB-ECC error on a live BO at that address returns 0 and gets
suppressed.

Returning quiet directly from handle_page_offline() only on a successful
-EEXIST hard-offlined path would avoid both cases and drop the duplicate
checks.

[Severity: Low]
Can concurrent calls to xe_ras_process_errors() race on offlined_pages and
miss suppressing a repeated DB-ECC error?

For non-fatal PCIe AER errors where is_aer_internal_error() is false,
xe_pci_error_detected() leaves hw_error_work enabled, and
xe_ras_process_errors() has no lock serializing callers:

CPU0 (hw_error_work)              CPU1 (xe_pci_error_mmio_enabled)
--------------------              --------------------------------
xe_ras_process_errors()           xe_ras_process_errors()
  handle_device_memory_errors()     handle_device_memory_errors()
    handle_page_offline()             page_is_hard_offlined() -> false
      send_page_offline_cmd()
        xa_store(offlined_pages)
                                      handle_page_offline()
                                        page_is_hard_offlined() -> true
                                        send_page_offline_cmd(REMOVE)
                                      *quiet = false  <-- not suppressed

CPU1 handles the error as a hard-offlined repeat and removes it from
firmware, but still emits a duplicate log, CPER record, and DRM-RAS event.

[ ... ]

> @@ -880,15 +892,6 @@ enum xe_ras_recovery_action xe_ras_process_errors(struct xe_device *xe)
>  			if (!ras_counter_is_valid(xe, &arr->counter))
>  				continue;
>  
> -			xe_info(xe, "[RAS]: %s %s detected\n", comp_to_str(component),
> -				sev_to_str(severity));
> -
> -			/* Send event once per component */
> -			if (!(sent & BIT(component))) {
> -				sent |= BIT(component);
> -				ras_send_error_event(xe, severity, component);
> -			}
> -
>  			switch (component) {
>  			case XE_RAS_COMP_CORE_COMPUTE:
>  				action = handle_core_compute_errors(xe, arr);

[Severity: Medium]
Does removing this xe_info() leave valid RAS components in the default
switch branch completely unlogged?

ras_counter_is_valid() accepts XE_RAS_COMP_PCIE and XE_RAS_COMP_RESERVED,
which fall into the default case and request XE_RAS_RECOVERY_ACTION_RESET
with no dmesg diagnostic (and XE_RAS_COMP_RESERVED emits no DRM-RAS event
either).  Logging in the default branch, with XE_RAS_COMP_FABRIC breaking
before it, would preserve diagnostics for those resets.

Also, the commit message does not mention removing this generic info log
across all components.

[ ... ]

> @@ -910,6 +913,12 @@ enum xe_ras_recovery_action xe_ras_process_errors(struct xe_device *xe)
>  				break;
>  			}
>  
> +			/* Send event once per component, except for quiet repeats */
> +			if (!quiet && !(sent & BIT(component))) {
> +				sent |= BIT(component);
> +				ras_send_error_event(xe, severity, component);
> +			}
> +

[Severity: High]
As reported by Rodrigo Vivi on v1 [1], does moving ras_send_error_event()
after switch (component) drop DRM-RAS events whenever a handler wedges the
device?

When handle_page_offline() fails in handle_device_memory_errors(), it
calls xe_wedge_declare() before returning; handle_soc_internal_errors()
does the same for CSC firmware and PUNIT errors.  In the default wedge
mode, xe_wedge_declare() synchronously increments xe->wedged.ref via
xe_wedge_get().

When ras_send_error_event() then runs, it issues a sysctrl get_counter()
mailbox round-trip and calls xe_drm_ras_event() -> drm_ras_counter_get(),
which sees xe_wedged(xe) and returns -ECANCELED without emitting the
netlink event.  Userspace therefore misses the DRM-RAS event on failed
DB-ECC handling and fatal SoC errors.

[1] https://lore.kernel.org/r/axBhw3UHcIu4IdFb@intel.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203103632.2379654-5-mallesh.koujalagi@intel.com?part=3

  reply	other threads:[~2026-12-03 11:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 10:36 [PATCH v2 0/3] drm/xe/ras: Suppress repeated DB-ECC reports Mallesh Koujalagi
2026-12-03 10:36 ` [PATCH v2 1/3] drm/xe/ras: Add helper to check hard-offlined pages Mallesh Koujalagi
2026-12-03 10:36 ` [PATCH v2 2/3] drm/xe/ras: Downgrade repeated page removal message to debug Mallesh Koujalagi
2026-12-03 10:36 ` [PATCH v2 3/3] drm/xe/ras: Suppress reports for repeated DB-ECC errors Mallesh Koujalagi
2026-12-03 11:03   ` sashiko-bot [this message]
2026-12-03 13:27   ` Tauro, Riana
2026-12-04 13:59     ` Mallesh, Koujalagi
2026-12-03 10:54 ` ✓ CI.KUnit: success for drm/xe/ras: Suppress repeated DB-ECC reports (rev2) Patchwork
2026-12-03 11:26 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-04  9:32 ` ✓ Xe.CI.FULL: " Patchwork

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=sashiko-outbox-247639@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.