diff mbox

[2/2] drm/i915: add lockdep_assert_held in i915_ppat_{get, put}

Message ID 1505409850-6468-2-git-send-email-zhi.a.wang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang, Zhi A Sept. 14, 2017, 5:24 p.m. UTC
struct_mutext needs to be held before call these two APIs.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chris Wilson Sept. 14, 2017, 6:39 p.m. UTC | #1
Quoting Zhi Wang (2017-09-14 18:24:10)
> struct_mutext needs to be held before call these two APIs.

True for the moment. But raises a question of whether introducing a
ppat->mutex would be beneficial? All depends on whether the caller is
already forced to use struct_mutex and is likely to continue to need it
next year...
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 37cd086..b43d3c9 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2869,6 +2869,7 @@  intel_ppat_get(struct drm_i915_private *i915, u8 value)
 	unsigned int scanned, best_score;
 	int i;
 
+	lockdep_assert_held(&i915->drm.struct_mutex);
 	GEM_BUG_ON(!ppat->max_entries);
 
 	scanned = best_score = 0;
@@ -2924,6 +2925,7 @@  void intel_ppat_put(const struct intel_ppat_entry *entry)
 	struct intel_ppat *ppat = entry->ppat;
 	unsigned int index = entry - ppat->entries;
 
+	lockdep_assert_held(&ppat->i915->drm.struct_mutex);
 	GEM_BUG_ON(!ppat->max_entries);
 
 	kref_put(&ppat->entries[index].ref, release_ppat);