Commit 7d192daa authored by Chris Wilson's avatar Chris Wilson

drm/i915/gem: Give each object class a friendly name

Name the object classes and their offspring for easier lockdep
debugging.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200529183204.16850-2-chris@chris-wilson.co.uk
parent ee3fab5b
...@@ -217,6 +217,7 @@ static void i915_gem_object_put_pages_dmabuf(struct drm_i915_gem_object *obj, ...@@ -217,6 +217,7 @@ static void i915_gem_object_put_pages_dmabuf(struct drm_i915_gem_object *obj,
} }
static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_ops = { static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_ops = {
.name = "i915_gem_object_dmabuf",
.get_pages = i915_gem_object_get_pages_dmabuf, .get_pages = i915_gem_object_get_pages_dmabuf,
.put_pages = i915_gem_object_put_pages_dmabuf, .put_pages = i915_gem_object_put_pages_dmabuf,
}; };
......
...@@ -137,6 +137,7 @@ static void i915_gem_object_put_pages_internal(struct drm_i915_gem_object *obj, ...@@ -137,6 +137,7 @@ static void i915_gem_object_put_pages_internal(struct drm_i915_gem_object *obj,
} }
static const struct drm_i915_gem_object_ops i915_gem_object_internal_ops = { static const struct drm_i915_gem_object_ops i915_gem_object_internal_ops = {
.name = "i915_gem_object_internal",
.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
I915_GEM_OBJECT_IS_SHRINKABLE, I915_GEM_OBJECT_IS_SHRINKABLE,
.get_pages = i915_gem_object_get_pages_internal, .get_pages = i915_gem_object_get_pages_internal,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "i915_drv.h" #include "i915_drv.h"
const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops = { const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops = {
.name = "i915_gem_object_lmem",
.flags = I915_GEM_OBJECT_HAS_IOMEM, .flags = I915_GEM_OBJECT_HAS_IOMEM,
.get_pages = i915_gem_object_get_pages_buddy, .get_pages = i915_gem_object_get_pages_buddy,
......
...@@ -53,7 +53,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj, ...@@ -53,7 +53,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
const struct drm_i915_gem_object_ops *ops, const struct drm_i915_gem_object_ops *ops,
struct lock_class_key *key) struct lock_class_key *key)
{ {
__mutex_init(&obj->mm.lock, "obj->mm.lock", key); __mutex_init(&obj->mm.lock, ops->name ?: "obj->mm.lock", key);
spin_lock_init(&obj->vma.lock); spin_lock_init(&obj->vma.lock);
INIT_LIST_HEAD(&obj->vma.list); INIT_LIST_HEAD(&obj->vma.list);
......
...@@ -61,6 +61,8 @@ struct drm_i915_gem_object_ops { ...@@ -61,6 +61,8 @@ struct drm_i915_gem_object_ops {
int (*dmabuf_export)(struct drm_i915_gem_object *obj); int (*dmabuf_export)(struct drm_i915_gem_object *obj);
void (*release)(struct drm_i915_gem_object *obj); void (*release)(struct drm_i915_gem_object *obj);
const char *name; /* friendly name for debug, e.g. lockdep classes */
}; };
enum i915_mmap_type { enum i915_mmap_type {
......
...@@ -142,6 +142,7 @@ static void phys_release(struct drm_i915_gem_object *obj) ...@@ -142,6 +142,7 @@ static void phys_release(struct drm_i915_gem_object *obj)
} }
static const struct drm_i915_gem_object_ops i915_gem_phys_ops = { static const struct drm_i915_gem_object_ops i915_gem_phys_ops = {
.name = "i915_gem_object_phys",
.get_pages = i915_gem_object_get_pages_phys, .get_pages = i915_gem_object_get_pages_phys,
.put_pages = i915_gem_object_put_pages_phys, .put_pages = i915_gem_object_put_pages_phys,
......
...@@ -429,6 +429,7 @@ static void shmem_release(struct drm_i915_gem_object *obj) ...@@ -429,6 +429,7 @@ static void shmem_release(struct drm_i915_gem_object *obj)
} }
const struct drm_i915_gem_object_ops i915_gem_shmem_ops = { const struct drm_i915_gem_object_ops i915_gem_shmem_ops = {
.name = "i915_gem_object_shmem",
.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
I915_GEM_OBJECT_IS_SHRINKABLE, I915_GEM_OBJECT_IS_SHRINKABLE,
......
...@@ -566,6 +566,7 @@ i915_gem_object_release_stolen(struct drm_i915_gem_object *obj) ...@@ -566,6 +566,7 @@ i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
} }
static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = { static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
.name = "i915_gem_object_stolen",
.get_pages = i915_gem_object_get_pages_stolen, .get_pages = i915_gem_object_get_pages_stolen,
.put_pages = i915_gem_object_put_pages_stolen, .put_pages = i915_gem_object_put_pages_stolen,
.release = i915_gem_object_release_stolen, .release = i915_gem_object_release_stolen,
......
...@@ -700,6 +700,7 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) ...@@ -700,6 +700,7 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj)
} }
static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = { static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = {
.name = "i915_gem_object_userptr",
.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
I915_GEM_OBJECT_IS_SHRINKABLE | I915_GEM_OBJECT_IS_SHRINKABLE |
I915_GEM_OBJECT_NO_MMAP | I915_GEM_OBJECT_NO_MMAP |
......
...@@ -88,6 +88,7 @@ static void huge_put_pages(struct drm_i915_gem_object *obj, ...@@ -88,6 +88,7 @@ static void huge_put_pages(struct drm_i915_gem_object *obj,
} }
static const struct drm_i915_gem_object_ops huge_ops = { static const struct drm_i915_gem_object_ops huge_ops = {
.name = "huge-gem",
.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE, .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE,
.get_pages = huge_get_pages, .get_pages = huge_get_pages,
.put_pages = huge_put_pages, .put_pages = huge_put_pages,
......
...@@ -139,6 +139,7 @@ static void put_huge_pages(struct drm_i915_gem_object *obj, ...@@ -139,6 +139,7 @@ static void put_huge_pages(struct drm_i915_gem_object *obj,
} }
static const struct drm_i915_gem_object_ops huge_page_ops = { static const struct drm_i915_gem_object_ops huge_page_ops = {
.name = "huge-gem",
.flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
I915_GEM_OBJECT_IS_SHRINKABLE, I915_GEM_OBJECT_IS_SHRINKABLE,
.get_pages = get_huge_pages, .get_pages = get_huge_pages,
...@@ -283,12 +284,14 @@ static void fake_put_huge_pages(struct drm_i915_gem_object *obj, ...@@ -283,12 +284,14 @@ static void fake_put_huge_pages(struct drm_i915_gem_object *obj,
} }
static const struct drm_i915_gem_object_ops fake_ops = { static const struct drm_i915_gem_object_ops fake_ops = {
.name = "fake-gem",
.flags = I915_GEM_OBJECT_IS_SHRINKABLE, .flags = I915_GEM_OBJECT_IS_SHRINKABLE,
.get_pages = fake_get_huge_pages, .get_pages = fake_get_huge_pages,
.put_pages = fake_put_huge_pages, .put_pages = fake_put_huge_pages,
}; };
static const struct drm_i915_gem_object_ops fake_ops_single = { static const struct drm_i915_gem_object_ops fake_ops_single = {
.name = "fake-gem",
.flags = I915_GEM_OBJECT_IS_SHRINKABLE, .flags = I915_GEM_OBJECT_IS_SHRINKABLE,
.get_pages = fake_get_huge_pages_single, .get_pages = fake_get_huge_pages_single,
.put_pages = fake_put_huge_pages, .put_pages = fake_put_huge_pages,
......
...@@ -198,6 +198,7 @@ static void vgpu_gem_release(struct drm_i915_gem_object *gem_obj) ...@@ -198,6 +198,7 @@ static void vgpu_gem_release(struct drm_i915_gem_object *gem_obj)
} }
static const struct drm_i915_gem_object_ops intel_vgpu_gem_ops = { static const struct drm_i915_gem_object_ops intel_vgpu_gem_ops = {
.name = "i915_gem_object_vgpu",
.flags = I915_GEM_OBJECT_IS_PROXY, .flags = I915_GEM_OBJECT_IS_PROXY,
.get_pages = vgpu_gem_get_pages, .get_pages = vgpu_gem_get_pages,
.put_pages = vgpu_gem_put_pages, .put_pages = vgpu_gem_put_pages,
......
...@@ -97,6 +97,7 @@ static void fake_put_pages(struct drm_i915_gem_object *obj, ...@@ -97,6 +97,7 @@ static void fake_put_pages(struct drm_i915_gem_object *obj,
} }
static const struct drm_i915_gem_object_ops fake_ops = { static const struct drm_i915_gem_object_ops fake_ops = {
.name = "fake-gem",
.flags = I915_GEM_OBJECT_IS_SHRINKABLE, .flags = I915_GEM_OBJECT_IS_SHRINKABLE,
.get_pages = fake_get_pages, .get_pages = fake_get_pages,
.put_pages = fake_put_pages, .put_pages = fake_put_pages,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "mock_region.h" #include "mock_region.h"
static const struct drm_i915_gem_object_ops mock_region_obj_ops = { static const struct drm_i915_gem_object_ops mock_region_obj_ops = {
.name = "mock-region",
.get_pages = i915_gem_object_get_pages_buddy, .get_pages = i915_gem_object_get_pages_buddy,
.put_pages = i915_gem_object_put_pages_buddy, .put_pages = i915_gem_object_put_pages_buddy,
.release = i915_gem_object_release_memory_region, .release = i915_gem_object_release_memory_region,
......
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