Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sk Anirban" <sk.anirban@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/xe/survivability: Fix infinite loop in aux info traversal
Date: Thu, 19 Nov 2026 11:04:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-223004@kernel.org> (raw)
In-Reply-To: <20261119104300.3401464-2-sk.anirban@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/xe/survivability: duplicate MMIO read in
  populate_survivability_info()
--

commit e6c70594563ece060377037415229cf64bafe989
Author: Sk Anirban <sk.anirban@intel.com>

drm/xe/survivability: Fix infinite loop in aux info traversal

This commit replaces the linked-list traversal of AUX info scratch
registers in populate_survivability_info() with a linear loop from
AUX_INFO0 to MAX_SCRATCH_REG to avoid infinite loops when a register
points to itself.

> diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
> index d73cdad0b3a9c..b3b6c89bed6f4 100644
> --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
> +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
> @@ -166,12 +166,12 @@ static void populate_survivability_info(struct xe_device *xe)
>  			set_survivability_info(mmio, info, POSTCODE_TRACE_OVERFLOW);
>  	}
>  
> -	/* Traverse the linked list of aux info registers */
> +	/* Read all aux info registers and store the non-zero ones */
>  	if (reg_value & AUXINFO_SUPPORT) {
> -		for (id = REG_FIELD_GET(AUXINFO_REG_OFFSET, reg_value);
> -		     id >= AUX_INFO0 && id < MAX_SCRATCH_REG;
> -		     id =  REG_FIELD_GET(AUXINFO_HISTORY_OFFSET, info[id]))
> -			set_survivability_info(mmio, info, id);
> +		for (id = AUX_INFO0; id < MAX_SCRATCH_REG; id++) {
> +			if (xe_mmio_read32(mmio, PCODE_SCRATCH(id)))
> +				set_survivability_info(mmio, info, id);
> +		}
>  	}
>  }

[Severity: Low]
Does this read every non-zero PCODE_SCRATCH(id) register twice over MMIO?
set_survivability_info() is just:

drivers/gpu/drm/xe/xe_survivability_mode.c:set_survivability_info() {
	info[id] = xe_mmio_read32(mmio, PCODE_SCRATCH(id));
}

Calling set_survivability_info(mmio, info, id) directly in the loop would
read each register once.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119104300.3401464-2-sk.anirban@intel.com?part=1

  reply	other threads:[~2026-11-19 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 10:43 [PATCH v2] drm/xe/survivability: Fix infinite loop in aux info traversal Sk Anirban
2026-11-19 11:04 ` sashiko-bot [this message]
2026-11-19 12:36 ` ✓ CI.KUnit: success for drm/xe/survivability: Fix infinite loop in aux info traversal (rev2) Patchwork
2026-11-19 13:13 ` ✓ 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-223004@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sk.anirban@intel.com \
    /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