Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/survivability: Fix infinite loop in aux info traversal
@ 2026-11-18 18:50 Sk Anirban
  2026-11-18 19:16 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Sk Anirban @ 2026-11-18 18:50 UTC (permalink / raw)
  To: intel-xe
  Cc: anshuman.gupta, badal.nilawar, riana.tauro, karthik.poosa,
	raag.jadav, soham.purkait, mallesh.koujalagi, Sk Anirban

Stop traversing the aux info linked list when an entry references
itself, preventing an endless loop and soft lockup during probe.

Signed-off-by: Sk Anirban <sk.anirban@intel.com>
---
 drivers/gpu/drm/xe/xe_survivability_mode.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
index 91a0680e449b..34d39e68ff36 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode.c
+++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
@@ -172,8 +172,14 @@ static void populate_survivability_info(struct xe_device *xe)
 	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]))
+		     id =  REG_FIELD_GET(AUXINFO_HISTORY_OFFSET, info[id])) {
 			set_survivability_info(mmio, info, id);
+			if (REG_FIELD_GET(AUXINFO_HISTORY_OFFSET, info[id]) == id) {
+				xe_warn(xe, "survivability: %s points to itself, stopping aux info walk\n",
+					reg_map[id]);
+				break;
+			}
+		}
 	}
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/xe/survivability: Fix infinite loop in aux info traversal
  2026-11-18 18:50 [PATCH] drm/xe/survivability: Fix infinite loop in aux info traversal Sk Anirban
@ 2026-11-18 19:16 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-18 19:16 UTC (permalink / raw)
  To: Sk Anirban, intel-xe

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/xe: incomplete aux info cycle check in
  populate_survivability_info()
- [Low] drm/xe: missing Fixes trailer for populate_survivability_info()
  loop fix
--

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

> drm/xe/survivability: Fix infinite loop in aux info traversal
>
> Stop traversing the aux info linked list when an entry references
> itself, preventing an endless loop and soft lockup during probe.
>
> Signed-off-by: Sk Anirban <sk.anirban@intel.com>

[Severity: Low]
Should this include a Fixes: tag for f4e9fc967afd ("drm/xe/xe_survivability:
Redesign survivability mode") or 5e940312a2ac ("drm/xe: Add functions and
sysfs for boot survivability")?

> diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
> index d73cdad0b3a9c..1e868c52eb730 100644
> --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
> +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
> @@ -170,8 +170,14 @@ static void populate_survivability_info(struct xe_device *xe)
>  	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]))
> +		     id =  REG_FIELD_GET(AUXINFO_HISTORY_OFFSET, info[id])) {
>  			set_survivability_info(mmio, info, id);
> +			if (REG_FIELD_GET(AUXINFO_HISTORY_OFFSET, info[id]) == id) {
> +				xe_warn(xe, "survivability: %s points to itself, stopping aux info walk\n",
> +					reg_map[id]);
> +				break;
> +			}
> +		}
>  	}
>  }

[Severity: Medium]
Can populate_survivability_info() still spin forever if the AUX_INFO0..4
registers form a cycle of two or more nodes (for example, AUX_INFO0 pointing
to AUX_INFO1 and AUX_INFO1 pointing back to AUX_INFO0)?  Tracking visited
registers in a bitmask or bounding the walk to MAX_SCRATCH_REG - AUX_INFO0
steps would stop multi-node cycles as well.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 18:50 [PATCH] drm/xe/survivability: Fix infinite loop in aux info traversal Sk Anirban
2026-11-18 19:16 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox