Intel-XE Archive on 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 v1] drm/xe/ras: Suppress recurrent DB-ECC reports for hard-offlined pages
Date: Tue, 01 Dec 2026 10:47:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-243094@kernel.org> (raw)
In-Reply-To: <20261201103604.2253707-2-mallesh.koujalagi@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/xe/ras: xe_ras_process_errors() suppresses reports before
  handler fails
- [Medium] drm/xe/ras: inconsistent hard-offline checks in
  handle_page_offline()
--

commit e4e6d95f2074dc3797cbc88978fa20a3d512eb13
Author: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>

drm/xe/ras: Suppress recurrent DB-ECC reports for hard-offlined pages

This commit suppresses per-page action logs, component detection logs,
DRM RAS events, and CPER emission for recurrent DB-ECC errors on pages
that have already been hard-offlined by firmware.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 9b04be3405ca7..1c6b78860af54 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c

[ ... ]

> @@ -303,16 +305,28 @@ static int send_page_offline_cmd(struct xe_device *xe, u64 page_address,
>  			xe_err(xe, "[RAS]: Failed to store offlined page 0x%llx: %d\n",
>  			       page_address, ret);
>  	} else {
> -		xe_info(xe, "[RAS]: Page address 0x%llx removed from queue\n", page_address);
> +		if (log_action)
> +			xe_info(xe, "[RAS]: Page address 0x%llx removed from queue\n",
> +				page_address);
>  	}
>  
>  	return 0;
>  }
>  
> -static int handle_page_offline(struct xe_device *xe, u64 page_address, bool notify_fw)
> +static bool page_is_hard_offlined(struct xe_device *xe, u64 page_address)
> +{
> +	if (!IS_ALIGNED(page_address, XE_PAGE_SIZE))
> +		return false;
> +
> +	return !!xa_load(&xe->ras.state.offlined_pages, page_address >> XE_PTE_SHIFT);
> +}
> +
> +static int handle_page_offline(struct xe_device *xe, u64 page_address, bool notify_fw,
> +			       bool suppress_recurrent_report)
>  {
>  	struct xe_ras_state *state = &xe->ras.state;
>  	enum xe_ras_page_action action;
> +	bool recurrent_hard_offlined = false;
>  	u64 addr;
>  	int ret;
>  
> @@ -349,12 +363,14 @@ static int handle_page_offline(struct xe_device *xe, u64 page_address, bool noti
>  		xe_err(xe, "[RAS]: Page address 0x%llx belongs to critical BO\n", page_address);
>  		return ret;
>  	case -EEXIST:
> -		xe_dbg(xe, "[RAS]: Repeated error on already soft-offlined page address 0x%llx\n",
> -		       page_address);
> -		if (xa_load(&state->offlined_pages, page_address >> XE_PTE_SHIFT))
> +		if (xa_load(&state->offlined_pages, page_address >> XE_PTE_SHIFT)) {
> +			recurrent_hard_offlined = true;
>  			action = XE_RAS_PAGE_ACTION_REMOVE;
> -		else
> +		} else {
> +			xe_dbg(xe, "[RAS]: Repeated error on already soft-offlined page address 0x%llx\n",
> +			       page_address);
>  			action = XE_RAS_PAGE_ACTION_OFFLINE;
> +		}
>  		break;
>  	case -ENOMEM:
>  	default:
> @@ -365,7 +381,10 @@ static int handle_page_offline(struct xe_device *xe, u64 page_address, bool noti
>  
>   notify:
>  	if (notify_fw) {
> -		ret = send_page_offline_cmd(xe, page_address, action);
> +		bool log_action;
> +
> +		log_action = !(suppress_recurrent_report && recurrent_hard_offlined);
> +		ret = send_page_offline_cmd(xe, page_address, action, log_action);
>  		if (ret)
>  			return ret;
>  	}

[Severity: Medium]
Can page_is_hard_offlined() and handle_page_offline() disagree on whether a
page is a recurrent hard-offlined page?

At probe, get_offline_list() -> process_offline_pages() stores every page
returned by firmware in state->offlined_pages regardless of whether
handle_page_offline() actually soft-offlined it in TTM.  When
disable_vram_page_offline (logging-only mode) is enabled,
handle_page_offline() jumps to notify before calling
xe_ttm_vram_handle_addr_fault(), so those pages remain allocatable and
recurrent_hard_offlined stays false:

drivers/gpu/drm/xe/xe_ras.c:handle_page_offline() {
    ...
	if (xe_ras_get_disable_vram_page_offline(xe)) {
		action = XE_RAS_PAGE_ACTION_REMOVE;
		xe_dbg(xe, "[RAS]: User policy set to disable page offlining\n");
		goto notify;
	}
    ...
}

When a DB-ECC error later hits one of those pages (or a page whose TTM
soft-offlining failed at probe and now succeeds with ret == 0 instead of
-EEXIST), page_is_hard_offlined() sees the entry in state->offlined_pages
and suppresses the component log, DRM RAS event, and CPER record, while
handle_page_offline() leaves recurrent_hard_offlined as false and still
logs the queue removal.

[ ... ]

> @@ -668,11 +688,13 @@ static u8 handle_device_memory_errors(struct xe_device *xe, struct xe_ras_error_
>  			break;
>  		}
>  
> -		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);
> +		recurrent_hard_offlined = page_is_hard_offlined(xe, info->sw_address);
> +		ret = handle_page_offline(xe, info->sw_address, true, true);
> +		if (ret || !recurrent_hard_offlined)
> +			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);
>  		/*
>  		 * Wedge the device with a bus reset for errors that require SBR to recover.
>  		 * TODO: Trigger SBR using pci_reset_bus
> @@ -691,6 +713,20 @@ static u8 handle_device_memory_errors(struct xe_device *xe, struct xe_ras_error_
>  	return XE_RAS_RECOVERY_ACTION_RECOVERED;
>  }
>  
> +static bool suppress_recurrent_db_ecc_report(struct xe_device *xe,
> +					     struct xe_ras_error_array *arr)
> +{
> +	struct xe_ras_memory_error *info = (void *)arr->details;
> +
> +	if (arr->counter.common.component != XE_RAS_COMP_DEVICE_MEMORY)
> +		return false;
> +
> +	if (info->category != XE_RAS_MEMORY_DB_ECC)
> +		return false;
> +
> +	return page_is_hard_offlined(xe, info->sw_address);
> +}
> +
>  void xe_ras_counter_threshold_crossed(struct xe_device *xe,
>  				      struct xe_sysctrl_event_response *response)
>  {
> @@ -861,6 +897,7 @@ enum xe_ras_recovery_action xe_ras_process_errors(struct xe_device *xe)
>  		for (int i = 0; i < response.num_errors && i < XE_RAS_NUM_ERROR_ARR; i++) {
>  			struct xe_ras_error_array *arr = &response.arr[i];
>  			enum xe_ras_recovery_action action;
> +			bool suppress_report;
>  			u8 component, severity;
>  
>  			component = arr->counter.common.component;
> @@ -869,11 +906,14 @@ 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));
> +			suppress_report = suppress_recurrent_db_ecc_report(xe, arr);
> +
> +			if (!suppress_report)
> +				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))) {
> +			if (!suppress_report && !(sent & BIT(component))) {
>  				sent |= BIT(component);
>  				ras_send_error_event(xe, severity, component);
>  			}

[Severity: Medium]
Does xe_ras_process_errors() suppress the component detection log and
ras_send_error_event() even when handle_page_offline() subsequently fails?

suppress_recurrent_db_ecc_report() only checks page_is_hard_offlined()
before calling handle_device_memory_errors().  If handle_page_offline()
then returns an error (for example, if send_page_offline_cmd() fails or
the address in state->offlined_pages from get_offline_list() belongs to a
critical BO and returns -EIO), handle_device_memory_errors() emits the CPER
record and wedges the device for a bus reset, but the component detection
log and the userspace DRM RAS event notification have already been skipped.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201103604.2253707-2-mallesh.koujalagi@intel.com?part=1

  reply	other threads:[~2026-12-01 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 10:36 [PATCH v1] drm/xe/ras: Suppress recurrent DB-ECC reports for hard-offlined pages Mallesh Koujalagi
2026-12-01 10:47 ` sashiko-bot [this message]
2026-12-01 10:52 ` ✓ CI.KUnit: success for " Patchwork
2026-12-01 11:53 ` ✓ Xe.CI.BAT: " 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-243094@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox