Skip to contentSkip to conversation

drm/vmwgfx: Fix a buffer object eviction regression v2

PATCH In review Thomas Hellstrom 2 participants 2 messages Sep 24, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vmwgfx: Fix a buffer object eviction regression v2

Commit 4eb085e42fde ("drm/vmwgfx: Convert to new IDA API") introduced an incorrect return value from the function vmw_gmrid_man_get_node(), when we run out of integer ids. Instead of returning 0 (meaning non-fatal error) we forward the ida_simple_get error code -ENOSPC. This causes TTM not to retry allocation after buffer eviction and instead return -ENOSPC to user-space.

Fix this by returning 0 when ida_simple_get() returns other error codes than -ENOMEM:

Tested using glretrace.

---
v2: Test for -ENOMEM instead of -ENOSPC

---
 drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +1 -1
index b93c558dd86e..c1cdf6975396 100644
@@ -57,7 +57,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man,
 
 	id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
 	if (id < 0)
-		return id;
+		return (id == -ENOMEM ? -ENOMEM : 0);
 
 	spin_lock(&gman->lock);
 
Signature · 6 lines
2.19.0.rc1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thomas Hellstrom

Commit 4eb085e42fde ("drm/vmwgfx: Convert to new IDA API") introduced an incorrect return value from the function vmw_gmrid_man_get_node(), when we run out of integer ids. Instead of returning 0 (meaning non-fatal error) we forward the ida_simple_get error code -ENOSPC. This causes TTM not to retry allocation after buffer eviction and instead return -ENOSPC to user-space.

Quoted 8 lines

Fix this by returning 0 when ida_simple_get() returns other error codes than -ENOMEM:

Tested using glretrace.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel