From: Thomas H. <the...@vm...> - 2009-12-05 15:59:42
|
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: Thomas Hellstrom <the...@vm...> --- drivers/gpu/drm/radeon/radeon_fence.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 48 ++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 2ac3163..b23e335 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -198,7 +198,7 @@ retry: radeon_fence_signaled(fence), timeout); radeon_irq_kms_sw_irq_put(rdev); if (unlikely(r == -ERESTARTSYS)) { - return -EBUSY; + return r; } } else { radeon_irq_kms_sw_irq_get(rdev); diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index bec4943..b6637a9 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -102,13 +102,15 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, INIT_LIST_HEAD(&bo->list); flags = radeon_ttm_flags_from_domain(domain); -retry: + + /** + * FIXME: Use interruptible wait and return to + * user-space on -ERESTARTSYS. + */ r = ttm_buffer_object_init(&rdev->mman.bdev, &bo->tbo, size, type, - flags, 0, 0, true, NULL, size, + flags, 0, 0, false, NULL, size, &radeon_ttm_bo_destroy); if (unlikely(r != 0)) { - if (r == -ERESTART) - goto retry; /* ttm call radeon_ttm_object_object_destroy if error happen */ dev_err(rdev->dev, "object_init failed for (%ld, 0x%08X)\n", size, flags); @@ -184,19 +186,20 @@ int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) ttm_flag_masked(&tmp, flags, TTM_PL_MASK_MEM); bo->tbo.proposed_placement = tmp | TTM_PL_FLAG_NO_EVICT | TTM_PL_MASK_CACHING; -retry: + /** + * FIXME: Use interruptible wait and return to + * user-space on -ERESTARTSYS. + */ r = ttm_buffer_object_validate(&bo->tbo, bo->tbo.proposed_placement, - true, false); + false, false); if (likely(r == 0)) { bo->pin_count = 1; if (gpu_addr != NULL) *gpu_addr = radeon_bo_gpu_offset(bo); } - if (unlikely(r != 0)) { - if (r == -ERESTART) - goto retry; + if (unlikely(r != 0)) dev_err(bo->rdev->dev, "%p pin failed\n", bo); - } + return r; } @@ -213,12 +216,14 @@ int radeon_bo_unpin(struct radeon_bo *bo) return 0; bo->tbo.proposed_placement = bo->tbo.mem.placement & ~TTM_PL_FLAG_NO_EVICT; -retry: + + /** + * FIXME: Use interruptible wait and return to + * user-space on -ERESTARTSYS. + */ r = ttm_buffer_object_validate(&bo->tbo, bo->tbo.proposed_placement, - true, false); + false, false); if (unlikely(r != 0)) { - if (r == -ERESTART) - goto retry; dev_err(bo->rdev->dev, "%p validate failed for unpin\n", bo); return r; } @@ -332,15 +337,16 @@ int radeon_bo_list_validate(struct list_head *head, void *fence) bo->tbo.proposed_placement = radeon_ttm_flags_from_domain(lobj->rdomain); } -retry: + /** + * FIXME: Use interruptible wait and return to + * user-space on -ERESTARTSYS. + */ r = ttm_buffer_object_validate(&bo->tbo, - bo->tbo.proposed_placement, - true, false); - if (unlikely(r)) { - if (r == -ERESTART) - goto retry; + bo->tbo.proposed_placement, + false, false); + if (unlikely(r)) return r; - } + } lobj->gpu_offset = radeon_bo_gpu_offset(bo); lobj->tiling_flags = bo->tiling_flags; -- 1.5.3.2 |