All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matthew Brost" <matthew.brost@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 2/5] drm/xe: Bump the LRU on a successful page fault
Date: Tue, 27 Oct 2026 18:49:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-187040@kernel.org> (raw)
In-Reply-To: <20261027183638.1031299-3-matthew.brost@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/xe: xe_vm_bump_lru() in xe_pagefault_handle_vma() misses private BOs
--

commit a6d00986d9f12583f84415e17fe0f940a218b2e7
Author: Matthew Brost <matthew.brost@intel.com>

drm/xe: Bump the LRU on a successful page fault

This commit calls xe_vm_bump_lru() in xe_pagefault_handle_vma() after a
successful VMA rebind so that faulted BOs are moved to the tail of the TTM
LRU.

> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> index 5247321c805ec..3719258aa6f09 100644
> --- a/drivers/gpu/drm/xe/xe_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> @@ -221,6 +221,8 @@ static int xe_pagefault_handle_vma(struct xe_gt *gt, struct xe_vma *vma,
>  				xe_pagefault_set_error(pf, XE_PAGEFAULT_ERROR_VMA_REBIND);
>  				break;
>  			}
> +
> +			xe_vm_bump_lru(vm, &exec);

[Severity: Medium]
Does xe_vm_bump_lru() actually move VM-private BOs to the LRU tail when
handling a page fault?

When a VM-private BO is created for a fault-mode VM in
__xe_bo_create_locked(), it is not added to vm->lru_bulk_move:

drivers/gpu/drm/xe/xe_bo.c:__xe_bo_create_locked() {
	...
	bo = xe_bo_init_locked(xe, bo, tile, vm ? xe_vm_resv(vm) : NULL,
			       vm && !xe_vm_in_fault_mode(vm) &&
			       flags & XE_BO_FLAG_USER ?
			       &vm->lru_bulk_move : NULL, size,
			       cpu_caching, type, flags, NULL, exec);
	...
}

Because page faults only occur on fault-mode VMs, vm->lru_bulk_move is empty
and ttm_lru_bulk_move_tail(&vm->lru_bulk_move) in xe_vm_bump_lru() is a
no-op.

Furthermore, during xe_pagefault_begin() -> xe_vm_lock_vma(), only external
BOs (!bo->vm) are locked individually in exec, whereas VM-private BOs share
the VM's reservation object and only lock xe_vm_obj(vm):

drivers/gpu/drm/xe/xe_vm.c:xe_vm_lock_vma() {
	...
	err = drm_exec_lock_obj(exec, xe_vm_obj(vm));
	if (!err && bo && !bo->vm)
		err = drm_exec_lock_obj(exec, &bo->ttm.base);
	...
}

When xe_vm_bump_lru() then iterates over the locked objects in exec, it skips
xe_vm_obj(vm):

drivers/gpu/drm/xe/xe_vm.c:xe_vm_bump_lru() {
	...
	drm_exec_for_each_locked_object(exec, obj) {
		struct xe_bo *bo;

		/* The VM's dummy resv object, not a BO. */
		if (obj == xe_vm_obj(vm))
			continue;
	...
}

If a faulted VM-private BO's backing store is already in a compatible
placement so that ttm_bo_validate() returns early without moving the resource,
will the BO's TTM LRU position remain completely unchanged here?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261027183638.1031299-1-matthew.brost@intel.com?part=2

  reply	other threads:[~2026-10-27 18:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 18:36 [PATCH v4 0/5] Add a minimum age gate to the shrinker + LRU fixes Matthew Brost
2026-10-27 18:36 ` [PATCH v4 1/5] drm/xe: Bump the LRU of every BO an exec touches Matthew Brost
2026-10-27 18:59   ` sashiko-bot
2026-10-27 19:58     ` Matthew Brost
2026-10-27 18:36 ` [PATCH v4 2/5] drm/xe: Bump the LRU on a successful page fault Matthew Brost
2026-10-27 18:49   ` sashiko-bot [this message]
2026-10-27 18:36 ` [PATCH v4 3/5] drm/xe: Leave the VM bulk move on BO release, not on GEM close Matthew Brost
2026-10-27 18:47   ` sashiko-bot
2026-10-27 19:01     ` Matthew Brost
2026-10-27 19:40       ` Matthew Brost
2026-10-27 18:36 ` [PATCH v4 4/5] drm/ttm: Allow skipping to the next priority in the bo LRU cursor Matthew Brost
2026-10-27 18:36 ` [PATCH v4 5/5] drm/xe: Add a minimum age gate to the shrinker Matthew Brost
2026-10-27 19:00   ` sashiko-bot
2026-10-27 18:47 ` ✗ CI.checkpatch: warning for Add a minimum age gate to the shrinker + LRU fixes Patchwork
2026-10-27 18:49 ` ✓ CI.KUnit: success " Patchwork
2026-10-27 19:23 ` ✗ 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-187040@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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 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.