[PATCH 1/3] drm/xe: use devm instead of drmm for managed bo

Lucas De Marchi lucas.demarchi at intel.com
Sat Aug 10 04:39:11 UTC 2024


On Fri, Aug 09, 2024 at 04:12:35PM GMT, Daniele Ceraolo Spurio wrote:
>The BO cleanup touches the GGTT and therefore requires the HW to be
>available, so we need to use devm instead of drmm.
>
>Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1160
>Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>

this is an actual fix that we need to get in the current release. Since
the BO cleanup always touched the GGTT, I'd say:

// Fixes: 0e1a47fcabc8 ("drm/xe: Add a helper for DRM device-lifetime BO create")

Even though that patch didn't trigger any bug since it's just the helper
impl, using drmm was the wrong choice


Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

thanks
Lucas De Marchi

>Cc: Lucas De Marchi <lucas.demarchi at intel.com>
>Cc: Matthew Auld <matthew.auld at intel.com>
>---
> drivers/gpu/drm/xe/xe_bo.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
>index 3295bc92d7aa..45652d7e6fa6 100644
>--- a/drivers/gpu/drm/xe/xe_bo.c
>+++ b/drivers/gpu/drm/xe/xe_bo.c
>@@ -1576,7 +1576,7 @@ struct xe_bo *xe_bo_create_from_data(struct xe_device *xe, struct xe_tile *tile,
> 	return bo;
> }
>
>-static void __xe_bo_unpin_map_no_vm(struct drm_device *drm, void *arg)
>+static void __xe_bo_unpin_map_no_vm(void *arg)
> {
> 	xe_bo_unpin_map_no_vm(arg);
> }
>@@ -1591,7 +1591,7 @@ struct xe_bo *xe_managed_bo_create_pin_map(struct xe_device *xe, struct xe_tile
> 	if (IS_ERR(bo))
> 		return bo;
>
>-	ret = drmm_add_action_or_reset(&xe->drm, __xe_bo_unpin_map_no_vm, bo);
>+	ret = devm_add_action_or_reset(xe->drm.dev, __xe_bo_unpin_map_no_vm, bo);
> 	if (ret)
> 		return ERR_PTR(ret);
>
>@@ -1639,7 +1639,7 @@ int xe_managed_bo_reinit_in_vram(struct xe_device *xe, struct xe_tile *tile, str
> 	if (IS_ERR(bo))
> 		return PTR_ERR(bo);
>
>-	drmm_release_action(&xe->drm, __xe_bo_unpin_map_no_vm, *src);
>+	devm_release_action(xe->drm.dev, __xe_bo_unpin_map_no_vm, *src);
> 	*src = bo;
>
> 	return 0;
>-- 
>2.43.0
>


More information about the Intel-xe mailing list