diff options
author | Thomas Hellström <thomas.hellstrom@linux.intel.com> | 2023-03-14 15:56:44 +0100 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-19 18:30:14 -0500 |
commit | 8e41443e1bb7a9aa03263ab9e317ef04927be5aa (patch) | |
tree | 2a41465d11fd29e526a49d93de402954cc956e2a /drivers/gpu/drm/xe/xe_vm.c | |
parent | 7cba3396fd7e87a976b8ad1e30d734b72dec7e31 (diff) | |
download | lwn-8e41443e1bb7a9aa03263ab9e317ef04927be5aa.tar.gz lwn-8e41443e1bb7a9aa03263ab9e317ef04927be5aa.zip |
drm/xe/vm: Defer vm rebind until next exec if nothing to execute
If all compute engines of a vm in compute mode are idle,
defer a rebind to the next exec to avoid the VM unnecessarily trying
to make memory resident and compete with other VMs for available
memory space.
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_vm.c')
-rw-r--r-- | drivers/gpu/drm/xe/xe_vm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 6cc3204adaa8..207d20da5c68 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -226,6 +226,19 @@ static int wait_for_existing_preempt_fences(struct xe_vm *vm) return 0; } +static bool xe_vm_is_idle(struct xe_vm *vm) +{ + struct xe_engine *e; + + xe_vm_assert_held(vm); + list_for_each_entry(e, &vm->preempt.engines, compute.link) { + if (!xe_engine_is_idle(e)) + return false; + } + + return true; +} + static void arm_preempt_fences(struct xe_vm *vm, struct list_head *list) { struct list_head *link; @@ -548,6 +561,11 @@ retry: if (err) goto out_unlock_outer; + if (xe_vm_is_idle(vm)) { + vm->preempt.rebind_deactivated = true; + goto out_unlock; + } + /* Fresh preempt fences already installed. Everyting is running. */ if (!preempt_fences_waiting(vm)) goto out_unlock; |