Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/nouveau: Remove waitque for sched teardown

struct nouveau_sched contains a waitque needed to prevent
drm_sched_fini() from being called while there are still jobs pending.
Doing so so far would have caused memory leaks.

With the new memleak-free mode of operation switched on in
drm_sched_fini() by providing the callback nouveau_sched_cancel_job()
the waitque is not necessary anymore.

Remove the waitque.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20250710125412.128476-10-phasta@kernel.org

+14 -23
+7 -13
drivers/gpu/drm/nouveau/nouveau_sched.c
··· 122 122 { 123 123 struct nouveau_sched *sched = job->sched; 124 124 125 - spin_lock(&sched->job.list.lock); 125 + spin_lock(&sched->job_list.lock); 126 126 list_del(&job->entry); 127 - spin_unlock(&sched->job.list.lock); 128 - 129 - wake_up(&sched->job.wq); 127 + spin_unlock(&sched->job_list.lock); 130 128 } 131 129 132 130 void ··· 305 307 } 306 308 307 309 /* Submit was successful; add the job to the schedulers job list. */ 308 - spin_lock(&sched->job.list.lock); 309 - list_add(&job->entry, &sched->job.list.head); 310 - spin_unlock(&sched->job.list.lock); 310 + spin_lock(&sched->job_list.lock); 311 + list_add(&job->entry, &sched->job_list.head); 312 + spin_unlock(&sched->job_list.lock); 311 313 312 314 drm_sched_job_arm(&job->base); 313 315 job->done_fence = dma_fence_get(&job->base.s_fence->finished); ··· 458 460 goto fail_sched; 459 461 460 462 mutex_init(&sched->mutex); 461 - spin_lock_init(&sched->job.list.lock); 462 - INIT_LIST_HEAD(&sched->job.list.head); 463 - init_waitqueue_head(&sched->job.wq); 463 + spin_lock_init(&sched->job_list.lock); 464 + INIT_LIST_HEAD(&sched->job_list.head); 464 465 465 466 return 0; 466 467 ··· 498 501 { 499 502 struct drm_gpu_scheduler *drm_sched = &sched->base; 500 503 struct drm_sched_entity *entity = &sched->entity; 501 - 502 - rmb(); /* for list_empty to work without lock */ 503 - wait_event(sched->job.wq, list_empty(&sched->job.list.head)); 504 504 505 505 drm_sched_entity_fini(entity); 506 506 drm_sched_fini(drm_sched);
+3 -6
drivers/gpu/drm/nouveau/nouveau_sched.h
··· 103 103 struct mutex mutex; 104 104 105 105 struct { 106 - struct { 107 - struct list_head head; 108 - spinlock_t lock; 109 - } list; 110 - struct wait_queue_head wq; 111 - } job; 106 + struct list_head head; 107 + spinlock_t lock; 108 + } job_list; 112 109 }; 113 110 114 111 int nouveau_sched_create(struct nouveau_sched **psched, struct nouveau_drm *drm,
+4 -4
drivers/gpu/drm/nouveau/nouveau_uvmm.c
··· 1019 1019 u64 end = addr + range; 1020 1020 1021 1021 again: 1022 - spin_lock(&sched->job.list.lock); 1023 - list_for_each_entry(__job, &sched->job.list.head, entry) { 1022 + spin_lock(&sched->job_list.lock); 1023 + list_for_each_entry(__job, &sched->job_list.head, entry) { 1024 1024 struct nouveau_uvmm_bind_job *bind_job = to_uvmm_bind_job(__job); 1025 1025 1026 1026 list_for_each_op(op, &bind_job->ops) { ··· 1030 1030 1031 1031 if (!(end <= op_addr || addr >= op_end)) { 1032 1032 nouveau_uvmm_bind_job_get(bind_job); 1033 - spin_unlock(&sched->job.list.lock); 1033 + spin_unlock(&sched->job_list.lock); 1034 1034 wait_for_completion(&bind_job->complete); 1035 1035 nouveau_uvmm_bind_job_put(bind_job); 1036 1036 goto again; ··· 1038 1038 } 1039 1039 } 1040 1040 } 1041 - spin_unlock(&sched->job.list.lock); 1041 + spin_unlock(&sched->job_list.lock); 1042 1042 } 1043 1043 1044 1044 static int