History

drm/xe/uapi: Remove support for persistent exec_queues

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)

Thomas Hellström committed 2 years ago

Commit 77aebae1 parent b401b628 files · +5 −94Browse files

Unified · Split

8 files
  1. drivers/gpu/drm/xe/xe_device.c +0 −39
  2. drivers/gpu/drm/xe/xe_device.h +0 −4
  3. drivers/gpu/drm/xe/xe_device_types.h +0 −8
  4. drivers/gpu/drm/xe/xe_exec_queue.c +5 −28
  5. drivers/gpu/drm/xe/xe_exec_queue_types.h +0 −10
  6. drivers/gpu/drm/xe/xe_execlist.c +0 −2
  7. drivers/gpu/drm/xe/xe_guc_submit.c +0 −2
  8. include/uapi/drm/xe_drm.h +0 −1
drivers/gpu/drm/xe/xe_device.c+0−39
@@ -83,9 +83,6 @@ static int xe_file_open(struct drm_device *dev, struct drm_file *file) · 82 unmodified lines
8383 return 0;
8484 }
8585
86−static void device_kill_persistent_exec_queues(struct xe_device *xe,
87− struct xe_file *xef);
88−
8986 static void xe_file_close(struct drm_device *dev, struct drm_file *file)
9087 {
9188 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
10299 mutex_unlock(&xef->exec_queue.lock);
103100 xa_destroy(&xef->exec_queue.xa);
104101 mutex_destroy(&xef->exec_queue.lock);
105− device_kill_persistent_exec_queues(xe, xef);
106−
107102 mutex_lock(&xef->vm.lock);
108103 xa_for_each(&xef->vm.xa, idx, vm)
109104 xe_vm_close_and_put(vm);
@@ -255,9 +250,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev, · 145 unmodified lines
255250 xa_erase(&xe->usm.asid_to_vm, asid);
256251 }
257252
258− drmm_mutex_init(&xe->drm, &xe->persistent_engines.lock);
259− INIT_LIST_HEAD(&xe->persistent_engines.list);
260−
261253 spin_lock_init(&xe->pinned.lock);
262254 INIT_LIST_HEAD(&xe->pinned.kernel_bo_present);
263255 INIT_LIST_HEAD(&xe->pinned.external_vram);
@@ -570,37 +562,6 @@ void xe_device_shutdown(struct xe_device *xe) · 306 unmodified lines
570562 {
571563 }
572564
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−
604565 void xe_device_wmb(struct xe_device *xe)
605566 {
606567 struct xe_gt *gt = xe_root_mmio_gt(xe);
drivers/gpu/drm/xe/xe_device.h+0−4
@@ -42,10 +42,6 @@ int xe_device_probe(struct xe_device *xe); · 41 unmodified lines
4242 void xe_device_remove(struct xe_device *xe);
4343 void xe_device_shutdown(struct xe_device *xe);
4444
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−
4945 void xe_device_wmb(struct xe_device *xe);
5046
5147 static inline struct xe_file *to_xe_file(const struct drm_file *file)
drivers/gpu/drm/xe/xe_device_types.h+0−8
@@ -341,14 +341,6 @@ struct xe_device { · 340 unmodified lines
341341 struct mutex lock;
342342 } usm;
343343
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−
352344 /** @pinned: pinned BO state */
353345 struct {
354346 /** @lock: protected pinned BO list state */
drivers/gpu/drm/xe/xe_exec_queue.c+5−28
@@ -60,7 +60,6 @@ static struct xe_exec_queue *__xe_exec_queue_create(struct xe_device *xe, · 59 unmodified lines
6060 q->fence_irq = &gt->fence_irq[hwe->class];
6161 q->ring_ops = gt->ring_ops[hwe->class];
6262 q->ops = gt->exec_queue_ops;
63− INIT_LIST_HEAD(&q->persistent.link);
6463 INIT_LIST_HEAD(&q->compute.link);
6564 INIT_LIST_HEAD(&q->multi_gt_link);
6665
@@ -326,23 +325,6 @@ static int exec_queue_set_preemption_timeout(struct xe_device *xe, · 259 unmodified lines
326325 return q->ops->set_preempt_timeout(q, value);
327326 }
328327
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−
346328 static int exec_queue_set_job_timeout(struct xe_device *xe, struct xe_exec_queue *q,
347329 u64 value, bool create)
348330 {
@@ -414,7 +396,6 @@ static const xe_exec_queue_set_property_fn exec_queue_set_property_funcs[] = { · 65 unmodified lines
414396 [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY] = exec_queue_set_priority,
415397 [DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE] = exec_queue_set_timeslice,
416398 [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,
418399 [DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT] = exec_queue_set_job_timeout,
419400 [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER] = exec_queue_set_acc_trigger,
420401 [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
441422 return -EINVAL;
442423
443424 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+
444428 return exec_queue_set_property_funcs[idx](xe, q, ext.value, create);
445429 }
446430
@@ -704,9 +688,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data, · 257 unmodified lines
704688 }
705689
706690 q = xe_exec_queue_create(xe, vm, logical_mask,
707− args->width, hwe,
708− xe_vm_in_lr_mode(vm) ? 0 :
709− EXEC_QUEUE_FLAG_PERSISTENT);
691+ args->width, hwe, 0);
710692 up_read(&vm->lock);
711693 xe_vm_put(vm);
712694 if (IS_ERR(q))
@@ -728,8 +710,6 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data, · 15 unmodified lines
728710 goto kill_exec_queue;
729711 }
730712
731− q->persistent.xef = xef;
732−
733713 mutex_lock(&xef->exec_queue.lock);
734714 err = xa_alloc(&xef->exec_queue.xa, &id, q, xa_limit_32b, GFP_KERNEL);
735715 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
872852 if (XE_IOCTL_DBG(xe, !q))
873853 return -ENOENT;
874854
875− if (!(q->flags & EXEC_QUEUE_FLAG_PERSISTENT))
876− xe_exec_queue_kill(q);
877− else
878− xe_device_add_persistent_exec_queues(xe, q);
855+ xe_exec_queue_kill(q);
879856
880857 trace_xe_exec_queue_close(q);
881858 xe_exec_queue_put(q);
drivers/gpu/drm/xe/xe_exec_queue_types.h+0−10
@@ -105,16 +105,6 @@ struct xe_exec_queue { · 104 unmodified lines
105105 struct xe_guc_exec_queue *guc;
106106 };
107107
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−
118108 union {
119109 /**
120110 * @parallel: parallel submission state
drivers/gpu/drm/xe/xe_execlist.c+0−2
@@ -378,8 +378,6 @@ static void execlist_exec_queue_fini_async(struct work_struct *w) · 377 unmodified lines
378378 list_del(&exl->active_link);
379379 spin_unlock_irqrestore(&exl->port->lock, flags);
380380
381− if (q->flags & EXEC_QUEUE_FLAG_PERSISTENT)
382− xe_device_remove_persistent_exec_queues(xe, q);
383381 drm_sched_entity_fini(&exl->entity);
384382 drm_sched_fini(&exl->sched);
385383 kfree(exl);
drivers/gpu/drm/xe/xe_guc_submit.c+0−2
@@ -1028,8 +1028,6 @@ static void __guc_exec_queue_fini_async(struct work_struct *w) · 1027 unmodified lines
10281028
10291029 if (xe_exec_queue_is_lr(q))
10301030 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);
10331031 release_guc_id(guc, q);
10341032 xe_sched_entity_fini(&ge->entity);
10351033 xe_sched_fini(&ge->sched);
include/uapi/drm/xe_drm.h+0−1
@@ -1046,7 +1046,6 @@ struct drm_xe_exec_queue_create { · 1045 unmodified lines
10461046 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY 0
10471047 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE 1
10481048 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT 2
1049−#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE 3
10501049 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT 4
10511050 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER 5
10521051 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY 6

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t