Persistent exec_queues delays explicit destruction of exec_queues until they are done executing, but destruction on process exit is still immediate. It turns out no UMD is relying on this functionality, so remove it. If there turns out to be a use-case in the future, let's re-add. Persistent exec_queues were never used for LR VMs v2: - Don't add an "UNUSED" define for the missing property (Lucas, Rodrigo) v3: - Remove the remaining struct xe_exec_queue::persistent state (Niranjana, Lucas)
Unified · Split
| @@ -83,9 +83,6 @@ static int xe_file_open(struct drm_device *dev, struct drm_file *file) · 82 unmodified lines | |||
| 83 | return 0; | 83 | return 0; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static void device_kill_persistent_exec_queues(struct xe_device *xe, | ||
| 87 | struct xe_file *xef); | ||
| 88 | |||
| 89 | static void xe_file_close(struct drm_device *dev, struct drm_file *file) | 86 | static void xe_file_close(struct drm_device *dev, struct drm_file *file) |
| 90 | { | 87 | { |
| 91 | struct xe_device *xe = to_xe_device(dev); | 88 | struct xe_device *xe = to_xe_device(dev); |
| @@ -102,8 +99,6 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file) · 10 unmodified lines | |||
| 102 | mutex_unlock(&xef->exec_queue.lock); | 99 | mutex_unlock(&xef->exec_queue.lock); |
| 103 | xa_destroy(&xef->exec_queue.xa); | 100 | xa_destroy(&xef->exec_queue.xa); |
| 104 | mutex_destroy(&xef->exec_queue.lock); | 101 | mutex_destroy(&xef->exec_queue.lock); |
| 105 | device_kill_persistent_exec_queues(xe, xef); | ||
| 106 | |||
| 107 | mutex_lock(&xef->vm.lock); | 102 | mutex_lock(&xef->vm.lock); |
| 108 | xa_for_each(&xef->vm.xa, idx, vm) | 103 | xa_for_each(&xef->vm.xa, idx, vm) |
| 109 | xe_vm_close_and_put(vm); | 104 | xe_vm_close_and_put(vm); |
| @@ -255,9 +250,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev, · 145 unmodified lines | |||
| 255 | xa_erase(&xe->usm.asid_to_vm, asid); | 250 | xa_erase(&xe->usm.asid_to_vm, asid); |
| 256 | } | 251 | } |
| 257 | 252 | ||
| 258 | drmm_mutex_init(&xe->drm, &xe->persistent_engines.lock); | ||
| 259 | INIT_LIST_HEAD(&xe->persistent_engines.list); | ||
| 260 | |||
| 261 | spin_lock_init(&xe->pinned.lock); | 253 | spin_lock_init(&xe->pinned.lock); |
| 262 | INIT_LIST_HEAD(&xe->pinned.kernel_bo_present); | 254 | INIT_LIST_HEAD(&xe->pinned.kernel_bo_present); |
| 263 | INIT_LIST_HEAD(&xe->pinned.external_vram); | 255 | INIT_LIST_HEAD(&xe->pinned.external_vram); |
| @@ -570,37 +562,6 @@ void xe_device_shutdown(struct xe_device *xe) · 306 unmodified lines | |||
| 570 | { | 562 | { |
| 571 | } | 563 | } |
| 572 | 564 | ||
| 573 | void xe_device_add_persistent_exec_queues(struct xe_device *xe, struct xe_exec_queue *q) | ||
| 574 | { | ||
| 575 | mutex_lock(&xe->persistent_engines.lock); | ||
| 576 | list_add_tail(&q->persistent.link, &xe->persistent_engines.list); | ||
| 577 | mutex_unlock(&xe->persistent_engines.lock); | ||
| 578 | } | ||
| 579 | |||
| 580 | void xe_device_remove_persistent_exec_queues(struct xe_device *xe, | ||
| 581 | struct xe_exec_queue *q) | ||
| 582 | { | ||
| 583 | mutex_lock(&xe->persistent_engines.lock); | ||
| 584 | if (!list_empty(&q->persistent.link)) | ||
| 585 | list_del(&q->persistent.link); | ||
| 586 | mutex_unlock(&xe->persistent_engines.lock); | ||
| 587 | } | ||
| 588 | |||
| 589 | static void device_kill_persistent_exec_queues(struct xe_device *xe, | ||
| 590 | struct xe_file *xef) | ||
| 591 | { | ||
| 592 | struct xe_exec_queue *q, *next; | ||
| 593 | |||
| 594 | mutex_lock(&xe->persistent_engines.lock); | ||
| 595 | list_for_each_entry_safe(q, next, &xe->persistent_engines.list, | ||
| 596 | persistent.link) | ||
| 597 | if (q->persistent.xef == xef) { | ||
| 598 | xe_exec_queue_kill(q); | ||
| 599 | list_del_init(&q->persistent.link); | ||
| 600 | } | ||
| 601 | mutex_unlock(&xe->persistent_engines.lock); | ||
| 602 | } | ||
| 603 | |||
| 604 | void xe_device_wmb(struct xe_device *xe) | 565 | void xe_device_wmb(struct xe_device *xe) |
| 605 | { | 566 | { |
| 606 | struct xe_gt *gt = xe_root_mmio_gt(xe); | 567 | struct xe_gt *gt = xe_root_mmio_gt(xe); |
| @@ -42,10 +42,6 @@ int xe_device_probe(struct xe_device *xe); · 41 unmodified lines | |||
| 42 | void xe_device_remove(struct xe_device *xe); | 42 | void xe_device_remove(struct xe_device *xe); |
| 43 | void xe_device_shutdown(struct xe_device *xe); | 43 | void xe_device_shutdown(struct xe_device *xe); |
| 44 | 44 | ||
| 45 | void xe_device_add_persistent_exec_queues(struct xe_device *xe, struct xe_exec_queue *q); | ||
| 46 | void xe_device_remove_persistent_exec_queues(struct xe_device *xe, | ||
| 47 | struct xe_exec_queue *q); | ||
| 48 | |||
| 49 | void xe_device_wmb(struct xe_device *xe); | 45 | void xe_device_wmb(struct xe_device *xe); |
| 50 | 46 | ||
| 51 | static inline struct xe_file *to_xe_file(const struct drm_file *file) | 47 | static inline struct xe_file *to_xe_file(const struct drm_file *file) |
| @@ -341,14 +341,6 @@ struct xe_device { · 340 unmodified lines | |||
| 341 | struct mutex lock; | 341 | struct mutex lock; |
| 342 | } usm; | 342 | } usm; |
| 343 | 343 | ||
| 344 | /** @persistent_engines: engines that are closed but still running */ | ||
| 345 | struct { | ||
| 346 | /** @lock: protects persistent engines */ | ||
| 347 | struct mutex lock; | ||
| 348 | /** @list: list of persistent engines */ | ||
| 349 | struct list_head list; | ||
| 350 | } persistent_engines; | ||
| 351 | |||
| 352 | /** @pinned: pinned BO state */ | 344 | /** @pinned: pinned BO state */ |
| 353 | struct { | 345 | struct { |
| 354 | /** @lock: protected pinned BO list state */ | 346 | /** @lock: protected pinned BO list state */ |
| @@ -60,7 +60,6 @@ static struct xe_exec_queue *__xe_exec_queue_create(struct xe_device *xe, · 59 unmodified lines | |||
| 60 | q->fence_irq = >->fence_irq[hwe->class]; | 60 | q->fence_irq = >->fence_irq[hwe->class]; |
| 61 | q->ring_ops = gt->ring_ops[hwe->class]; | 61 | q->ring_ops = gt->ring_ops[hwe->class]; |
| 62 | q->ops = gt->exec_queue_ops; | 62 | q->ops = gt->exec_queue_ops; |
| 63 | INIT_LIST_HEAD(&q->persistent.link); | ||
| 64 | INIT_LIST_HEAD(&q->compute.link); | 63 | INIT_LIST_HEAD(&q->compute.link); |
| 65 | INIT_LIST_HEAD(&q->multi_gt_link); | 64 | INIT_LIST_HEAD(&q->multi_gt_link); |
| 66 | 65 | ||
| @@ -326,23 +325,6 @@ static int exec_queue_set_preemption_timeout(struct xe_device *xe, · 259 unmodified lines | |||
| 326 | return q->ops->set_preempt_timeout(q, value); | 325 | return q->ops->set_preempt_timeout(q, value); |
| 327 | } | 326 | } |
| 328 | 327 | ||
| 329 | static int exec_queue_set_persistence(struct xe_device *xe, struct xe_exec_queue *q, | ||
| 330 | u64 value, bool create) | ||
| 331 | { | ||
| 332 | if (XE_IOCTL_DBG(xe, !create)) | ||
| 333 | return -EINVAL; | ||
| 334 | |||
| 335 | if (XE_IOCTL_DBG(xe, xe_vm_in_preempt_fence_mode(q->vm))) | ||
| 336 | return -EINVAL; | ||
| 337 | |||
| 338 | if (value) | ||
| 339 | q->flags |= EXEC_QUEUE_FLAG_PERSISTENT; | ||
| 340 | else | ||
| 341 | q->flags &= ~EXEC_QUEUE_FLAG_PERSISTENT; | ||
| 342 | |||
| 343 | return 0; | ||
| 344 | } | ||
| 345 | |||
| 346 | static int exec_queue_set_job_timeout(struct xe_device *xe, struct xe_exec_queue *q, | 328 | static int exec_queue_set_job_timeout(struct xe_device *xe, struct xe_exec_queue *q, |
| 347 | u64 value, bool create) | 329 | u64 value, bool create) |
| 348 | { | 330 | { |
| @@ -414,7 +396,6 @@ static const xe_exec_queue_set_property_fn exec_queue_set_property_funcs[] = { · 65 unmodified lines | |||
| 414 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY] = exec_queue_set_priority, | 396 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY] = exec_queue_set_priority, |
| 415 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE] = exec_queue_set_timeslice, | 397 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE] = exec_queue_set_timeslice, |
| 416 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT] = exec_queue_set_preemption_timeout, | 398 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT] = exec_queue_set_preemption_timeout, |
| 417 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE] = exec_queue_set_persistence, | ||
| 418 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT] = exec_queue_set_job_timeout, | 399 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT] = exec_queue_set_job_timeout, |
| 419 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER] = exec_queue_set_acc_trigger, | 400 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER] = exec_queue_set_acc_trigger, |
| 420 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY] = exec_queue_set_acc_notify, | 401 | [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY] = exec_queue_set_acc_notify, |
| @@ -441,6 +422,9 @@ static int exec_queue_user_ext_set_property(struct xe_device *xe, · 20 unmodified lines | |||
| 441 | return -EINVAL; | 422 | return -EINVAL; |
| 442 | 423 | ||
| 443 | idx = array_index_nospec(ext.property, ARRAY_SIZE(exec_queue_set_property_funcs)); | 424 | idx = array_index_nospec(ext.property, ARRAY_SIZE(exec_queue_set_property_funcs)); |
| 425 | if (!exec_queue_set_property_funcs[idx]) | ||
| 426 | return -EINVAL; | ||
| 427 | |||
| 444 | return exec_queue_set_property_funcs[idx](xe, q, ext.value, create); | 428 | return exec_queue_set_property_funcs[idx](xe, q, ext.value, create); |
| 445 | } | 429 | } |
| 446 | 430 | ||
| @@ -704,9 +688,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data, · 257 unmodified lines | |||
| 704 | } | 688 | } |
| 705 | 689 | ||
| 706 | q = xe_exec_queue_create(xe, vm, logical_mask, | 690 | q = xe_exec_queue_create(xe, vm, logical_mask, |
| 707 | args->width, hwe, | 691 | args->width, hwe, 0); |
| 708 | xe_vm_in_lr_mode(vm) ? 0 : | ||
| 709 | EXEC_QUEUE_FLAG_PERSISTENT); | ||
| 710 | up_read(&vm->lock); | 692 | up_read(&vm->lock); |
| 711 | xe_vm_put(vm); | 693 | xe_vm_put(vm); |
| 712 | if (IS_ERR(q)) | 694 | if (IS_ERR(q)) |
| @@ -728,8 +710,6 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data, · 15 unmodified lines | |||
| 728 | goto kill_exec_queue; | 710 | goto kill_exec_queue; |
| 729 | } | 711 | } |
| 730 | 712 | ||
| 731 | q->persistent.xef = xef; | ||
| 732 | |||
| 733 | mutex_lock(&xef->exec_queue.lock); | 713 | mutex_lock(&xef->exec_queue.lock); |
| 734 | err = xa_alloc(&xef->exec_queue.xa, &id, q, xa_limit_32b, GFP_KERNEL); | 714 | err = xa_alloc(&xef->exec_queue.xa, &id, q, xa_limit_32b, GFP_KERNEL); |
| 735 | mutex_unlock(&xef->exec_queue.lock); | 715 | mutex_unlock(&xef->exec_queue.lock); |
| @@ -872,10 +852,7 @@ int xe_exec_queue_destroy_ioctl(struct drm_device *dev, void *data, · 136 unmodified lines | |||
| 872 | if (XE_IOCTL_DBG(xe, !q)) | 852 | if (XE_IOCTL_DBG(xe, !q)) |
| 873 | return -ENOENT; | 853 | return -ENOENT; |
| 874 | 854 | ||
| 875 | if (!(q->flags & EXEC_QUEUE_FLAG_PERSISTENT)) | 855 | xe_exec_queue_kill(q); |
| 876 | xe_exec_queue_kill(q); | ||
| 877 | else | ||
| 878 | xe_device_add_persistent_exec_queues(xe, q); | ||
| 879 | 856 | ||
| 880 | trace_xe_exec_queue_close(q); | 857 | trace_xe_exec_queue_close(q); |
| 881 | xe_exec_queue_put(q); | 858 | xe_exec_queue_put(q); |
| @@ -105,16 +105,6 @@ struct xe_exec_queue { · 104 unmodified lines | |||
| 105 | struct xe_guc_exec_queue *guc; | 105 | struct xe_guc_exec_queue *guc; |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | /** | ||
| 109 | * @persistent: persistent exec queue state | ||
| 110 | */ | ||
| 111 | struct { | ||
| 112 | /** @xef: file which this exec queue belongs to */ | ||
| 113 | struct xe_file *xef; | ||
| 114 | /** @link: link in list of persistent exec queues */ | ||
| 115 | struct list_head link; | ||
| 116 | } persistent; | ||
| 117 | |||
| 118 | union { | 108 | union { |
| 119 | /** | 109 | /** |
| 120 | * @parallel: parallel submission state | 110 | * @parallel: parallel submission state |
| @@ -378,8 +378,6 @@ static void execlist_exec_queue_fini_async(struct work_struct *w) · 377 unmodified lines | |||
| 378 | list_del(&exl->active_link); | 378 | list_del(&exl->active_link); |
| 379 | spin_unlock_irqrestore(&exl->port->lock, flags); | 379 | spin_unlock_irqrestore(&exl->port->lock, flags); |
| 380 | 380 | ||
| 381 | if (q->flags & EXEC_QUEUE_FLAG_PERSISTENT) | ||
| 382 | xe_device_remove_persistent_exec_queues(xe, q); | ||
| 383 | drm_sched_entity_fini(&exl->entity); | 381 | drm_sched_entity_fini(&exl->entity); |
| 384 | drm_sched_fini(&exl->sched); | 382 | drm_sched_fini(&exl->sched); |
| 385 | kfree(exl); | 383 | kfree(exl); |
| @@ -1028,8 +1028,6 @@ static void __guc_exec_queue_fini_async(struct work_struct *w) · 1027 unmodified lines | |||
| 1028 | 1028 | ||
| 1029 | if (xe_exec_queue_is_lr(q)) | 1029 | if (xe_exec_queue_is_lr(q)) |
| 1030 | cancel_work_sync(&ge->lr_tdr); | 1030 | cancel_work_sync(&ge->lr_tdr); |
| 1031 | if (q->flags & EXEC_QUEUE_FLAG_PERSISTENT) | ||
| 1032 | xe_device_remove_persistent_exec_queues(gt_to_xe(q->gt), q); | ||
| 1033 | release_guc_id(guc, q); | 1031 | release_guc_id(guc, q); |
| 1034 | xe_sched_entity_fini(&ge->entity); | 1032 | xe_sched_entity_fini(&ge->entity); |
| 1035 | xe_sched_fini(&ge->sched); | 1033 | xe_sched_fini(&ge->sched); |
| @@ -1046,7 +1046,6 @@ struct drm_xe_exec_queue_create { · 1045 unmodified lines | |||
| 1046 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY 0 | 1046 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY 0 |
| 1047 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE 1 | 1047 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE 1 |
| 1048 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT 2 | 1048 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT 2 |
| 1049 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE 3 | ||
| 1050 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT 4 | 1049 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT 4 |
| 1051 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER 5 | 1050 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER 5 |
| 1052 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY 6 | 1051 | #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY 6 |