Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matthew Auld" <matthew.auld@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 5/6] drm/xe/userptr: Make the repin retry loop non-fatal
Date: Fri, 20 Nov 2026 14:03:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-225315@kernel.org> (raw)
In-Reply-To: <20261120-userptr-repin-v2-5-65e1f6e582ef@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/userptr: stale uvma->userptr.repin causes premature
  timeout after retry abort
--

commit 90fc6239c153f6d32105ac91a7723de6506c06a9
Author: Thomas Hellström <thomas.hellstrom@linux.intel.com>

drm/xe/userptr: Make the repin retry loop non-fatal

This commit converts -EBUSY from drm_gpusvm_get_pages() during userptr repin
into -EAGAIN until an overall repin timeout expires, discounting idle gaps
between retry attempts.

> diff --git a/drivers/gpu/drm/xe/xe_userptr.h b/drivers/gpu/drm/xe/xe_userptr.h
> index 2a3cd1b5efbb0..179f2aca26a39 100644
> --- a/drivers/gpu/drm/xe/xe_userptr.h
> +++ b/drivers/gpu/drm/xe/xe_userptr.h

[ ... ]

> +static inline void xe_userptr_repin_begin(struct xe_userptr_repin *repin)
> +{
> +	unsigned long now = jiffies;
> +
> +	if (!repin->start) {
> +		repin->start = now ?: 1;
> +		return;
> +	}
> +
> +	if (repin->last &&
> +	    time_after(now, repin->last +
> +		       msecs_to_jiffies(XE_USERPTR_REPIN_IDLE_MS)))
> +		repin->start = (repin->start + (now - repin->last)) ?: 1;
> +	repin->last = 0;
> +}

[Severity: Medium]
Can an aborted retry sequence leave stale timestamps in
uvma->userptr.repin and cause a later repin to time out early?

xe_vma_userptr_pin_pages() only zeroes uvma->userptr.repin when the repin
completes or its timeout expires.  If the caller's retry loop aborts after
receiving -EAGAIN, such as when xe_exec_ioctl() returns -ERESTARTSYS on a
pending signal or DRM_XE_VM_BIND_OP_PREFETCH hits its outer repin timeout
in xe_vm_bind_ioctl(), uvma->userptr.repin keeps its non-zero start and
last timestamps.

On a separate repin of that VMA after XE_USERPTR_REPIN_IDLE_MS,
xe_userptr_repin_begin() treats the elapsed time as an idle pause in the
earlier loop and advances repin->start only by (now - repin->last).  That
deducts the prior attempt's accrued duration (repin->last - repin->start)
from the new attempt's timeout budget, which can make the next repin fail
with -EBUSY after a single drm_gpusvm_get_pages() call and kill the VM in
the rebind worker.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-userptr-repin-v2-0-65e1f6e582ef@intel.com?part=5

  reply	other threads:[~2026-11-20 14:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 13:02 [PATCH v2 0/6] Non-fatal repin retries and NUMA-local rebind worker Matthew Auld
2026-11-20 13:02 ` [PATCH v2 1/6] drm/xe/vm: restore userptr invalidations on VMA op unwind Matthew Auld
2026-11-20 13:02 ` [PATCH v2 2/6] drm/xe/vf: Free preempt fences on rebind worker retry Matthew Auld
2026-11-20 13:02 ` [PATCH v2 3/6] drm/xe: Requeue the rebind worker instead of retrying in-line on -EAGAIN Matthew Auld
2026-11-20 13:02 ` [PATCH v2 4/6] drm/xe: Add a userptr repin timeout sysfs attribute Matthew Auld
2026-11-20 13:02 ` [PATCH v2 5/6] drm/xe/userptr: Make the repin retry loop non-fatal Matthew Auld
2026-11-20 14:03   ` sashiko-bot [this message]
2026-11-20 13:02 ` [PATCH v2 6/6] drm/xe: run compute rebind worker on device NUMA node Matthew Auld
2026-11-20 13:12 ` ✓ CI.KUnit: success for Non-fatal repin retries and NUMA-local rebind worker (rev2) Patchwork
2026-11-20 13:47 ` ✓ 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=sashiko-outbox-225315@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@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