Commit 5cc6fbab authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie

drm/radeon: Remove tests for -ERESTART from the TTM code.

Also sets affected TTM calls up to not wait interruptible, since
that would cause an in-kernel spin until the TTM call succeeds, since
the Radeon code does not return to user-space when a signal is received.

Modifies interruptible fence waits to return -ERESTARTSYS rather than
-EBUSY when interrupted by a signal, since that's the (yet undocumented)
semantics required by the TTM sync object hooks.
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 98ffc415
...@@ -197,9 +197,8 @@ int radeon_fence_wait(struct radeon_fence *fence, bool intr) ...@@ -197,9 +197,8 @@ int radeon_fence_wait(struct radeon_fence *fence, bool intr)
r = wait_event_interruptible_timeout(rdev->fence_drv.queue, r = wait_event_interruptible_timeout(rdev->fence_drv.queue,
radeon_fence_signaled(fence), timeout); radeon_fence_signaled(fence), timeout);
radeon_irq_kms_sw_irq_put(rdev); radeon_irq_kms_sw_irq_put(rdev);
if (unlikely(r == -ERESTARTSYS)) { if (unlikely(r != 0))
return -EBUSY; return r;
}
} else { } else {
radeon_irq_kms_sw_irq_get(rdev); radeon_irq_kms_sw_irq_get(rdev);
r = wait_event_timeout(rdev->fence_drv.queue, r = wait_event_timeout(rdev->fence_drv.queue,
......
...@@ -121,16 +121,15 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, ...@@ -121,16 +121,15 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
INIT_LIST_HEAD(&bo->list); INIT_LIST_HEAD(&bo->list);
flags = radeon_ttm_flags_from_domain(domain); flags = radeon_ttm_flags_from_domain(domain);
retry: /* Kernel allocation are uninterruptible */
r = ttm_buffer_object_init(&rdev->mman.bdev, &bo->tbo, size, type, r = ttm_buffer_object_init(&rdev->mman.bdev, &bo->tbo, size, type,
flags, 0, 0, true, NULL, size, flags, 0, 0, !kernel, NULL, size,
&radeon_ttm_bo_destroy); &radeon_ttm_bo_destroy);
if (unlikely(r != 0)) { if (unlikely(r != 0)) {
if (r == -ERESTART) if (r != -ERESTARTSYS)
goto retry; dev_err(rdev->dev,
/* ttm call radeon_ttm_object_object_destroy if error happen */ "object_init failed for (%ld, 0x%08X)\n",
dev_err(rdev->dev, "object_init failed for (%ld, 0x%08X)\n", size, flags);
size, flags);
return r; return r;
} }
*bo_ptr = bo; *bo_ptr = bo;
...@@ -200,18 +199,14 @@ int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) ...@@ -200,18 +199,14 @@ int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr)
radeon_ttm_placement_from_domain(bo, domain); radeon_ttm_placement_from_domain(bo, domain);
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
retry: r = ttm_buffer_object_validate(&bo->tbo, &bo->placement, false, false);
r = ttm_buffer_object_validate(&bo->tbo, &bo->placement, true, false);
if (likely(r == 0)) { if (likely(r == 0)) {
bo->pin_count = 1; bo->pin_count = 1;
if (gpu_addr != NULL) if (gpu_addr != NULL)
*gpu_addr = radeon_bo_gpu_offset(bo); *gpu_addr = radeon_bo_gpu_offset(bo);
} }
if (unlikely(r != 0)) { if (unlikely(r != 0))
if (r == -ERESTART)
goto retry;
dev_err(bo->rdev->dev, "%p pin failed\n", bo); dev_err(bo->rdev->dev, "%p pin failed\n", bo);
}
return r; return r;
} }
...@@ -228,15 +223,10 @@ int radeon_bo_unpin(struct radeon_bo *bo) ...@@ -228,15 +223,10 @@ int radeon_bo_unpin(struct radeon_bo *bo)
return 0; return 0;
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
retry: r = ttm_buffer_object_validate(&bo->tbo, &bo->placement, false, false);
r = ttm_buffer_object_validate(&bo->tbo, &bo->placement, true, false); if (unlikely(r != 0))
if (unlikely(r != 0)) {
if (r == -ERESTART)
goto retry;
dev_err(bo->rdev->dev, "%p validate failed for unpin\n", bo); dev_err(bo->rdev->dev, "%p validate failed for unpin\n", bo);
return r; return r;
}
return 0;
} }
int radeon_bo_evict_vram(struct radeon_device *rdev) int radeon_bo_evict_vram(struct radeon_device *rdev)
...@@ -346,15 +336,11 @@ int radeon_bo_list_validate(struct list_head *head, void *fence) ...@@ -346,15 +336,11 @@ int radeon_bo_list_validate(struct list_head *head, void *fence)
radeon_ttm_placement_from_domain(bo, radeon_ttm_placement_from_domain(bo,
lobj->rdomain); lobj->rdomain);
} }
retry:
r = ttm_buffer_object_validate(&bo->tbo, r = ttm_buffer_object_validate(&bo->tbo,
&bo->placement, &bo->placement,
true, false); true, false);
if (unlikely(r)) { if (unlikely(r))
if (r == -ERESTART)
goto retry;
return r; return r;
}
} }
lobj->gpu_offset = radeon_bo_gpu_offset(bo); lobj->gpu_offset = radeon_bo_gpu_offset(bo);
lobj->tiling_flags = bo->tiling_flags; lobj->tiling_flags = bo->tiling_flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment