From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: thomas.hellstrom@linux.intel.com, himal.prasad.ghimiray@intel.com
Subject: [PATCH v8 4/5] drm/xe: Timeslice GPU on atomic SVM fault
Date: Mon, 12 May 2025 06:54:58 -0700 [thread overview]
Message-ID: <20250512135500.1405019-5-matthew.brost@intel.com> (raw)
In-Reply-To: <20250512135500.1405019-1-matthew.brost@intel.com>
Ensure GPU can make forward progress on an atomic SVM GPU fault by
giving the GPU a timeslice of 5ms
v2:
- Reduce timeslice to 5ms
- Double timeslice on retry
- Split out GPU SVM changes into independent patch
v5:
- Double timeslice in a few more places
Fixes: 2f118c949160 ("drm/xe: Add SVM VRAM migration")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
drivers/gpu/drm/xe/xe_svm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index d8e15259a8df..d934df622276 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -797,6 +797,8 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? SZ_64K : 0,
.devmem_only = atomic && IS_DGFX(vm->xe) &&
IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR),
+ .timeslice_ms = atomic && IS_DGFX(vm->xe) &&
+ IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? 5 : 0,
};
struct xe_svm_range *range;
struct drm_gpusvm_range *r;
@@ -836,6 +838,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
if (--migrate_try_count >= 0 &&
xe_svm_range_needs_migrate_to_vram(range, vma)) {
err = xe_svm_alloc_vram(vm, tile, range, &ctx);
+ ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry */
if (err) {
if (migrate_try_count || !ctx.devmem_only) {
drm_dbg(&vm->xe->drm,
@@ -855,6 +858,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
err = drm_gpusvm_range_get_pages(&vm->svm.gpusvm, r, &ctx);
/* Corner where CPU mappings have changed */
if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM) {
+ ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry */
if (migrate_try_count > 0 || !ctx.devmem_only) {
if (err == -EOPNOTSUPP) {
range_debug(range, "PAGE FAULT - EVICT PAGES");
@@ -894,6 +898,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
drm_exec_fini(&exec);
err = PTR_ERR(fence);
if (err == -EAGAIN) {
+ ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry */
range_debug(range, "PAGE FAULT - RETRY BIND");
goto retry;
}
--
2.34.1
next prev parent reply other threads:[~2025-05-12 13:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 13:54 [PATCH v8 0/5] Enable SVM atomics in Xe / GPU SVM Matthew Brost
2025-05-12 13:54 ` [PATCH v8 1/5] drm/gpusvm: Introduce devmem_only flag for allocation Matthew Brost
2025-05-12 13:54 ` [PATCH v8 2/5] drm/xe: Strict migration policy for atomic SVM faults Matthew Brost
2025-05-12 14:22 ` Thomas Hellström
2025-05-12 13:54 ` [PATCH v8 3/5] drm/gpusvm: Add timeslicing support to GPU SVM Matthew Brost
2025-05-12 13:54 ` Matthew Brost [this message]
2025-05-12 13:54 ` [PATCH v8 5/5] drm/xe: Add atomic_svm_timeslice_ms debugfs entry Matthew Brost
2025-05-12 14:50 ` ✓ CI.Patch_applied: success for Enable SVM atomics in Xe / GPU SVM (rev8) Patchwork
2025-05-12 14:50 ` ✗ CI.checkpatch: warning " Patchwork
2025-05-12 14:51 ` ✓ CI.KUnit: success " Patchwork
2025-05-12 15:00 ` ✓ CI.Build: " Patchwork
2025-05-12 15:02 ` ✓ CI.Hooks: " Patchwork
2025-05-12 15:03 ` ✓ CI.checksparse: " Patchwork
2025-05-12 15:32 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-12 17:25 ` ✓ Xe.CI.Full: " Patchwork
2025-05-26 21:27 ` ✗ CI.Patch_applied: 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=20250512135500.1405019-5-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=thomas.hellstrom@linux.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