Commit e33c7ba8 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-intel-fixes-2020-01-16' of...

Merge tag 'drm-intel-fixes-2020-01-16' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes

- 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: default avatarDave 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
parents 16a89856 88550e1c
...@@ -123,6 +123,10 @@ static int __context_pin_state(struct i915_vma *vma) ...@@ -123,6 +123,10 @@ static int __context_pin_state(struct i915_vma *vma)
if (err) if (err)
return 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 * And mark it as a globally pinned object to let the shrinker know
* it cannot reclaim the object until we release it. * it cannot reclaim the object until we release it.
...@@ -131,14 +135,44 @@ static int __context_pin_state(struct i915_vma *vma) ...@@ -131,14 +135,44 @@ static int __context_pin_state(struct i915_vma *vma)
vma->obj->mm.dirty = true; vma->obj->mm.dirty = true;
return 0; return 0;
err_unpin:
i915_vma_unpin(vma);
return err;
} }
static void __context_unpin_state(struct i915_vma *vma) static void __context_unpin_state(struct i915_vma *vma)
{ {
i915_vma_make_shrinkable(vma); i915_vma_make_shrinkable(vma);
i915_active_release(&vma->active);
__i915_vma_unpin(vma); __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 __i915_active_call
static void __intel_context_retire(struct i915_active *active) static void __intel_context_retire(struct i915_active *active)
{ {
...@@ -151,7 +185,7 @@ 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); __context_unpin_state(ce->state);
intel_timeline_unpin(ce->timeline); intel_timeline_unpin(ce->timeline);
intel_ring_unpin(ce->ring); __ring_retire(ce->ring);
intel_context_put(ce); intel_context_put(ce);
} }
...@@ -163,7 +197,7 @@ static int __intel_context_active(struct i915_active *active) ...@@ -163,7 +197,7 @@ static int __intel_context_active(struct i915_active *active)
intel_context_get(ce); intel_context_get(ce);
err = intel_ring_pin(ce->ring); err = __ring_active(ce->ring);
if (err) if (err)
goto err_put; goto err_put;
...@@ -183,7 +217,7 @@ static int __intel_context_active(struct i915_active *active) ...@@ -183,7 +217,7 @@ static int __intel_context_active(struct i915_active *active)
err_timeline: err_timeline:
intel_timeline_unpin(ce->timeline); intel_timeline_unpin(ce->timeline);
err_ring: err_ring:
intel_ring_unpin(ce->ring); __ring_retire(ce->ring);
err_put: err_put:
intel_context_put(ce); intel_context_put(ce);
return err; return err;
......
...@@ -3304,7 +3304,7 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt) ...@@ -3304,7 +3304,7 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt)
static void ggtt_restore_mappings(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; bool flush = false;
int open; int open;
...@@ -3319,15 +3319,12 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt) ...@@ -3319,15 +3319,12 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
open = atomic_xchg(&ggtt->vm.open, 0); open = atomic_xchg(&ggtt->vm.open, 0);
/* clflush objects bound into the GGTT and rebind them. */ /* 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; struct drm_i915_gem_object *obj = vma->obj;
if (!i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND)) if (!i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
continue; continue;
if (!__i915_vma_unbind(vma))
continue;
clear_bit(I915_VMA_GLOBAL_BIND_BIT, __i915_vma_flags(vma)); clear_bit(I915_VMA_GLOBAL_BIND_BIT, __i915_vma_flags(vma));
WARN_ON(i915_vma_bind(vma, WARN_ON(i915_vma_bind(vma,
obj ? obj->cache_level : 0, obj ? obj->cache_level : 0,
......
...@@ -1074,12 +1074,17 @@ void i915_pmu_register(struct drm_i915_private *i915) ...@@ -1074,12 +1074,17 @@ void i915_pmu_register(struct drm_i915_private *i915)
hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pmu->timer.function = i915_sample; pmu->timer.function = i915_sample;
if (!is_igp(i915)) if (!is_igp(i915)) {
pmu->name = kasprintf(GFP_KERNEL, pmu->name = kasprintf(GFP_KERNEL,
"i915-%s", "i915_%s",
dev_name(i915->drm.dev)); dev_name(i915->drm.dev));
else if (pmu->name) {
/* tools/perf reserves colons as special. */
strreplace((char *)pmu->name, ':', '_');
}
} else {
pmu->name = "i915"; pmu->name = "i915";
}
if (!pmu->name) if (!pmu->name)
goto err; goto err;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#ifndef __I915_SELFTESTS_RANDOM_H__ #ifndef __I915_SELFTESTS_RANDOM_H__
#define __I915_SELFTESTS_RANDOM_H__ #define __I915_SELFTESTS_RANDOM_H__
#include <linux/math64.h>
#include <linux/random.h> #include <linux/random.h>
#include "../i915_selftest.h" #include "../i915_selftest.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment