[PATCH -fixes 5/5] drm/vmwgfx: Fix a buffer object eviction regression

Thomas Hellstrom thellstrom at vmware.com
Thu Sep 13 11:58:37 UTC 2018


Commit 4eb085e42fde ("drm/vmwgfx: Convert to new IDA API") indroduced
an incorrect return value from the function vmw_gmrid_man_get_node(),
when we run out if 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 -ENOSPC.

Tested using glretrace.

Cc: Matthew Wilcox <willy at infradead.org>
Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Deepak Rawat <drawat at vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index b93c558dd86e..a38a0c3777f7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -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 == -ENOSPC ? 0 : id);
 
 	spin_lock(&gman->lock);
 
-- 
2.19.0.rc1



More information about the dri-devel mailing list