Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/scheduler drm: Avoid locking ...



details:   https://anonhg.NetBSD.org/src/rev/223d81386198
branches:  trunk
changeset: 1028926:223d81386198
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:29:55 2021 +0000

description:
drm: Avoid locking against self in scheduler.

diffstat:

 sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r 8457c9096286 -r 223d81386198 sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
--- a/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c     Sun Dec 19 12:29:47 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c     Sun Dec 19 12:29:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched_main.c,v 1.3 2021/12/19 12:23:16 riastradh Exp $ */
+/*     $NetBSD: sched_main.c,v 1.4 2021/12/19 12:29:55 riastradh Exp $ */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.3 2021/12/19 12:23:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.4 2021/12/19 12:29:55 riastradh Exp $");
 
 #include <linux/kthread.h>
 #include <linux/wait.h>
@@ -692,7 +692,8 @@
 drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched)
 {
        struct drm_sched_job *job;
-       unsigned long flags;
+
+       assert_spin_locked(&sched->job_list_lock);
 
        /*
         * Don't destroy jobs while the timeout worker is running  OR thread
@@ -703,8 +704,6 @@
            __kthread_should_park(sched->thread))
                return NULL;
 
-       spin_lock_irqsave(&sched->job_list_lock, flags);
-
        job = list_first_entry_or_null(&sched->ring_mirror_list,
                                       struct drm_sched_job, node);
 
@@ -717,8 +716,6 @@
                drm_sched_start_timeout(sched);
        }
 
-       spin_unlock_irqrestore(&sched->job_list_lock, flags);
-
        return job;
 }
 



Home | Main Index | Thread Index | Old Index