]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge tag 'drm-intel-fixes-2020-01-16' of git://anongit.freedesktop.org/drm/drm-intel...
authorDave Airlie <airlied@redhat.com>
Sat, 18 Jan 2020 02:53:53 +0000 (12:53 +1000)
committerDave Airlie <airlied@redhat.com>
Sat, 18 Jan 2020 02:53:54 +0000 (12:53 +1000)
- uAPI fix: Remove dash and colon from PMU names to comply with tools/perf
- Fix for include file that was indirectly included
- Two fixes to make sure VMA are marked active for error capture

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200116161419.GA13594@jlahtine-desk.ger.corp.intel.com
drivers/gpu/drm/i915/gt/intel_context.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/selftests/i915_random.h

index ef7bc41ffffad537b981181129bb9772d3dc36fb..5b7ff3ccfa8ea8329657cdaea3555615e77de852 100644 (file)
@@ -123,6 +123,10 @@ static int __context_pin_state(struct i915_vma *vma)
        if (err)
                return err;
 
+       err = i915_active_acquire(&vma->active);
+       if (err)
+               goto err_unpin;
+
        /*
         * And mark it as a globally pinned object to let the shrinker know
         * it cannot reclaim the object until we release it.
@@ -131,14 +135,44 @@ static int __context_pin_state(struct i915_vma *vma)
        vma->obj->mm.dirty = true;
 
        return 0;
+
+err_unpin:
+       i915_vma_unpin(vma);
+       return err;
 }
 
 static void __context_unpin_state(struct i915_vma *vma)
 {
        i915_vma_make_shrinkable(vma);
+       i915_active_release(&vma->active);
        __i915_vma_unpin(vma);
 }
 
+static int __ring_active(struct intel_ring *ring)
+{
+       int err;
+
+       err = i915_active_acquire(&ring->vma->active);
+       if (err)
+               return err;
+
+       err = intel_ring_pin(ring);
+       if (err)
+               goto err_active;
+
+       return 0;
+
+err_active:
+       i915_active_release(&ring->vma->active);
+       return err;
+}
+
+static void __ring_retire(struct intel_ring *ring)
+{
+       intel_ring_unpin(ring);
+       i915_active_release(&ring->vma->active);
+}
+
 __i915_active_call
 static void __intel_context_retire(struct i915_active *active)
 {
@@ -151,7 +185,7 @@ static void __intel_context_retire(struct i915_active *active)
                __context_unpin_state(ce->state);
 
        intel_timeline_unpin(ce->timeline);
-       intel_ring_unpin(ce->ring);
+       __ring_retire(ce->ring);
 
        intel_context_put(ce);
 }
@@ -163,7 +197,7 @@ static int __intel_context_active(struct i915_active *active)
 
        intel_context_get(ce);
 
-       err = intel_ring_pin(ce->ring);
+       err = __ring_active(ce->ring);
        if (err)
                goto err_put;
 
@@ -183,7 +217,7 @@ static int __intel_context_active(struct i915_active *active)
 err_timeline:
        intel_timeline_unpin(ce->timeline);
 err_ring:
-       intel_ring_unpin(ce->ring);
+       __ring_retire(ce->ring);
 err_put:
        intel_context_put(ce);
        return err;
index 6239a9adbf14e4cf0e1973039d58303af1737101..c083f516fd3598c8384f1c46c29063f77dfef8ea 100644 (file)
@@ -3304,7 +3304,7 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt)
 
 static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
 {
-       struct i915_vma *vma, *vn;
+       struct i915_vma *vma;
        bool flush = false;
        int open;
 
@@ -3319,15 +3319,12 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
        open = atomic_xchg(&ggtt->vm.open, 0);
 
        /* clflush objects bound into the GGTT and rebind them. */
-       list_for_each_entry_safe(vma, vn, &ggtt->vm.bound_list, vm_link) {
+       list_for_each_entry(vma, &ggtt->vm.bound_list, vm_link) {
                struct drm_i915_gem_object *obj = vma->obj;
 
                if (!i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
                        continue;
 
-               if (!__i915_vma_unbind(vma))
-                       continue;
-
                clear_bit(I915_VMA_GLOBAL_BIND_BIT, __i915_vma_flags(vma));
                WARN_ON(i915_vma_bind(vma,
                                      obj ? obj->cache_level : 0,
index 6f09aa0be80ae856c28a4129181936cf9e193b9c..d6d2e6fb867432a035b9df0e60a63823ef94e72f 100644 (file)
@@ -1074,12 +1074,17 @@ void i915_pmu_register(struct drm_i915_private *i915)
        hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        pmu->timer.function = i915_sample;
 
-       if (!is_igp(i915))
+       if (!is_igp(i915)) {
                pmu->name = kasprintf(GFP_KERNEL,
-                                     "i915-%s",
+                                     "i915_%s",
                                      dev_name(i915->drm.dev));
-       else
+               if (pmu->name) {
+                       /* tools/perf reserves colons as special. */
+                       strreplace((char *)pmu->name, ':', '_');
+               }
+       } else {
                pmu->name = "i915";
+       }
        if (!pmu->name)
                goto err;
 
index 35cc69a3a1b99abcb7e7fa181bac46abec8fcd74..05364eca20f7537d6ae6f651ba3c065b4305af72 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef __I915_SELFTESTS_RANDOM_H__
 #define __I915_SELFTESTS_RANDOM_H__
 
+#include <linux/math64.h>
 #include <linux/random.h>
 
 #include "../i915_selftest.h"