From owner-freebsd-x11@FreeBSD.ORG Tue Nov 9 14:05:22 2010 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5EBB106566C; Tue, 9 Nov 2010 14:05:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 6F47A8FC22; Tue, 9 Nov 2010 14:05:22 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oA9E5Isg009798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Nov 2010 16:05:18 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oA9E5IFp027316; Tue, 9 Nov 2010 16:05:18 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oA9E5I5b027315; Tue, 9 Nov 2010 16:05:18 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 9 Nov 2010 16:05:18 +0200 From: Kostik Belousov To: Andriy Gapon Message-ID: <20101109140518.GV2392@deviant.kiev.zoral.com.ua> References: <4CD3B1D2.30003@icyb.net.ua> <4CD7E401.1010206@freebsd.org> <20101108120403.GC2392@deviant.kiev.zoral.com.ua> <4CD9139D.9060302@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gR2gBiFPsZkfqe6l" Content-Disposition: inline In-Reply-To: <4CD9139D.9060302@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-x11@freebsd.org, freebsd-current@freebsd.org Subject: Re: radeon_cp_texture: page fault with non-sleepable locks held X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 14:05:23 -0000 --gR2gBiFPsZkfqe6l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 09, 2010 at 11:25:49AM +0200, Andriy Gapon wrote: > on 08/11/2010 14:04 Kostik Belousov said the following: > > On Mon, Nov 08, 2010 at 01:50:25PM +0200, Andriy Gapon wrote: > >> on 05/11/2010 09:27 Andriy Gapon said the following: > >>> > >>> I use FreeSBD head and KDE 4 with all the bells and whistles enabled. > >>> Apparently recent KDE update has enabled even more of them, because I= started to > >>> have panics with a kernel that has INVARIANTS and WITNESS enabled. > >> > >> I tried to solve the problem by changing drmdev from mutex to sx: > >> http://people.freebsd.org/~avg/drm-sx.diff > > I remember that drm lock can be acquired from the interrupt thread, if > > the card supports interrupts. Changing it to sx cannot work then, becau= se > > interrupt threads cannot sleep. Most likely, you are getting around it > > since r600 not yet used interrupts on FreeBSD. > >=20 > > I think the solution is to drop drm lock around copyin. >=20 > Kostik, >=20 > I looked at this some more and now I think that using sx is a step in the= right > direction. >=20 > Rationale: > 1. it seems that on Linux mutex is a sleepable lock and thus can be safel= y held > across a page fault; and Linux mutex -> FreeBSD sx seems to be a porting > technique used for kernel code before[*]. > 2. DRM interrupt code uses a different lock - irq_lock, which is locked v= ia > DRM_SPINLOCK macro (expands to FreeBSD mutex); apparently even on Linux a "even on Linux". Heh. > sleep-able lock can't be acquired in interrupt handler. >=20 > I use Linux this and Linux that as a justification, because the DRM code > apparently originated with Linux model/idioms in mind, although the origi= nal > purpose was for the code to be portable. >=20 > So, what do you think about this aspect? > Should you agree with the usage of sx, then the previous question pops ba= ck - I do not agree. > how to resolve the lock order reversal between drmdev lock and user map l= ock > (which both would be sx). Easiest would be for DRM to provide wrappers for copyin/copyout that unlock, do operation and lock. Where is the reverse order (user map -> drm) ? >=20 > [*] http://www.ukuug.org/events/eurobsdcon2009/papers/dvb_driver_paper.pdf > --=20 > Andriy Gapon --gR2gBiFPsZkfqe6l Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzZVR0ACgkQC3+MBN1Mb4igNwCdGq0Gj0h8j/rE8m/9BH7vwc9c aecAoLzwf6qiJ7K+hLQeRQ0tAU2tYuJI =574k -----END PGP SIGNATURE----- --gR2gBiFPsZkfqe6l--