Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/dist/drm/i915 Use dev_priv->i...
details: https://anonhg.NetBSD.org/src/rev/ebee32422488
branches: riastradh-drm2
changeset: 788596:ebee32422488
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jan 15 13:53:32 2014 +0000
description:
Use dev_priv->irq_lock for ring->irq_queue, not dev->struct_mutex.
We need to use a spin lock here, because we need to exclude interrupt
handlers.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_dma.c | 6 +++-
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c | 7 +++-
sys/external/bsd/drm2/dist/drm/i915/i915_irq.c | 37 ++++++++++++++++---------
3 files changed, 34 insertions(+), 16 deletions(-)
diffs (114 lines):
diff -r a67587f530f9 -r ebee32422488 sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Wed Jan 15 13:53:20 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Wed Jan 15 13:53:32 2014 +0000
@@ -795,9 +795,13 @@
if (ring->irq_get(ring)) {
#ifdef __NetBSD__
- DRM_TIMED_WAIT_UNTIL(ret, &ring->irq_queue, &dev->struct_mutex,
+ unsigned long flags;
+ spin_lock_irqsave(&dev_priv->irq_lock, flags);
+ DRM_SPIN_TIMED_WAIT_UNTIL(ret, &ring->irq_queue,
+ &dev_priv->irq_lock,
3 * DRM_HZ,
READ_BREADCRUMB(dev_priv) >= irq_nr);
+ spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
#else
DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ,
READ_BREADCRUMB(dev_priv) >= irq_nr);
diff -r a67587f530f9 -r ebee32422488 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c Wed Jan 15 13:53:20 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c Wed Jan 15 13:53:32 2014 +0000
@@ -1193,14 +1193,17 @@
atomic_read(&dev_priv->mm.wedged))
do {
#ifdef __NetBSD__
+ unsigned long flags;
+ spin_lock_irqsave(&dev_priv->irq_lock, flags);
/*
* XXX This wait is always interruptible; we should
* heed the flag `interruptible'.
*/
- DRM_TIMED_WAIT_UNTIL(end, &ring->irq_queue,
- &ring->dev->struct_mutex,
+ DRM_SPIN_TIMED_WAIT_UNTIL(end, &ring->irq_queue,
+ &dev_priv->irq_lock,
timeout_jiffies,
EXIT_COND);
+ spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
#else
if (interruptible)
end = wait_event_interruptible_timeout(ring->irq_queue,
diff -r a67587f530f9 -r ebee32422488 sys/external/bsd/drm2/dist/drm/i915/i915_irq.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c Wed Jan 15 13:53:20 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c Wed Jan 15 13:53:32 2014 +0000
@@ -355,7 +355,12 @@
trace_i915_gem_request_complete(ring, ring->get_seqno(ring, false));
#ifdef __NetBSD__
- DRM_WAKEUP_ALL(&ring->irq_queue, &dev->struct_mutex);
+ {
+ unsigned long flags;
+ spin_lock_irqsave(&dev_priv->irq_lock, flags);
+ DRM_SPIN_WAKEUP_ALL(&ring->irq_queue, &dev_priv->irq_lock);
+ spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
+ }
#else
wake_up_all(&ring->irq_queue);
#endif
@@ -1167,8 +1172,13 @@
}
#ifdef __NetBSD__
- error->waiting[ring->id] = DRM_WAITERS_P(&ring->irq_queue,
- &dev->struct_mutex);
+ {
+ unsigned long flags;
+ spin_lock_irqsave(&dev_priv->irq_lock, flags);
+ error->waiting[ring->id] = DRM_SPIN_WAITERS_P(&ring->irq_queue,
+ &dev_priv->irq_lock);
+ spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
+ }
#else
error->waiting[ring->id] = waitqueue_active(&ring->irq_queue);
#endif
@@ -1487,7 +1497,8 @@
*/
for_each_ring(ring, dev_priv, i)
#ifdef __NetBSD__
- DRM_WAKEUP_ALL(&ring->irq_queue, &dev->struct_mutex);
+ DRM_SPIN_WAKEUP_ALL(&ring->irq_queue,
+ &dev_priv->irq_lock);
#else
wake_up_all(&ring->irq_queue);
#endif
@@ -1697,20 +1708,20 @@
/* Issue a wake-up to catch stuck h/w. */
#ifdef __NetBSD__
/*
- * XXX mutex_lock here is a load of bollocks, but I'm
- * not sure what invariants the irq_queue is actually
- * relying on.
+ * XXX What invariants is the irq_queue relying on?
*/
- mutex_lock(&ring->dev->struct_mutex);
- if (DRM_WAITERS_P(&ring->irq_queue,
- &ring->dev->struct_mutex)) {
+ struct drm_i915_private *dev_priv = ring->dev->dev_private;
+ unsigned long flags;
+ spin_lock_irqsave(&dev_priv->irq_lock, flags);
+ if (DRM_SPIN_WAITERS_P(&ring->irq_queue,
+ &dev_priv->irq_lock)) {
DRM_ERROR("Hangcheck timer elapsed... %s idle\n",
ring->name);
- DRM_WAKEUP_ALL(&ring->irq_queue,
- &ring->dev->struct_mutex);
+ DRM_SPIN_WAKEUP_ALL(&ring->irq_queue,
+ &dev_priv->irq_lock);
*err = true;
}
- mutex_unlock(&ring->dev->struct_mutex);
+ spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
#else
if (waitqueue_active(&ring->irq_queue)) {
DRM_ERROR("Hangcheck timer elapsed... %s idle\n",
Home |
Main Index |
Thread Index |
Old Index