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/amd/scheduler Fix locking in ...
details: https://anonhg.NetBSD.org/src/rev/376a60f43b3b
branches: trunk
changeset: 992994:376a60f43b3b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 14:42:07 2018 +0000
description:
Fix locking in amd_sched_wakeup and amd_sched_entity_in.
diffstat:
sys/external/bsd/drm2/dist/drm/amd/scheduler/amdgpu_gpu_scheduler.c | 15 +++++----
1 files changed, 8 insertions(+), 7 deletions(-)
diffs (60 lines):
diff -r 8fdc4f3bc68c -r 376a60f43b3b sys/external/bsd/drm2/dist/drm/amd/scheduler/amdgpu_gpu_scheduler.c
--- a/sys/external/bsd/drm2/dist/drm/amd/scheduler/amdgpu_gpu_scheduler.c Mon Aug 27 14:41:53 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/scheduler/amdgpu_gpu_scheduler.c Mon Aug 27 14:42:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amdgpu_gpu_scheduler.c,v 1.1 2018/08/27 14:10:14 riastradh Exp $ */
+/* $NetBSD: amdgpu_gpu_scheduler.c,v 1.2 2018/08/27 14:42:07 riastradh Exp $ */
/*
* Copyright 2015 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
*
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gpu_scheduler.c,v 1.1 2018/08/27 14:10:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gpu_scheduler.c,v 1.2 2018/08/27 14:42:07 riastradh Exp $");
#include <sys/kthread.h>
@@ -239,7 +239,9 @@
{
entity->dependency = NULL;
fence_put(f);
+ spin_lock(&entity->sched->job_lock);
amd_sched_wakeup(entity->sched);
+ spin_unlock(&entity->sched->job_lock);
}
static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb)
@@ -313,15 +315,14 @@
struct amd_sched_entity *entity = sched_job->s_entity;
bool added, first = false;
- spin_lock(&entity->queue_lock);
+ BUG_ON(!spin_is_locked(&sched->job_lock));
+
added = kfifo_in(&entity->job_queue, &sched_job,
sizeof(sched_job)) == sizeof(sched_job);
if (added && kfifo_len(&entity->job_queue) == sizeof(sched_job))
first = true;
- spin_unlock(&entity->queue_lock);
-
/* first job wakes up scheduler */
if (first)
amd_sched_wakeup(sched);
@@ -368,11 +369,11 @@
*/
static void amd_sched_wakeup(struct amd_gpu_scheduler *sched)
{
+
+ BUG_ON(!spin_is_locked(&sched->job_lock));
if (amd_sched_ready(sched)) {
#ifdef __NetBSD__
- spin_lock(&sched->job_lock);
DRM_SPIN_WAKEUP_ONE(&sched->wake_up_worker, &sched->job_lock);
- spin_unlock(&sched->job_lock);
#else
wake_up_interruptible(&sched->wake_up_worker);
#endif
Home |
Main Index |
Thread Index |
Old Index