Skip to content

Commit f4708c1

Browse files
committed
drm/vmwgfx: Add a debug callback to mobid resource manager
Mob/GMR id resource manager was lacking the debug print callback which meant that during memory errors we weren't getting the details which are needed to fix those errors. Kernel logs need to contain the information about used/max pages by the Mob/GMR id resource manager as well as the maximum number of id's they're allowed to allocate. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Martin Krastev <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8aadeb8 commit f4708c1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct vmwgfx_gmrid_man {
4242
uint32_t max_gmr_ids;
4343
uint32_t max_gmr_pages;
4444
uint32_t used_gmr_pages;
45+
uint8_t type;
4546
};
4647

4748
static struct vmwgfx_gmrid_man *to_gmrid_manager(struct ttm_resource_manager *man)
@@ -132,6 +133,18 @@ static void vmw_gmrid_man_put_node(struct ttm_resource_manager *man,
132133
kfree(res);
133134
}
134135

136+
static void vmw_gmrid_man_debug(struct ttm_resource_manager *man,
137+
struct drm_printer *printer)
138+
{
139+
struct vmwgfx_gmrid_man *gman = to_gmrid_manager(man);
140+
141+
BUG_ON(gman->type != VMW_PL_GMR && gman->type != VMW_PL_MOB);
142+
143+
drm_printf(printer, "%s's used: %u pages, max: %u pages, %u id's\n",
144+
(gman->type == VMW_PL_MOB) ? "Mob" : "GMR",
145+
gman->used_gmr_pages, gman->max_gmr_pages, gman->max_gmr_ids);
146+
}
147+
135148
static const struct ttm_resource_manager_func vmw_gmrid_manager_func;
136149

137150
int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type)
@@ -146,12 +159,12 @@ int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type)
146159
man = &gman->manager;
147160

148161
man->func = &vmw_gmrid_manager_func;
149-
/* TODO: This is most likely not correct */
150162
man->use_tt = true;
151163
ttm_resource_manager_init(man, 0);
152164
spin_lock_init(&gman->lock);
153165
gman->used_gmr_pages = 0;
154166
ida_init(&gman->gmr_ida);
167+
gman->type = type;
155168

156169
switch (type) {
157170
case VMW_PL_GMR:
@@ -190,4 +203,5 @@ void vmw_gmrid_man_fini(struct vmw_private *dev_priv, int type)
190203
static const struct ttm_resource_manager_func vmw_gmrid_manager_func = {
191204
.alloc = vmw_gmrid_man_get_node,
192205
.free = vmw_gmrid_man_put_node,
206+
.debug = vmw_gmrid_man_debug
193207
};

0 commit comments

Comments
 (0)