diff mbox series

[RFC,1/2] drm: etnaviv: Add lockdep annotations for context lock

Message ID 7a0ea85eb081033b96a4a4fe2f0c013cca1dab9e.1603981111.git.agx@sigxcpu.org
State New, archived
Headers show
Series drm: etnaviv: Unmap gems on gem_close | expand

Commit Message

Guido Günther Oct. 29, 2020, 2:20 p.m. UTC
etnaviv_iommu_find_iova has it so etnaviv_iommu_insert_exact and
lockdep_assert_held should have it as well.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Lucas Stach Oct. 30, 2020, 2:35 p.m. UTC | #1
Am Donnerstag, den 29.10.2020, 15:20 +0100 schrieb Guido Günther:
> etnaviv_iommu_find_iova has it so etnaviv_iommu_insert_exact and
> lockdep_assert_held should have it as well.

This sounds reasonable to me. I've added this patch to my etnaviv/next
branch.

Regards,
Lucas

> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> index 3607d348c298..cd599ac04663 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> @@ -131,6 +131,8 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
>  {
>  	struct etnaviv_gem_object *etnaviv_obj = mapping->object;
>  
> +	lockdep_assert_held(&context->lock);
> +
>  	etnaviv_iommu_unmap(context, mapping->vram_node.start,
>  			    etnaviv_obj->sgt, etnaviv_obj->base.size);
>  	drm_mm_remove_node(&mapping->vram_node);
> @@ -223,6 +225,8 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context,
>  static int etnaviv_iommu_insert_exact(struct etnaviv_iommu_context *context,
>  		   struct drm_mm_node *node, size_t size, u64 va)
>  {
> +	lockdep_assert_held(&context->lock);
> +
>  	return drm_mm_insert_node_in_range(&context->mm, node, size, 0, 0, va,
>  					   va + size, DRM_MM_INSERT_LOWEST);
>  }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index 3607d348c298..cd599ac04663 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -131,6 +131,8 @@  static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
 {
 	struct etnaviv_gem_object *etnaviv_obj = mapping->object;
 
+	lockdep_assert_held(&context->lock);
+
 	etnaviv_iommu_unmap(context, mapping->vram_node.start,
 			    etnaviv_obj->sgt, etnaviv_obj->base.size);
 	drm_mm_remove_node(&mapping->vram_node);
@@ -223,6 +225,8 @@  static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context,
 static int etnaviv_iommu_insert_exact(struct etnaviv_iommu_context *context,
 		   struct drm_mm_node *node, size_t size, u64 va)
 {
+	lockdep_assert_held(&context->lock);
+
 	return drm_mm_insert_node_in_range(&context->mm, node, size, 0, 0, va,
 					   va + size, DRM_MM_INSERT_LOWEST);
 }