From: Matthew Brost <matthew.brost@intel.com>
To: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/2] drm/xe: Hold a fence reference while waiting for migration
Date: Tue, 24 Nov 2026 13:55:11 -0800 [thread overview]
Message-ID: <awYHv1B7eQwexn8L@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20261120070822.3834209-2-krishnaiah.bommu@intel.com>
On Fri, Nov 20, 2026 at 12:38:21PM +0530, Bommu Krishnaiah wrote:
> xe_migrate_wait() reads m->fence without job_mutex, while migration
> submissions replace the pointer and drop the previous reference under
> that mutex. A concurrent replacement could leave the waiter accessing
> a fence whose reference has been released.
>
> Take a fence reference under job_mutex, then wait and release
> the reference outside the lock. This protects the snapshot without holding
> the submission mutex throughout the wait. Callers must still quiesce
> submissions when they require the migration context to be idle.
>
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
>
> Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
> ---
> drivers/gpu/drm/xe/xe_migrate.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index d7a8d8ecffe6..57a81eda2088 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -2150,8 +2150,16 @@ struct migrate_test_params {
> */
> void xe_migrate_wait(struct xe_migrate *m)
> {
> - if (m->fence)
> - dma_fence_wait(m->fence, false);
> + struct dma_fence *fence;
> +
> + mutex_lock(&m->job_mutex);
> + fence = dma_fence_get(m->fence);
> + mutex_unlock(&m->job_mutex);
> +
> + if (fence) {
> + dma_fence_wait(fence, false);
> + dma_fence_put(fence);
> + }
> }
>
> static u32 pte_update_cmd_size(u64 size)
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-11-24 22:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 7:08 [PATCH 0/2] drm/xe: Hold a fence reference while waiting for migration Bommu Krishnaiah
2026-11-20 7:08 ` [PATCH 1/2] " Bommu Krishnaiah
2026-11-24 21:55 ` Matthew Brost [this message]
2026-11-20 7:08 ` [PATCH 2/2] drm/xe: Centralize migration fence updates Bommu Krishnaiah
2026-11-24 21:56 ` Matthew Brost
2026-11-20 8:10 ` ✓ CI.KUnit: success for drm/xe: Hold a fence reference while waiting for migration (rev2) Patchwork
2026-11-20 9:01 ` ✓ 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=awYHv1B7eQwexn8L@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=krishnaiah.bommu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.