diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2009-12-07 12:36:18 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-10 00:09:03 -0500 |
commit | 98ffc4158e12008102cb6ae242a7fc46f9243f0d (patch) | |
tree | fa8b231281fac87afe88ab9a0539c6ab5cdc2100 /drivers/gpu | |
parent | 312ea8da049a1830aa50c6e00002e50e30df476e (diff) |
drm/ttm: Have the TTM code return -ERESTARTSYS instead of -ERESTART.
Return -ERESTARTSYS instead of -ERESTART when interrupted by a signal.
The -ERESTARTSYS is converted to an -EINTR by the kernel signal layer
before returned to user-space.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_vm.c | 7 |
2 files changed, 12 insertions, 24 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 60d8179a8bcd..640fb265dd5a 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -125,7 +125,7 @@ int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, bool interruptible) | |||
125 | ret = wait_event_interruptible(bo->event_queue, | 125 | ret = wait_event_interruptible(bo->event_queue, |
126 | atomic_read(&bo->reserved) == 0); | 126 | atomic_read(&bo->reserved) == 0); |
127 | if (unlikely(ret != 0)) | 127 | if (unlikely(ret != 0)) |
128 | return -ERESTART; | 128 | return ret; |
129 | } else { | 129 | } else { |
130 | wait_event(bo->event_queue, atomic_read(&bo->reserved) == 0); | 130 | wait_event(bo->event_queue, atomic_read(&bo->reserved) == 0); |
131 | } | 131 | } |
@@ -571,7 +571,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, | |||
571 | spin_unlock(&bo->lock); | 571 | spin_unlock(&bo->lock); |
572 | 572 | ||
573 | if (unlikely(ret != 0)) { | 573 | if (unlikely(ret != 0)) { |
574 | if (ret != -ERESTART) { | 574 | if (ret != -ERESTARTSYS) { |
575 | printk(KERN_ERR TTM_PFX | 575 | printk(KERN_ERR TTM_PFX |
576 | "Failed to expire sync object before " | 576 | "Failed to expire sync object before " |
577 | "buffer eviction.\n"); | 577 | "buffer eviction.\n"); |
@@ -588,7 +588,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, | |||
588 | ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible, | 588 | ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible, |
589 | no_wait); | 589 | no_wait); |
590 | if (ret) { | 590 | if (ret) { |
591 | if (ret != -ERESTART) | 591 | if (ret != -ERESTARTSYS) |
592 | printk(KERN_ERR TTM_PFX | 592 | printk(KERN_ERR TTM_PFX |
593 | "Failed to find memory space for " | 593 | "Failed to find memory space for " |
594 | "buffer 0x%p eviction.\n", bo); | 594 | "buffer 0x%p eviction.\n", bo); |
@@ -598,7 +598,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, | |||
598 | ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, | 598 | ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, |
599 | no_wait); | 599 | no_wait); |
600 | if (ret) { | 600 | if (ret) { |
601 | if (ret != -ERESTART) | 601 | if (ret != -ERESTARTSYS) |
602 | printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); | 602 | printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); |
603 | spin_lock(&glob->lru_lock); | 603 | spin_lock(&glob->lru_lock); |
604 | if (evict_mem.mm_node) { | 604 | if (evict_mem.mm_node) { |
@@ -795,7 +795,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
795 | uint32_t cur_flags = 0; | 795 | uint32_t cur_flags = 0; |
796 | bool type_found = false; | 796 | bool type_found = false; |
797 | bool type_ok = false; | 797 | bool type_ok = false; |
798 | bool has_eagain = false; | 798 | bool has_erestartsys = false; |
799 | struct drm_mm_node *node = NULL; | 799 | struct drm_mm_node *node = NULL; |
800 | int i, ret; | 800 | int i, ret; |
801 | 801 | ||
@@ -882,28 +882,21 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
882 | mem->mm_node->private = bo; | 882 | mem->mm_node->private = bo; |
883 | return 0; | 883 | return 0; |
884 | } | 884 | } |
885 | if (ret == -ERESTART) | 885 | if (ret == -ERESTARTSYS) |
886 | has_eagain = true; | 886 | has_erestartsys = true; |
887 | } | 887 | } |
888 | ret = (has_eagain) ? -ERESTART : -ENOMEM; | 888 | ret = (has_erestartsys) ? -ERESTARTSYS : -ENOMEM; |
889 | return ret; | 889 | return ret; |
890 | } | 890 | } |
891 | EXPORT_SYMBOL(ttm_bo_mem_space); | 891 | EXPORT_SYMBOL(ttm_bo_mem_space); |
892 | 892 | ||
893 | int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait) | 893 | int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait) |
894 | { | 894 | { |
895 | int ret = 0; | ||
896 | |||
897 | if ((atomic_read(&bo->cpu_writers) > 0) && no_wait) | 895 | if ((atomic_read(&bo->cpu_writers) > 0) && no_wait) |
898 | return -EBUSY; | 896 | return -EBUSY; |
899 | 897 | ||
900 | ret = wait_event_interruptible(bo->event_queue, | 898 | return wait_event_interruptible(bo->event_queue, |
901 | atomic_read(&bo->cpu_writers) == 0); | 899 | atomic_read(&bo->cpu_writers) == 0); |
902 | |||
903 | if (ret == -ERESTARTSYS) | ||
904 | ret = -ERESTART; | ||
905 | |||
906 | return ret; | ||
907 | } | 900 | } |
908 | 901 | ||
909 | int ttm_bo_move_buffer(struct ttm_buffer_object *bo, | 902 | int ttm_bo_move_buffer(struct ttm_buffer_object *bo, |
@@ -1673,7 +1666,7 @@ int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible, | |||
1673 | ret = wait_event_interruptible | 1666 | ret = wait_event_interruptible |
1674 | (bo->event_queue, atomic_read(&bo->reserved) == 0); | 1667 | (bo->event_queue, atomic_read(&bo->reserved) == 0); |
1675 | if (unlikely(ret != 0)) | 1668 | if (unlikely(ret != 0)) |
1676 | return -ERESTART; | 1669 | return ret; |
1677 | } else { | 1670 | } else { |
1678 | wait_event(bo->event_queue, | 1671 | wait_event(bo->event_queue, |
1679 | atomic_read(&bo->reserved) == 0); | 1672 | atomic_read(&bo->reserved) == 0); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 1c040d040338..609a85a4d855 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c | |||
@@ -114,7 +114,7 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
114 | ret = ttm_bo_wait(bo, false, true, false); | 114 | ret = ttm_bo_wait(bo, false, true, false); |
115 | spin_unlock(&bo->lock); | 115 | spin_unlock(&bo->lock); |
116 | if (unlikely(ret != 0)) { | 116 | if (unlikely(ret != 0)) { |
117 | retval = (ret != -ERESTART) ? | 117 | retval = (ret != -ERESTARTSYS) ? |
118 | VM_FAULT_SIGBUS : VM_FAULT_NOPAGE; | 118 | VM_FAULT_SIGBUS : VM_FAULT_NOPAGE; |
119 | goto out_unlock; | 119 | goto out_unlock; |
120 | } | 120 | } |
@@ -349,9 +349,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | |||
349 | switch (ret) { | 349 | switch (ret) { |
350 | case 0: | 350 | case 0: |
351 | break; | 351 | break; |
352 | case -ERESTART: | ||
353 | ret = -EINTR; | ||
354 | goto out_unref; | ||
355 | case -EBUSY: | 352 | case -EBUSY: |
356 | ret = -EAGAIN; | 353 | ret = -EAGAIN; |
357 | goto out_unref; | 354 | goto out_unref; |
@@ -421,8 +418,6 @@ ssize_t ttm_bo_fbdev_io(struct ttm_buffer_object *bo, const char __user *wbuf, | |||
421 | switch (ret) { | 418 | switch (ret) { |
422 | case 0: | 419 | case 0: |
423 | break; | 420 | break; |
424 | case -ERESTART: | ||
425 | return -EINTR; | ||
426 | case -EBUSY: | 421 | case -EBUSY: |
427 | return -EAGAIN; | 422 | return -EAGAIN; |
428 | default: | 423 | default: |