From owner-svn-src-head@FreeBSD.ORG Sun Aug 25 15:00:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C463FD5F; Sun, 25 Aug 2013 15:00:48 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 B21B12206; Sun, 25 Aug 2013 15:00:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7PF0mcN053747; Sun, 25 Aug 2013 15:00:48 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7PF0mCq053746; Sun, 25 Aug 2013 15:00:48 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308251500.r7PF0mCq053746@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 25 Aug 2013 15:00:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254870 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Aug 2013 15:00:48 -0000 Author: dumbbell Date: Sun Aug 25 15:00:48 2013 New Revision: 254870 URL: http://svnweb.freebsd.org/changeset/base/254870 Log: drm/ttm: Make ttm_bo_wait() call uninterruptible in page fault handler This fixes a crash where a SIGLALRM, heavily used by X.Org, would interrupt the wait, causing the page fault to fail and the "Xorg" process to receive a SIGSEGV. Approved by: kib@ Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Sun Aug 25 15:00:34 2013 (r254869) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Sun Aug 25 15:00:48 2013 (r254870) @@ -154,7 +154,23 @@ reserve: mtx_lock(&bdev->fence_lock); if (test_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags)) { - ret = ttm_bo_wait(bo, false, true, false); + /* + * Here, the behavior differs between Linux and FreeBSD. + * + * On Linux, the wait is interruptible (3rd argument to + * ttm_bo_wait). There must be some mechanism to resume + * page fault handling, once the signal is processed. + * + * On FreeBSD, the wait is uninteruptible. This is not a + * problem as we can't end up with an unkillable process + * here, because the wait will eventually time out. + * + * An example of this situation is the Xorg process + * which uses SIGALRM internally. The signal could + * interrupt the wait, causing the page fault to fail + * and the process to receive SIGSEGV. + */ + ret = ttm_bo_wait(bo, false, false, false); mtx_unlock(&bdev->fence_lock); if (unlikely(ret != 0)) { retval = VM_PAGER_ERROR;