drm/sched: Use completion to wait for sched->thread idle v2.
Removes thread park/unpark hack from drm_sched_entity_fini and by this fixes reactivation of scheduler thread while the thread is supposed to be stopped. v2: Per sched entity completion. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Suggested-by: Christian König <christian.koenig@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:

committed by
Alex Deucher

parent
cb5932f866
commit
83a7772ba2
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/completion.h>
|
||||
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/gpu_scheduler.h>
|
||||
@@ -68,6 +69,8 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
|
||||
if (!entity->rq_list)
|
||||
return -ENOMEM;
|
||||
|
||||
init_completion(&entity->entity_idle);
|
||||
|
||||
for (i = 0; i < num_rq_list; ++i)
|
||||
entity->rq_list[i] = rq_list[i];
|
||||
|
||||
@@ -286,11 +289,12 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity)
|
||||
*/
|
||||
if (spsc_queue_count(&entity->job_queue)) {
|
||||
if (sched) {
|
||||
/* Park the kernel for a moment to make sure it isn't processing
|
||||
* our enity.
|
||||
/*
|
||||
* Wait for thread to idle to make sure it isn't processing
|
||||
* this entity.
|
||||
*/
|
||||
kthread_park(sched->thread);
|
||||
kthread_unpark(sched->thread);
|
||||
wait_for_completion(&entity->entity_idle);
|
||||
|
||||
}
|
||||
if (entity->dependency) {
|
||||
dma_fence_remove_callback(entity->dependency,
|
||||
|
Reference in New Issue
Block a user