[Intel-gfx] [PATCH] drm/i915: Assert that we hold struct_mutex in i915_gem_object_create_from_data()

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 28 06:40:17 PDT 2015


Unlike the other i915_gem_object create functions, _from_data() requires
the struct_mutex as it also allocates the backing storage and so
interacts with the common lists. Document this requirement.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2039798f4403..2bf139396660 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5226,6 +5226,8 @@ i915_gem_object_create_from_data(struct drm_device *dev,
 	size_t bytes;
 	int ret;
 
+	lockdep_assert_held(&dev->struct_mutex);
+
 	obj = i915_gem_alloc_object(dev, PAGE_ALIGN(size));
 	if (IS_ERR_OR_NULL(obj))
 		return obj;
-- 
2.4.6



More information about the Intel-gfx mailing list