Skip to content

Commit e33c7ba

Browse files
committed
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: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 16a8985 + 88550e1 commit e33c7ba

File tree

4 files changed

+48
-11
lines changed

4 files changed

+48
-11
lines changed

drivers/gpu/drm/i915/gt/intel_context.c

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ static int __context_pin_state(struct i915_vma *vma)
123123
if (err)
124124
return err;
125125

126+
err = i915_active_acquire(&vma->active);
127+
if (err)
128+
goto err_unpin;
129+
126130
/*
127131
* And mark it as a globally pinned object to let the shrinker know
128132
* it cannot reclaim the object until we release it.
@@ -131,14 +135,44 @@ static int __context_pin_state(struct i915_vma *vma)
131135
vma->obj->mm.dirty = true;
132136

133137
return 0;
138+
139+
err_unpin:
140+
i915_vma_unpin(vma);
141+
return err;
134142
}
135143

136144
static void __context_unpin_state(struct i915_vma *vma)
137145
{
138146
i915_vma_make_shrinkable(vma);
147+
i915_active_release(&vma->active);
139148
__i915_vma_unpin(vma);
140149
}
141150

151+
static int __ring_active(struct intel_ring *ring)
152+
{
153+
int err;
154+
155+
err = i915_active_acquire(&ring->vma->active);
156+
if (err)
157+
return err;
158+
159+
err = intel_ring_pin(ring);
160+
if (err)
161+
goto err_active;
162+
163+
return 0;
164+
165+
err_active:
166+
i915_active_release(&ring->vma->active);
167+
return err;
168+
}
169+
170+
static void __ring_retire(struct intel_ring *ring)
171+
{
172+
intel_ring_unpin(ring);
173+
i915_active_release(&ring->vma->active);
174+
}
175+
142176
__i915_active_call
143177
static void __intel_context_retire(struct i915_active *active)
144178
{
@@ -151,7 +185,7 @@ static void __intel_context_retire(struct i915_active *active)
151185
__context_unpin_state(ce->state);
152186

153187
intel_timeline_unpin(ce->timeline);
154-
intel_ring_unpin(ce->ring);
188+
__ring_retire(ce->ring);
155189

156190
intel_context_put(ce);
157191
}
@@ -163,7 +197,7 @@ static int __intel_context_active(struct i915_active *active)
163197

164198
intel_context_get(ce);
165199

166-
err = intel_ring_pin(ce->ring);
200+
err = __ring_active(ce->ring);
167201
if (err)
168202
goto err_put;
169203

@@ -183,7 +217,7 @@ static int __intel_context_active(struct i915_active *active)
183217
err_timeline:
184218
intel_timeline_unpin(ce->timeline);
185219
err_ring:
186-
intel_ring_unpin(ce->ring);
220+
__ring_retire(ce->ring);
187221
err_put:
188222
intel_context_put(ce);
189223
return err;

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,7 +3304,7 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt)
33043304

33053305
static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
33063306
{
3307-
struct i915_vma *vma, *vn;
3307+
struct i915_vma *vma;
33083308
bool flush = false;
33093309
int open;
33103310

@@ -3319,15 +3319,12 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
33193319
open = atomic_xchg(&ggtt->vm.open, 0);
33203320

33213321
/* clflush objects bound into the GGTT and rebind them. */
3322-
list_for_each_entry_safe(vma, vn, &ggtt->vm.bound_list, vm_link) {
3322+
list_for_each_entry(vma, &ggtt->vm.bound_list, vm_link) {
33233323
struct drm_i915_gem_object *obj = vma->obj;
33243324

33253325
if (!i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
33263326
continue;
33273327

3328-
if (!__i915_vma_unbind(vma))
3329-
continue;
3330-
33313328
clear_bit(I915_VMA_GLOBAL_BIND_BIT, __i915_vma_flags(vma));
33323329
WARN_ON(i915_vma_bind(vma,
33333330
obj ? obj->cache_level : 0,

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,17 @@ void i915_pmu_register(struct drm_i915_private *i915)
10741074
hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
10751075
pmu->timer.function = i915_sample;
10761076

1077-
if (!is_igp(i915))
1077+
if (!is_igp(i915)) {
10781078
pmu->name = kasprintf(GFP_KERNEL,
1079-
"i915-%s",
1079+
"i915_%s",
10801080
dev_name(i915->drm.dev));
1081-
else
1081+
if (pmu->name) {
1082+
/* tools/perf reserves colons as special. */
1083+
strreplace((char *)pmu->name, ':', '_');
1084+
}
1085+
} else {
10821086
pmu->name = "i915";
1087+
}
10831088
if (!pmu->name)
10841089
goto err;
10851090

drivers/gpu/drm/i915/selftests/i915_random.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#ifndef __I915_SELFTESTS_RANDOM_H__
2626
#define __I915_SELFTESTS_RANDOM_H__
2727

28+
#include <linux/math64.h>
2829
#include <linux/random.h>
2930

3031
#include "../i915_selftest.h"

0 commit comments

Comments
 (0)