drm/msm/gem: Drop early returns in close/purge vma
PATCH 1/1 drm/msm/gem: Drop early returns in close/purge vma
From: Rob Clark <[email protected]>
Keep the warn, but drop the early return. If we do manage to hit this sort of issue, skipping the cleanup just makes things worse (dangling drm_mm_nodes when the msm_gem_vma is freed, etc). Whereas the worst that happens if we tear down a mapping the GPU is accessing is that we get GPU iova faults, but otherwise the world keeps spinning.
--- drivers/gpu/drm/msm/msm_gem_vma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_gem_vma.c +2 -4
@@ -62,8 +62,7 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace,unsigned size = vma->node.size;/* Print a message if we try to purge a vma in use */ -if (GEM_WARN_ON (msm_gem_vma_inuse (vma))) -return ; +GEM_WARN_ON (msm_gem_vma_inuse (vma));/* Don't do anything if the memory isn't mapped */ if (!vma->mapped)
@@ -128,8 +127,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace,void msm_gem_close_vma (struct msm_gem_address_space *aspace,struct msm_gem_vma *vma) { -if (GEM_WARN_ON (msm_gem_vma_inuse (vma) || vma->mapped)) -return ; +GEM_WARN_ON (msm_gem_vma_inuse (vma) || vma->mapped);spin_lock (&aspace->lock);if (vma->iova)
Signature · 1 line
2.36.1
Hi Rob,
Quoted 28 lines · Rob Clark
From: Rob Clark <[email protected]>
Keep the warn, but drop the early return. If we do manage to hit this sort of issue, skipping the cleanup just makes things worse (dangling
drm_mm_nodeswhen themsm_gem_vmais freed, etc). Whereas the worst that happens if we tear down a mapping the GPU is accessing is that we get GPU iova faults, but otherwise the world keeps spinning.Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/msm_gem_vma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/msm/msm_gem_vma.c +1
-2@@ -62,8 +62,7 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace,unsigned size = vma->node.size;/* Print a message if we try to purge a vma in use */ -if (GEM_WARN_ON (msm_gem_vma_inuse (vma))) -return ; +GEM_WARN_ON (msm_gem_vma_inuse (vma));/* Don't do anything if the memory isn't mapped */ if (!vma->mapped)
drivers/gpu/drm/msm/msm_gem_vma.c msm_gem_map_vma(struct msm_gem_address_space *aspace, · line 133
Quoted 9 lines
drivers/gpu/drm/msm/msm_gem_vma.c +1
-2@@ -128,8 +127,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace,void msm_gem_close_vma (struct msm_gem_address_space *aspace,struct msm_gem_vma *vma) { -if (GEM_WARN_ON (msm_gem_vma_inuse (vma) || vma->mapped)) -return ; +GEM_WARN_ON (msm_gem_vma_inuse (vma) || vma->mapped);spin_lock (&aspace->lock);if (vma->iova)
I've seen the splat on the Lenovo Yoga C630 here, and have tested this patch, and as described, the splat still happens, but the system is still able to be used.
Quoted 12 lines · Steev Klimaszewski
Hi Rob,
Quoted 8 lines · Rob Clark
From: Rob Clark <[email protected]>
Keep the warn, but drop the early return. If we do manage to hit this sort of issue, skipping the cleanup just makes things worse (dangling
drm_mm_nodeswhen themsm_gem_vmais freed, etc). Whereas the worst that happens if we tear down a mapping the GPU is accessing is that we get GPU iova faults, but otherwise the world keeps spinning.
forgot this initially:
Quoted 36 lines
Quoted 20 lines
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/msm_gem_vma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/msm/msm_gem_vma.c +1
-2@@ -62,8 +62,7 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace,unsigned size = vma->node.size;/* Print a message if we try to purge a vma in use */ -if (GEM_WARN_ON (msm_gem_vma_inuse (vma))) -return ; +GEM_WARN_ON (msm_gem_vma_inuse (vma));/* Don't do anything if the memory isn't mapped */ if (!vma->mapped)drivers/gpu/drm/msm/msm_gem_vma.c msm_gem_map_vma(struct msm_gem_address_space *aspace, · line 133
Quoted 9 lines
drivers/gpu/drm/msm/msm_gem_vma.c +1
-2@@ -128,8 +127,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace,void msm_gem_close_vma (struct msm_gem_address_space *aspace,struct msm_gem_vma *vma) { -if (GEM_WARN_ON (msm_gem_vma_inuse (vma) || vma->mapped)) -return ; +GEM_WARN_ON (msm_gem_vma_inuse (vma) || vma->mapped);spin_lock (&aspace->lock);if (vma->iova)I've seen the splat on the Lenovo Yoga C630 here, and have tested this patch, and as described, the splat still happens, but the system is still able to be used.
Tested-by Steev Klimaszewski <[email protected]>