Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v5 20/25] drm/xe: Add ULLS migration job support to migration layer
Date: Thu, 3 Sep 2026 21:11:32 -0700	[thread overview]
Message-ID: <appE9NDPO4ye1jO6@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260904024440.206631F000E9@smtp.kernel.org>

On Fri, Sep 04, 2026 at 02:44:39AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [High] ULLS_EXIT_JIFFIES evaluates to 0 on HZ=100 configurations, causing a tight spin loop.
> - [High] Deadlock caused by synchronous dma_fence_wait while holding reclaim-tainted job_mutex.
> - [Medium] Asynchronous runtime PM put used during device teardown path.
> --
> 
> commit 1b246ef0dc00023e2aba23868ed86c7ff7c9257a
> Author: Matthew Brost <matthew.brost@intel.com>
> 
> drm/xe: Add ULLS migration job support to migration layer
> 
> Add function to enter ULLS mode for migration job and delayed worker to
> exit (power saving). ULLS mode expected to entered upon page fault or
> SVM prefetch. ULLS mode exit delay is currently set to 5ms.
> 
> Link: https://patch.msgid.link/20260228013501.106680-21-matthew.brost@intel.com
> 
> > diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> > index 471ae5741836e..588e1c9085f31 100644
> > --- a/drivers/gpu/drm/xe/xe_migrate.c
> > +++ b/drivers/gpu/drm/xe/xe_migrate.c
> 
> [ ... ]
> 
> > @@ -77,6 +80,14 @@ struct xe_migrate {
> >  	struct dma_fence *fence;
> >  	/** @min_chunk_size: For dgfx, Minimum chunk size */
> >  	u64 min_chunk_size;
> > +	/** @ulls: ULLS support */
> > +	struct {
> > +		/** @ulls.enabled: ULLS is enabled */
> > +		bool enabled;
> > +#define ULLS_EXIT_JIFFIES	(HZ / 200)	/* 5ms */
> 
> [Severity: High]
> Does this calculation truncate to 0 when HZ=100?
> 
> If HZ < 200, ULLS_EXIT_JIFFIES evaluates to 0. When xe_migrate_ulls_exit
> executes while the queue is not idle, it reschedules itself with a delay
> of 0. This results in an immediate re-execution of the worker, creating a
> tight spin loop and causing a soft lockup with 100% CPU utilization until
> the queue becomes idle.
> 

Also right. Should be: ((5 * HZ) / MSEC_PER_SEC)

Matt

> > +		/** @ulls.exit_work: ULLS exit worker */
> > +		struct delayed_work exit_work;
> > +	} ulls;
> >  };
> >  
> >  #define MAX_PREEMPTDISABLE_TRANSFER SZ_8M /* Around 1ms. */
> > @@ -98,6 +109,16 @@ struct xe_migrate {
> >  static void xe_migrate_fini(void *arg)
> >  {
> >  	struct xe_migrate *m = arg;
> > +	struct xe_device *xe = tile_to_xe(m->tile);
> > +
> > +	disable_delayed_work_sync(&m->ulls.exit_work);
> > +	mutex_lock(&m->job_mutex);
> > +	if (m->ulls.enabled) {
> > +		xe_force_wake_put(gt_to_fw(m->q->hwe->gt), m->q->hwe->domain);
> > +		xe_pm_runtime_put(xe);
> 
> [Severity: Medium]
> Will this asynchronous put call in the teardown path be canceled by the
> subsequent PM disable?
> 
> xe_migrate_fini acts as the devm cleanup action. It calls xe_pm_runtime_put
> which queues an asynchronous suspend. However, during driver teardown,
> pm_runtime_disable will cancel this pending async work before it executes,
> leaving the hardware incorrectly in an active power state.
> 
> Should this be a synchronous pm_runtime_put_sync instead?
> 
> > +		m->ulls.enabled = false;
> > +	}
> > +	mutex_unlock(&m->job_mutex);
> >  
> >  	xe_vm_lock(m->q->vm, false);
> >  	xe_bo_unpin(m->pt_bo);
> 
> [ ... ]
> 
> > +static void xe_migrate_ulls_exit(struct work_struct *work)
> > +{
> > +	struct xe_migrate *m = container_of(work, struct xe_migrate,
> > +					    ulls.exit_work.work);
> 
> [ ... ]
> 
> > +	mutex_lock(&m->job_mutex);
> > +
> > +	if (!xe_exec_queue_is_idle(m->q, 1))
> > +		goto unlock_exit;
> > +
> > +	xe_sched_job_get(job);
> > +	xe_sched_job_arm(job);
> > +	job->is_ulls = true;
> > +	job->is_ulls_last = true;
> > +	fence = dma_fence_get(&job->drm.s_fence->finished);
> > +	xe_sched_job_push(job);
> > +
> > +	/* Serialize force wake put */
> > +	dma_fence_wait(fence, false);
> 
> [Severity: High]
> Does waiting on this dma-fence while holding the reclaim-tainted job_mutex
> create a deadlock?
> 
> m->job_mutex is explicitly annotated as being part of the memory reclaim path
> via fs_reclaim_acquire/release in xe_migrate_init. By synchronously
> waiting on a dma-fence with dma_fence_wait while holding this mutex, a
> circular dependency is created with the memory allocator.
> 
> If the system is under memory pressure and triggers reclaim while signaling
> the fence, or if a GPU reset (which must allocate memory) is needed to signal
> the fence, the reclaim path will attempt to acquire job_mutex and block
> forever.
> 
> > +	dma_fence_put(fence);
> > +
> > +	m->ulls.enabled = false;
> > +unlock_exit:
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260904022207.3490018-1-matthew.brost@intel.com?part=20

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

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  2:21 [PATCH v5 00/25] CPU binds and ULLS on migration queue Matthew Brost
2026-09-04  2:21 ` [PATCH v5 01/25] drm/xe: Drop struct xe_migrate_pt_update argument from populate/clear vfuns Matthew Brost
2026-09-04  2:21 ` [PATCH v5 02/25] drm/xe: Add xe_migrate_update_pgtables_cpu_execute helper Matthew Brost
2026-09-04  2:37   ` sashiko-bot
2026-09-04  2:21 ` [PATCH v5 03/25] drm/xe: Decouple exec queue idle check from LRC Matthew Brost
2026-09-04  2:21 ` [PATCH v5 04/25] drm/xe: Add job count to GuC exec queue snapshot Matthew Brost
2026-09-04  2:21 ` [PATCH v5 05/25] drm/xe: Update xe_bo_put_deferred arguments to include writeback flag Matthew Brost
2026-09-04  2:44   ` sashiko-bot
2026-09-04  2:21 ` [PATCH v5 06/25] drm/xe: Add XE_BO_FLAG_PUT_VM_ASYNC Matthew Brost
2026-09-04  2:21 ` [PATCH v5 07/25] drm/xe: Update scheduler job layer to support PT jobs Matthew Brost
2026-09-04  2:21 ` [PATCH v5 08/25] drm/xe: Add helpers to access PT ops Matthew Brost
2026-09-04  2:21 ` [PATCH v5 09/25] drm/xe: Add struct xe_pt_job_ops Matthew Brost
2026-09-04  2:48   ` sashiko-bot
2026-09-04  2:21 ` [PATCH v5 10/25] drm/xe: Update GuC submission backend to run PT jobs Matthew Brost
2026-09-04  2:46   ` sashiko-bot
2026-09-04  2:21 ` [PATCH v5 11/25] drm/xe: Store level in struct xe_vm_pgtable_update Matthew Brost
2026-09-04  2:21 ` [PATCH v5 12/25] drm/xe: Don't use migrate exec queue for page fault binds Matthew Brost
2026-09-04  2:21 ` [PATCH v5 13/25] drm/xe: Enable CPU binds for jobs Matthew Brost
2026-09-04  2:51   ` sashiko-bot
2026-09-04  2:21 ` [PATCH v5 14/25] drm/xe: Remove unused arguments from xe_migrate_pt_update_ops Matthew Brost
2026-09-04  2:21 ` [PATCH v5 15/25] drm/xe: Make bind queues operate cross-tile Matthew Brost
2026-09-04  2:21 ` [PATCH v5 16/25] drm/xe: Add CPU bind layer Matthew Brost
2026-09-04  2:21 ` [PATCH v5 17/25] drm/xe: Add device flag to enable PT mirroring across tiles Matthew Brost
2026-09-04  2:43   ` sashiko-bot
2026-09-04  4:10     ` Matthew Brost
2026-09-04  2:22 ` [PATCH v5 18/25] drm/xe: Add xe_hw_engine_write_ring_tail Matthew Brost
2026-09-04  2:22 ` [PATCH v5 19/25] drm/xe: Add ULLS support to LRC Matthew Brost
2026-09-04  2:22 ` [PATCH v5 20/25] drm/xe: Add ULLS migration job support to migration layer Matthew Brost
2026-09-04  2:44   ` sashiko-bot
2026-09-04  4:11     ` Matthew Brost [this message]
2026-09-04  2:22 ` [PATCH v5 21/25] drm/xe: Add ULLS migration job support to ring ops Matthew Brost
2026-09-04  2:22 ` [PATCH v5 22/25] drm/xe: Add ULLS migration job support to GuC submission Matthew Brost
2026-09-04  2:49   ` sashiko-bot
2026-09-04  4:17     ` Matthew Brost
2026-09-04  2:22 ` [PATCH v5 23/25] drm/xe: Enter ULLS for migration jobs upon page fault or SVM prefetch Matthew Brost
2026-09-04  2:22 ` [PATCH v5 24/25] drm/xe: Add modparam to enable / disable ULLS on migrate queue Matthew Brost
2026-09-04  2:22 ` [PATCH v5 25/25] drm/xe: Document ULLS for migration jobs Matthew Brost
2026-09-04  2:29 ` ✗ CI.checkpatch: warning for CPU binds and ULLS on migration queue (rev7) Patchwork
2026-09-04  2:31 ` ✓ CI.KUnit: success " Patchwork
2026-09-04  3:08 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-04 15:21 ` ✗ Xe.CI.FULL: 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=appE9NDPO4ye1jO6@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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