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 v3 1/5] drm/xe/gt: Use GT ordered workqueue for wedging
Date: Mon, 07 Sep 2026 08:50:26 +0000	[thread overview]
Message-ID: <20260907085027.5D5281F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907083541.2194747-2-raag.jadav@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Lockless TOCTOU race on work_struct initialization can lead to queueing an uninitialized work item.
--

commit 70fa657e4e9d6562a705a7808a6bc4a42f57256e
Author: Raag Jadav <raag.jadav@intel.com>
Subject: drm/xe/gt: Use GT ordered workqueue for wedging

This commit introduces a GT ordered workqueue for GT wedge handling to
avoid disrupting the scheduler with in-flight jobs. It adds a wedge worker
initialized during GT init and queued when a wedge is declared.

> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> index 478e047031f4f..200e34331c195 100644
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c

[ ... ]

> @@ -1195,6 +1207,7 @@ void xe_gt_declare_wedged(struct xe_gt *gt)
>  {
>  	xe_gt_assert(gt, gt_to_xe(gt)->wedged.mode);
>  
> -	xe_uc_declare_wedged(&gt->uc);
> -	xe_tlb_inval_reset(&gt->tlb_inval);
> +	/* Prevent queueing uninitialized worker if hit during probe */
> +	if (gt->wedge.worker.func)
> +		queue_work(gt->ordered_wq, &gt->wedge.worker);

[Severity: High]
Could this lockless check of the work_struct func field lead to list
corruption on weakly ordered architectures?

During driver probe, an asynchronous hardware fault (such as a PCI AER or
an I2C interrupt) could trigger xe_gt_declare_wedged() concurrently with
xe_gt_init().

In xe_gt_init(), the worker is initialized via:

INIT_WORK(&gt->wedge.worker, gt_wedge_worker);

This macro sets the work_struct's data, entry, and finally func, but does so
without memory barriers. If an interrupting CPU observes the writes out of
order due to CPU store reordering, func could be seen as non-NULL while data
or entry remain uninitialized.

If that happens, xe_gt_declare_wedged() would pass this check and call
queue_work() with a partially initialized work_struct. This can cause a
kernel panic in the workqueue core. Is there a safer way to synchronize
this probe-time wedge check without relying on lockless field inspection?

>  }

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

  reply	other threads:[~2026-09-07  8:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  8:34 [PATCH v3 0/5] Introduce xe_wedge Raag Jadav
2026-09-07  8:34 ` [PATCH v3 1/5] drm/xe/gt: Use GT ordered workqueue for wedging Raag Jadav
2026-09-07  8:50   ` sashiko-bot [this message]
2026-09-07 12:02   ` Michal Wajdeczko
2026-09-07 13:06     ` Raag Jadav
2026-09-07  8:34 ` [PATCH v3 2/5] drm/xe: Move xe_device_wedged_fini() registration to xe_device_probe_early() Raag Jadav
2026-09-07  8:54   ` sashiko-bot
2026-09-07  8:34 ` [PATCH v3 3/5] drm/xe: Make xe_device_declare_wedged() IRQ safe Raag Jadav
2026-09-07  8:34 ` [PATCH v3 4/5] drm/xe: Introduce xe_wedge Raag Jadav
2026-09-07  8:34 ` [PATCH v3 5/5] drm/xe/ras: Move xe_ras_process_errors() to xe_ras Raag Jadav
2026-09-07  8:55   ` sashiko-bot
2026-09-07  9:35 ` ✗ CI.checkpatch: warning for Introduce xe_wedge (rev2) Patchwork
2026-09-07  9:37 ` ✓ CI.KUnit: success " Patchwork
2026-09-07 10:26 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-07 11:39 ` ✓ 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=20260907085027.5D5281F00A3A@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