From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Oak Zeng <oak.zeng@intel.com>, intel-xe@lists.freedesktop.org
Cc: rodrigo.vivi@intel.com
Subject: Re: [PATCH] drm/xe: Reject BO eviction if BO is bound to current VM
Date: Fri, 10 Jan 2025 15:45:00 +0100 [thread overview]
Message-ID: <a67290be139bcf7f58964850e93b7b5141aabd13.camel@linux.intel.com> (raw)
In-Reply-To: <20241217231358.2361242-1-oak.zeng@intel.com>
Hi, Oak.
On Tue, 2024-12-17 at 18:13 -0500, Oak Zeng wrote:
> This is a follow up fix for
> https://patchwork.freedesktop.org/patch/msgid/20241203021929.1919730-1-oak.zeng@intel.com
> The overall goal is to fail vm_bind when there is memory pressure.
> See more
> details in the commit message of above patch. Abbove patch fixes the
> issue
> when user pass in a vm_id parameter during gem_create. If user
> doesn't pass
> in a vm_id during gem_create, above patch doesn't help.
>
> This patch further reject BO eviction (which could be triggered by bo
> validation)
> if BO is bound to the current VM. vm_bind could fail due to the
> eviction failure.
> The BO to VM reverse mapping structure is used to determine whether
> BO is bound
> to VM.
>
> Suggested-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Signed-off-by: Oak Zeng <oak.zeng@intel.com>
> ---
> drivers/gpu/drm/xe/xe_bo.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 283cd02945708..abdeed1c325ea 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -664,6 +664,7 @@ static int xe_bo_move(struct ttm_buffer_object
> *ttm_bo, bool evict,
> u32 old_mem_type = old_mem ? old_mem->mem_type :
> XE_PL_SYSTEM;
> struct ttm_tt *ttm = ttm_bo->ttm;
> struct xe_migrate *migrate = NULL;
> + struct drm_gpuvm_bo *vm_bo;
Move this declaration inside if (evict) {
> struct dma_fence *fence;
> bool move_lacks_source;
> bool tt_has_data;
> @@ -713,6 +714,18 @@ static int xe_bo_move(struct ttm_buffer_object
> *ttm_bo, bool evict,
> goto out;
> }
>
Short comment here?
> + if (evict) {
Perhaps if (evict && ctx->resv)
> + drm_gem_for_each_gpuvm_bo(vm_bo, &bo->ttm.base) {
> + struct xe_vm *vm = gpuvm_to_vm(vm_bo->vm);
> +
> + if (xe_vm_resv(vm) == ctx->resv &&
> + xe_vm_in_preempt_fence_mode(vm)) {
> + ret = -EBUSY;
> + goto out;
> + }
> + }
> + }
> +
Otherwise LGTM.
> /*
> * Failed multi-hop where the old_mem is still marked as
> * TTM_PL_FLAG_TEMPORARY, should just be a dummy move.
next prev parent reply other threads:[~2025-01-10 14:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 23:13 [PATCH] drm/xe: Reject BO eviction if BO is bound to current VM Oak Zeng
2024-12-18 1:06 ` ✓ CI.Patch_applied: success for " Patchwork
2024-12-18 1:06 ` ✗ CI.checkpatch: warning " Patchwork
2024-12-18 1:08 ` ✓ CI.KUnit: success " Patchwork
2024-12-18 1:26 ` ✓ CI.Build: " Patchwork
2024-12-18 1:28 ` ✓ CI.Hooks: " Patchwork
2024-12-18 1:29 ` ✓ CI.checksparse: " Patchwork
2024-12-18 1:59 ` ✗ Xe.CI.BAT: failure " Patchwork
2024-12-18 11:47 ` ✗ Xe.CI.Full: " Patchwork
2025-01-09 19:29 ` ✓ CI.Patch_applied: success for drm/xe: Reject BO eviction if BO is bound to current VM (rev2) Patchwork
2025-01-09 19:29 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-09 19:30 ` ✓ CI.KUnit: success " Patchwork
2025-01-09 19:48 ` ✓ CI.Build: " Patchwork
2025-01-09 19:51 ` ✓ CI.Hooks: " Patchwork
2025-01-09 19:52 ` ✓ CI.checksparse: " Patchwork
2025-01-10 14:45 ` Thomas Hellström [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-10 21:01 [PATCH] drm/xe: Reject BO eviction if BO is bound to current VM Oak Zeng
2025-01-12 10:44 ` Thomas Hellström
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=a67290be139bcf7f58964850e93b7b5141aabd13.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=oak.zeng@intel.com \
--cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox