diff mbox

drm/radeon: fix userptr lockup

Message ID 1430812332-13318-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König May 5, 2015, 7:52 a.m. UTC
From: Christian König <christian.koenig@amd.com>

We shouldn't try to reserve and wait for a BO that isn't bound. Otherwise
we can run into a deadlock if we have a fault during binding the BO.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_mn.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Alex Deucher May 5, 2015, 1:51 p.m. UTC | #1
On Tue, May 5, 2015 at 3:52 AM, Christian König <deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> We shouldn't try to reserve and wait for a BO that isn't bound. Otherwise
> we can run into a deadlock if we have a fault during binding the BO.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Applied to my -fixes tree.

Thanks,

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_mn.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_mn.c b/drivers/gpu/drm/radeon/radeon_mn.c
> index 535bf40..eef006c 100644
> --- a/drivers/gpu/drm/radeon/radeon_mn.c
> +++ b/drivers/gpu/drm/radeon/radeon_mn.c
> @@ -142,6 +142,9 @@ static void radeon_mn_invalidate_range_start(struct mmu_notifier *mn,
>
>                 list_for_each_entry(bo, &node->bos, mn_list) {
>
> +                       if (!bo->tbo.ttm || bo->tbo.ttm->state != tt_bound)
> +                               continue;
> +
>                         r = radeon_bo_reserve(bo, true);
>                         if (r) {
>                                 DRM_ERROR("(%ld) failed to reserve user bo\n", r);
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_mn.c b/drivers/gpu/drm/radeon/radeon_mn.c
index 535bf40..eef006c 100644
--- a/drivers/gpu/drm/radeon/radeon_mn.c
+++ b/drivers/gpu/drm/radeon/radeon_mn.c
@@ -142,6 +142,9 @@  static void radeon_mn_invalidate_range_start(struct mmu_notifier *mn,
 
 		list_for_each_entry(bo, &node->bos, mn_list) {
 
+			if (!bo->tbo.ttm || bo->tbo.ttm->state != tt_bound)
+				continue;
+
 			r = radeon_bo_reserve(bo, true);
 			if (r) {
 				DRM_ERROR("(%ld) failed to reserve user bo\n", r);