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/linux drm: Take advantage of kthread i...



details:   https://anonhg.NetBSD.org/src/rev/63085273cc07
branches:  trunk
changeset: 1029009:63085273cc07
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:42:32 2021 +0000

description:
drm: Take advantage of kthread interlock to reduce diff.

diffstat:

 sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c |  7 ++-----
 sys/external/bsd/drm2/linux/linux_kthread.c           |  8 ++++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r 2cf6d5e113e8 -r 63085273cc07 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:42:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c     Sun Dec 19 12:42:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched_main.c,v 1.8 2021/12/19 12:42:25 riastradh Exp $ */
+/*     $NetBSD: sched_main.c,v 1.9 2021/12/19 12:42:32 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.8 2021/12/19 12:42:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.9 2021/12/19 12:42:32 riastradh Exp $");
 
 #include <linux/kthread.h>
 #include <linux/wait.h>
@@ -728,11 +728,8 @@
  */
 static bool drm_sched_blocked(struct drm_gpu_scheduler *sched)
 {
-       assert_spin_locked(&sched->job_list_lock);
        if (kthread_should_park()) {
-               spin_unlock(&sched->job_list_lock);
                kthread_parkme();
-               spin_lock(&sched->job_list_lock);
                return true;
        }
 
diff -r 2cf6d5e113e8 -r 63085273cc07 sys/external/bsd/drm2/linux/linux_kthread.c
--- a/sys/external/bsd/drm2/linux/linux_kthread.c       Sun Dec 19 12:42:25 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_kthread.c       Sun Dec 19 12:42:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_kthread.c,v 1.6 2021/12/19 12:42:25 riastradh Exp $      */
+/*     $NetBSD: linux_kthread.c,v 1.7 2021/12/19 12:42:32 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.6 2021/12/19 12:42:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.7 2021/12/19 12:42:32 riastradh Exp $");
 
 #include <sys/types.h>
 
@@ -275,6 +275,9 @@
 {
        struct task_struct *T = linux_kthread();
 
+       assert_spin_locked(T->kt_interlock);
+
+       spin_unlock(T->kt_interlock);
        mutex_enter(&T->kt_lock);
        while (T->kt_shouldpark) {
                T->kt_parked = true;
@@ -283,4 +286,5 @@
                T->kt_parked = false;
        }
        mutex_exit(&T->kt_lock);
+       spin_lock(T->kt_interlock);
 }



Home | Main Index | Thread Index | Old Index