Patch "drm/vc4: bo: Fix drmm_mutex_init memory hog" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/vc4: bo: Fix drmm_mutex_init memory hog

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-vc4-bo-fix-drmm_mutex_init-memory-hog.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 295de5c27d7bec7c2dd3853d63eace90d132809f
Author: Maxime Ripard <maxime@xxxxxxxxxx>
Date:   Thu Jan 12 10:12:43 2023 +0100

    drm/vc4: bo: Fix drmm_mutex_init memory hog
    
    [ Upstream commit 07a2975c65f2be2e22591d795a9c39b00f95fd11 ]
    
    Commit 374146cad469 ("drm/vc4: Switch to drmm_mutex_init") converted,
    among other functions, vc4_create_object() to use drmm_mutex_init().
    
    However, that function is used to allocate a BO, and therefore the
    mutex needs to be freed much sooner than when the DRM device is removed
    from the system.
    
    For each buffer allocation we thus end up allocating a small structure
    as part of the DRM-managed mechanism that is never freed, eventually
    leading us to no longer having any free memory anymore.
    
    Let's switch back to mutex_init/mutex_destroy to deal with it properly.
    
    Fixes: 374146cad469 ("drm/vc4: Switch to drmm_mutex_init")
    Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230112091243.490799-1-maxime@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 231add8b8e12..ab2573525d77 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -179,6 +179,7 @@ static void vc4_bo_destroy(struct vc4_bo *bo)
 		bo->validated_shader = NULL;
 	}
 
+	mutex_destroy(&bo->madv_lock);
 	drm_gem_dma_free(&bo->base);
 }
 
@@ -406,9 +407,7 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
 	bo->madv = VC4_MADV_WILLNEED;
 	refcount_set(&bo->usecnt, 0);
 
-	ret = drmm_mutex_init(dev, &bo->madv_lock);
-	if (ret)
-		return ERR_PTR(ret);
+	mutex_init(&bo->madv_lock);
 
 	mutex_lock(&vc4->bo_lock);
 	bo->label = VC4_BO_TYPE_KERNEL;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux