From owner-svn-src-stable-10@FreeBSD.ORG Sun Dec 22 21:18:22 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A0D2C82A; Sun, 22 Dec 2013 21:18:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7FCA0196A; Sun, 22 Dec 2013 21:18:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBMLIMqb033327; Sun, 22 Dec 2013 21:18:22 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBMLILG9033323; Sun, 22 Dec 2013 21:18:21 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201312222118.rBMLILG9033323@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 22 Dec 2013 21:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259742 - in stable/10/sys/dev/drm2: radeon ttm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2013 21:18:22 -0000 Author: dumbbell Date: Sun Dec 22 21:18:21 2013 New Revision: 259742 URL: http://svnweb.freebsd.org/changeset/base/259742 Log: MFC r259684: 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: stable/10/sys/dev/drm2/radeon/radeon_fence.c stable/10/sys/dev/drm2/radeon/radeon_sa.c stable/10/sys/dev/drm2/ttm/ttm_bo.c stable/10/sys/dev/drm2/ttm/ttm_lock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/radeon/radeon_fence.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_fence.c Sun Dec 22 21:09:43 2013 (r259741) +++ stable/10/sys/dev/drm2/radeon/radeon_fence.c Sun Dec 22 21:18:21 2013 (r259742) @@ -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: stable/10/sys/dev/drm2/radeon/radeon_sa.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_sa.c Sun Dec 22 21:09:43 2013 (r259741) +++ stable/10/sys/dev/drm2/radeon/radeon_sa.c Sun Dec 22 21:18:21 2013 (r259742) @@ -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: stable/10/sys/dev/drm2/ttm/ttm_bo.c ============================================================================== --- stable/10/sys/dev/drm2/ttm/ttm_bo.c Sun Dec 22 21:09:43 2013 (r259741) +++ stable/10/sys/dev/drm2/ttm/ttm_bo.c Sun Dec 22 21:18:21 2013 (r259742) @@ -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: stable/10/sys/dev/drm2/ttm/ttm_lock.c ============================================================================== --- stable/10/sys/dev/drm2/ttm/ttm_lock.c Sun Dec 22 21:09:43 2013 (r259741) +++ stable/10/sys/dev/drm2/ttm/ttm_lock.c Sun Dec 22 21:18:21 2013 (r259742) @@ -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);