aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2021-08-19 10:34:18 +0100
committerMatthew Auld <matthew.auld@intel.com>2021-08-20 09:40:22 +0100
commit5359b745146aa596026addffd7843e1735db7bbd (patch)
tree67f332c02f99df8157331091556b01a3297f1d85 /drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
parentdrm/i915: Ditch the i915_gem_ww_ctx loop member (diff)
downloadlinux-dev-5359b745146aa596026addffd7843e1735db7bbd.tar.xz
linux-dev-5359b745146aa596026addffd7843e1735db7bbd.zip
drm/i915/buddy: add some pretty printing
Implement the debug hook for the buddy resource manager. For this we want to print out the status of the memory manager, including how much memory is still allocatable, what page sizes we have etc. This will be triggered when TTM is unable to fulfil an allocation request for device local-memory. v2(Thomas): - s/MB/MiB - s/KB/KiB Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210819093419.295636-1-matthew.auld@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_ttm_buddy_manager.c')
-rw-r--r--drivers/gpu/drm/i915/i915_ttm_buddy_manager.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
index 6877362f6b85..d59fbb019032 100644
--- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
+++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
@@ -126,12 +126,30 @@ static void i915_ttm_buddy_man_free(struct ttm_resource_manager *man,
kfree(bman_res);
}
+static void i915_ttm_buddy_man_debug(struct ttm_resource_manager *man,
+ struct drm_printer *printer)
+{
+ struct i915_ttm_buddy_manager *bman = to_buddy_manager(man);
+ struct i915_buddy_block *block;
+
+ mutex_lock(&bman->lock);
+ drm_printf(printer, "default_page_size: %lluKiB\n",
+ bman->default_page_size >> 10);
+
+ i915_buddy_print(&bman->mm, printer);
+
+ drm_printf(printer, "reserved:\n");
+ list_for_each_entry(block, &bman->reserved, link)
+ i915_buddy_block_print(&bman->mm, block, printer);
+ mutex_unlock(&bman->lock);
+}
+
static const struct ttm_resource_manager_func i915_ttm_buddy_manager_func = {
.alloc = i915_ttm_buddy_man_alloc,
.free = i915_ttm_buddy_man_free,
+ .debug = i915_ttm_buddy_man_debug,
};
-
/**
* i915_ttm_buddy_man_init - Setup buddy allocator based ttm manager
* @bdev: The ttm device