svn commit: r259684 - in head/sys/dev/drm2: radeon ttm
Jean-Sebastien Pedron
dumbbell at FreeBSD.org
Sat Dec 21 15:40:38 UTC 2013
Author: dumbbell
Date: Sat Dec 21 15:40:36 2013
New Revision: 259684
URL: http://svnweb.freebsd.org/changeset/base/259684
Log:
drm/ttm, drm/radeon: Replace EINTR/ERESTART by ERESTARTSYS...
... for msleep/cv_*wait() return values, where wait_event*() is used
on Linux. ERESTARTSYS is the return code expected by callers when the
operation was interrupted.
For instance, this is the case of radeon_cs_ioctl() (radeon_cs.c): if
an error occurs, and the code isn't ERESTARTSYS (eg. EINTR), it logs an
error.
Note that ERESTARTSYS is defined as ERESTART, but this keeps callers'
code close to Linux.
Submitted by: avg@ (previous version)
Modified:
head/sys/dev/drm2/radeon/radeon_fence.c
head/sys/dev/drm2/radeon/radeon_sa.c
head/sys/dev/drm2/ttm/ttm_bo.c
head/sys/dev/drm2/ttm/ttm_lock.c
Modified: head/sys/dev/drm2/radeon/radeon_fence.c
==============================================================================
--- head/sys/dev/drm2/radeon/radeon_fence.c Sat Dec 21 15:16:28 2013 (r259683)
+++ head/sys/dev/drm2/radeon/radeon_fence.c Sat Dec 21 15:40:36 2013 (r259684)
@@ -321,6 +321,8 @@ static int radeon_fence_wait_seq(struct
&rdev->fence_queue_mtx,
timeout);
}
+ if (r == EINTR)
+ r = ERESTARTSYS;
if (r != 0) {
if (r == EWOULDBLOCK) {
signaled =
@@ -334,7 +336,7 @@ static int radeon_fence_wait_seq(struct
mtx_unlock(&rdev->fence_queue_mtx);
}
radeon_irq_kms_sw_irq_put(rdev, ring);
- if (unlikely(r == EINTR || r == ERESTART)) {
+ if (unlikely(r == ERESTARTSYS)) {
return -r;
}
CTR2(KTR_DRM, "radeon fence: wait end (ring=%d, seq=%d)",
@@ -514,6 +516,8 @@ static int radeon_fence_wait_any_seq(str
&rdev->fence_queue_mtx,
timeout);
}
+ if (r == EINTR)
+ r = ERESTARTSYS;
if (r != 0) {
if (r == EWOULDBLOCK) {
signaled =
@@ -531,7 +535,7 @@ static int radeon_fence_wait_any_seq(str
radeon_irq_kms_sw_irq_put(rdev, i);
}
}
- if (unlikely(r == EINTR || r == ERESTART)) {
+ if (unlikely(r == ERESTARTSYS)) {
return -r;
}
CTR2(KTR_DRM, "radeon fence: wait end (ring=%d, target_seq=%d)",
Modified: head/sys/dev/drm2/radeon/radeon_sa.c
==============================================================================
--- head/sys/dev/drm2/radeon/radeon_sa.c Sat Dec 21 15:16:28 2013 (r259683)
+++ head/sys/dev/drm2/radeon/radeon_sa.c Sat Dec 21 15:40:36 2013 (r259684)
@@ -363,6 +363,8 @@ int radeon_sa_bo_new(struct radeon_devic
while (!radeon_sa_event(sa_manager, size, align)) {
r = -cv_wait_sig(&sa_manager->wq,
&sa_manager->wq_lock);
+ if (r == -EINTR)
+ r = -ERESTARTSYS;
if (r != 0)
break;
}
Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo.c Sat Dec 21 15:16:28 2013 (r259683)
+++ head/sys/dev/drm2/ttm/ttm_bo.c Sat Dec 21 15:40:36 2013 (r259684)
@@ -147,6 +147,8 @@ ttm_bo_wait_unreserved_locked(struct ttm
}
while (ttm_bo_is_reserved(bo)) {
ret = -msleep(bo, &bo->glob->lru_lock, flags, wmsg, 0);
+ if (ret == -EINTR)
+ ret = -ERESTARTSYS;
if (ret != 0)
break;
}
Modified: head/sys/dev/drm2/ttm/ttm_lock.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_lock.c Sat Dec 21 15:16:28 2013 (r259683)
+++ head/sys/dev/drm2/ttm/ttm_lock.c Sat Dec 21 15:40:36 2013 (r259684)
@@ -107,6 +107,8 @@ ttm_read_lock(struct ttm_lock *lock, boo
mtx_lock(&lock->lock);
while (!__ttm_read_lock(lock)) {
ret = msleep(lock, &lock->lock, flags, wmsg, 0);
+ if (ret == EINTR)
+ ret = ERESTARTSYS;
if (ret != 0)
break;
}
@@ -151,6 +153,8 @@ int ttm_read_trylock(struct ttm_lock *lo
mtx_lock(&lock->lock);
while (!__ttm_read_trylock(lock, &locked)) {
ret = msleep(lock, &lock->lock, flags, wmsg, 0);
+ if (ret == EINTR)
+ ret = ERESTARTSYS;
if (ret != 0)
break;
}
@@ -204,6 +208,8 @@ ttm_write_lock(struct ttm_lock *lock, bo
/* XXXKIB: linux uses __ttm_read_lock for uninterruptible sleeps */
while (!__ttm_write_lock(lock)) {
ret = msleep(lock, &lock->lock, flags, wmsg, 0);
+ if (ret == EINTR)
+ ret = ERESTARTSYS;
if (interruptible && ret != 0) {
lock->flags &= ~TTM_WRITE_LOCK_PENDING;
wakeup(lock);
@@ -280,6 +286,8 @@ int ttm_vt_lock(struct ttm_lock *lock,
mtx_lock(&lock->lock);
while (!__ttm_vt_lock(lock)) {
ret = msleep(lock, &lock->lock, flags, wmsg, 0);
+ if (ret == EINTR)
+ ret = ERESTARTSYS;
if (interruptible && ret != 0) {
lock->flags &= ~TTM_VT_LOCK_PENDING;
wakeup(lock);
More information about the svn-src-head
mailing list