From: sashiko-bot@kernel.org
To: "Tomasz Lis" <tomasz.lis@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 2/2] drm/xe: After VF migration, repeat BO mapping in progress
Date: Thu, 19 Nov 2026 12:51:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-223118@kernel.org> (raw)
In-Reply-To: <20261119123514.1658712-3-tomasz.lis@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/xe: dead -ERESTARTSYS check and busy-spin in
__xe_ggtt_insert_bo_at()
--
commit b16142a275191b42c8c4d7d66be1c8cd542936f0
Author: Tomasz Lis <tomasz.lis@intel.com>
drm/xe: After VF migration, repeat BO mapping in progress
This commit moves the VF post-migration retry loop from LRC creation in
__xe_exec_queue_init() to GGTT BO insertion in __xe_ggtt_insert_bo_at() so
that all GGTT BO mappings rewrite their PTEs if a VF migration occurs while
mapping is in progress.
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 44480fad27679..ec770f2968a95 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
[ ... ]
> @@ -1080,6 +1086,38 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
> }
> mutex_unlock(&ggtt->lock);
>
> + if (!err) {
> + /*
> + * If VF migration happens during BO mapping, some PTE value writes may
> + * be ignored by HW. This can happen in case GGTT range changed; already
> + * set PTEs are moved by the VF restore, but xe_ggtt_map_bo() within VM
> + * may still loop at old position. To be sure, redo all PTE writes.
> + * Make this a loop as another VF migration could start immediately.
> + */
> + while (marker != xe_vf_migration_fixups_complete_count(ggtt->tile->primary_gt)) {
> + u16 cache_mode = bo->flags & XE_BO_FLAG_NEEDS_UC ?
> + XE_CACHE_NONE : XE_CACHE_WB;
> + u16 pat_index = xe_cache_pat_idx(tile_to_xe(ggtt->tile), cache_mode);
> + u64 pte = ggtt->pt_ops->pte_encode_flags(bo, pat_index);
> +
> + marker = xe_gt_sriov_vf_wait_valid_ggtt(ggtt->tile->primary_gt);
> + /*
> + * Only abort fixing the PTEs if we're signalled or wedged; in
> + * case of timeout the migration recovery may be just repeated
> + * or prolonged, so do not treat that as bailout condition.
> + * If the VF migration was detected, we can be sure that recovery
> + * will start or already has started. The recovery worker assures
> + * on finish that this loop will exit.
> + */
> + if (marker == -ERESTARTSYS || xe_wedged(tile_to_xe(ggtt->tile)))
> + break;
> +
> + mutex_lock(&ggtt->lock);
> + xe_ggtt_map_bo(ggtt, bo->ggtt_node[tile_id], bo, pte);
> + mutex_unlock(&ggtt->lock);
> + }
> + }
[Severity: High]
Can marker == -ERESTARTSYS ever be true here, or will a pending signal during
VF migration cause this loop to busy-spin?
xe_gt_sriov_vf_wait_valid_ggtt() discards the return value from
wait_event_interruptible_timeout() and always returns the non-negative
fixups_complete_count:
drivers/gpu/drm/xe/xe_gt_sriov_vf.c:xe_gt_sriov_vf_wait_valid_ggtt() {
...
ret = wait_event_interruptible_timeout(gt->sriov.vf.migration.wq,
vf_valid_ggtt(gt),
HZ * 5);
xe_gt_WARN_ON(gt, !ret);
return atomic_read(>->sriov.vf.migration.fixups_complete_count);
}
Meanwhile, xe_vf_migration_fixups_complete_count() returns -1 while
!vf_valid_ggtt(gt). If a thread has a pending signal during VF migration
recovery, wait_event_interruptible_timeout() returns -ERESTARTSYS immediately
without sleeping, marker receives the non-negative fixups_complete_count, and
the loop spins without sleeping while repeatedly acquiring ggtt->lock and
rewriting all BO PTEs over MMIO. On a single-vCPU guest VM without
involuntary preemption, this can starve the migration recovery worker and
cause a soft lockup.
Also, when the loop breaks out (on xe_wedged(), or if -ERESTARTSYS were
propagated), err is still 0 and bo->ggtt_node[tile_id] remains inserted, so
__xe_ggtt_insert_bo_at() returns success with stale or unfixed GGTT PTEs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119123514.1658712-1-tomasz.lis@intel.com?part=2
prev parent reply other threads:[~2026-11-19 12:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 12:35 [PATCH v4 0/2] drm/xe/vf: New approach for post-migration LRC fixups Tomasz Lis
2026-11-19 12:35 ` [PATCH v4 1/2] drm/xe/vf: Late fixups of LRCs after VF migration Tomasz Lis
2026-11-19 12:35 ` [PATCH v4 2/2] drm/xe: After VF migration, repeat BO mapping in progress Tomasz Lis
2026-11-19 12:51 ` sashiko-bot [this message]
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-223118@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.