All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tomasz Lis" <tomasz.lis@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm/xe/vf: Late fixups of LRCs after VF migration
Date: Fri, 06 Nov 2026 16:26:26 +0000	[thread overview]
Message-ID: <sashiko-outbox-201804@kernel.org> (raw)
In-Reply-To: <20261106155615.977330-2-tomasz.lis@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/vf: premature mutex_destroy() of scratch_lock in
  vf_migration_fini()
--

commit 3d0fd68d1f87ea2f30e131438f2016a4f50af378
Author: Tomasz Lis <tomasz.lis@intel.com>

drm/xe/vf: Late fixups of LRCs after VF migration

This commit moves VF LRC HWSP rebasing from the post-migration recovery
worker to exec queue registration and unpause preparation, protecting the
shared migration scratch buffer with a mutex.

> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> index 2a5f2064ad3e8..f8c03b741b084 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
[ ... ]
> @@ -1488,6 +1484,7 @@ static void vf_migration_fini(void *arg)
>  	spin_unlock_irq(&gt->sriov.vf.migration.lock);
>  
>  	cancel_work_sync(&gt->sriov.vf.migration.worker);
> +	mutex_destroy(&gt->sriov.vf.migration.scratch_lock);
>  }
>  
>  /**
> @@ -1509,6 +1506,7 @@ int xe_gt_sriov_vf_init_early(struct xe_gt *gt)
>  	if (!buf)
>  		return -ENOMEM;
>  
> +	mutex_init(&gt->sriov.vf.migration.scratch_lock);
>  	gt->sriov.vf.migration.scratch = buf;

[Severity: Medium]
Can vf_migration_fini() destroy scratch_lock while GuC DRM scheduler
workers are still registering exec queues?

xe_gt_sriov_vf_init() registers vf_migration_fini() with devm at the end
of xe_gt_init(), after xe_guc_submit_init() registers guc_submit_fini().
During device unbind or unload, devres runs vf_migration_fini() before
guc_submit_fini() stops the GuC schedulers:

CPU0                              CPU1 (DRM sched worker)
vf_migration_fini()
  cancel_work_sync(&...worker)
  mutex_destroy(&...scratch_lock)
                                  guc_exec_queue_run_job()
                                    register_exec_queue()
                                      xe_exec_queue_lrcs_hwsp_rebase()
                                        mutex_lock(&...scratch_lock)
                                          <-- locks destroyed mutex
guc_submit_fini()

Also, if probe fails between xe_gt_sriov_vf_init_early() and
xe_gt_sriov_vf_init(), vf_migration_fini() is never registered and
scratch_lock is not destroyed.  Initializing scratch_lock with
drmm_mutex_init() in xe_gt_sriov_vf_init_early() would match the drmm
lifetime of migration.scratch and guc->submission_state.lock.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106155615.977330-1-tomasz.lis@intel.com?part=1

  reply	other threads:[~2026-11-06 16:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 15:56 [PATCH v2 0/2] drm/xe/vf: New approach for post-migration LRC fixups Tomasz Lis
2026-11-06 15:56 ` [PATCH v2 1/2] drm/xe/vf: Late fixups of LRCs after VF migration Tomasz Lis
2026-11-06 16:26   ` sashiko-bot [this message]
2026-11-06 15:56 ` [PATCH v2 2/2] drm/xe: After VF migration, repeat BO mapping in progress Tomasz Lis
2026-11-06 16:46   ` sashiko-bot
2026-11-06 16:53 ` ✓ CI.KUnit: success for drm/xe/vf: New approach for post-migration LRC fixups (rev2) Patchwork
2026-11-06 17:34 ` ✗ Xe.CI.BAT: 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=sashiko-outbox-201804@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tomasz.lis@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.