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 Linux work is queued in intr con...
details: https://anonhg.NetBSD.org/src/rev/fce3e49bd6ad
branches: trunk
changeset: 797790:fce3e49bd6ad
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Jul 27 14:02:48 2014 +0000
description:
Linux work is queued in intr context, so block intrs when locking.
(Yes, this getting out of hand.)
diffstat:
sys/external/bsd/drm2/linux/linux_work.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diffs (68 lines):
diff -r 4f53d7e051fe -r fce3e49bd6ad sys/external/bsd/drm2/linux/linux_work.c
--- a/sys/external/bsd/drm2/linux/linux_work.c Sun Jul 27 10:19:12 2014 +0000
+++ b/sys/external/bsd/drm2/linux/linux_work.c Sun Jul 27 14:02:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.5 2014/07/25 16:15:12 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.6 2014/07/27 14:02:48 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.5 2014/07/25 16:15:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.6 2014/07/27 14:02:48 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -281,24 +281,49 @@
*
* We use __cpu_simple_lock(9) rather than mutex(9) because Linux code
* does not destroy work, so there is nowhere to call mutex_destroy.
+ *
+ * XXX This is getting out of hand... Really, work items shouldn't
+ * have locks in them at all; instead the workqueues should.
*/
static void
linux_work_lock_init(struct work_struct *work)
{
+
__cpu_simple_lock_init(&work->w_lock);
}
static void
linux_work_lock(struct work_struct *work)
{
+ struct cpu_info *ci;
+ int cnt, s;
+
+ /* XXX Copypasta of MUTEX_SPIN_SPLRAISE. */
+ s = splvm();
+ ci = curcpu();
+ cnt = ci->ci_mtx_count--;
+ __insn_barrier();
+ if (cnt == 0)
+ ci->ci_mtx_oldspl = s;
+
__cpu_simple_lock(&work->w_lock);
}
static void
linux_work_unlock(struct work_struct *work)
{
+ struct cpu_info *ci;
+ int s;
+
__cpu_simple_unlock(&work->w_lock);
+
+ /* XXX Copypasta of MUTEX_SPIN_SPLRESTORE. */
+ ci = curcpu();
+ s = ci->ci_mtx_oldspl;
+ __insn_barrier();
+ if (++ci->ci_mtx_count == 0)
+ splx(s);
}
static bool __diagused
Home |
Main Index |
Thread Index |
Old Index