Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Raag Jadav" <raag.jadav@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 2/5] drm/xe: Make xe_device_declare_wedged() IRQ safe
Date: Mon, 31 Aug 2026 04:40:55 +0000	[thread overview]
Message-ID: <20260831044056.5620E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831042633.1760474-3-raag.jadav@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Uninitialized work_struct leads to list corruption and kernel panic if an IRQ triggers during device probe.
--

commit 7cfc61b6d67f6291a4e51db20047caa91bfb3397
Author: Raag Jadav <raag.jadav@intel.com>

drm/xe: Make xe_device_declare_wedged() IRQ safe

This commit defers wedge handling into a dedicated worker so that
xe_device_declare_wedged() can be called in IRQ context. This is required
for declaring the device as wedged on catastrophic errors received via IRQs.

> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 396d02eb2af83..150629ee4ad13 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
[ ... ]
> @@ -1148,7 +1159,7 @@ int xe_device_probe(struct xe_device *xe)
>  
>  	detect_preproduction_hw(xe);
>  
> -	err = drmm_add_action_or_reset(&xe->drm, xe_device_wedged_fini, xe);
> +	err = xe_device_wedged_init(xe);

[Severity: High]
Does this initialize the work_struct too late in the probe sequence?

If a hardware error interrupt (like a MERT CAT error) fires during the window
after interrupts are enabled (via xe_irq_install() called earlier in
xe_device_probe()) but before this initialization completes, the interrupt
handler will call xe_device_declare_wedged().

This would attempt to schedule the uninitialized xe->wedged.work structure,
potentially leading to list corruption and a kernel panic in the workqueue
core.

>  	if (err)
>  		goto err_unregister_display;
[ ... ]
> @@ -1483,26 +1514,11 @@ void xe_device_declare_wedged(struct xe_device *xe)
>  			    "For recovery procedure, refer to %s\n"
>  			    "Please file a _new_ bug report at %s\n",
>  			    WEDGED_URL, XE_BUG_URL);
>  
> -		for_each_gt(gt, xe, id)
> -			xe_gt_declare_wedged(gt);
>  
> -	if (xe_device_wedged(xe)) {
> -		/*
> -		 * XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET is intended for debugging
> -		 * hangs, so wedge the device with 'none' recovery method and have
> -		 * it available to the user for debugging.
> -		 */
> -		if (xe->wedged.mode == XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET)
> -			xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_NONE);
> -		/* If no wedge recovery method is set, use default */
> -		else if (!xe->wedged.method)
> -			xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_REBIND |
> -						    DRM_WEDGE_RECOVERY_BUS_RESET);
> -
> -		/* Notify userspace of wedged device */
> -		drm_dev_wedged_event(&xe->drm, xe->wedged.method, NULL);
> +		schedule_work(&xe->wedged.work);

[Severity: High]
Could this schedule an uninitialized work_struct?

If xe_device_declare_wedged() is invoked from an early interrupt handler
before xe_device_wedged_init() completes, this will attempt to queue
xe->wedged.work. 

Additionally, the loop right before this calls xe_gt_declare_wedged(gt),
which could queue an uninitialized gt->wedge.worker if xe_gt_init() hasn't
completed for that GT yet.

>  	}
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831042633.1760474-1-raag.jadav@intel.com?part=2

  reply	other threads:[~2026-08-31  4:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  4:25 [PATCH v2 0/5] Introduce xe_wedge Raag Jadav
2026-08-31  4:25 ` [PATCH v2 1/5] drm/xe/gt: Use GT ordered workqueue for wedging Raag Jadav
2026-08-31  4:25 ` [PATCH v2 2/5] drm/xe: Make xe_device_declare_wedged() IRQ safe Raag Jadav
2026-08-31  4:40   ` sashiko-bot [this message]
2026-08-31  4:25 ` [PATCH v2 3/5] drm/xe: Introduce xe_wedge Raag Jadav
2026-09-02 17:56   ` Rodrigo Vivi
2026-08-31  4:25 ` [PATCH v2 4/5] drm/xe/debugfs: Consolidate wedged_mode debt into xe_wedge Raag Jadav
2026-08-31  4:25 ` [PATCH v2 5/5] drm/xe/wedge: Update naming to match with xe_wedge Raag Jadav
2026-08-31  4:35   ` sashiko-bot
2026-08-31  4:33 ` ✗ CI.checkpatch: warning for Introduce xe_wedge Patchwork
2026-08-31  4:34 ` ✗ CI.KUnit: failure " 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=20260831044056.5620E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=raag.jadav@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