From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH] add mutex to fbdev for fb_mmap locking Date: Tue, 2 Jun 2009 11:56:41 -0700 (PDT) Message-ID: References: <200905282134.n4SLYNwv027999@imap1.linux-foundation.org> <20090530121128.5f04179d.krzysztof.h1@poczta.fm> <20090531162453.dff458cb.krzysztof.h1@poczta.fm> <20090601222413.c2b57c9f.krzysztof.h1@poczta.fm> <20090602200626.1c3486e1.krzysztof.h1@poczta.fm> <20090602195240.0af2f21c@lxorguk.ukuu.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by 3yr0jf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MBZAr-0001jK-HB for linux-fbdev-devel@lists.sourceforge.net; Tue, 02 Jun 2009 18:57:25 +0000 Received: from smtp1.linux-foundation.org ([140.211.169.13]) by 1b2kzd1.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1MBZAq-0001OC-0V for linux-fbdev-devel@lists.sourceforge.net; Tue, 02 Jun 2009 18:57:25 +0000 In-Reply-To: <20090602195240.0af2f21c@lxorguk.ukuu.org.uk> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-fbdev-devel-bounces@lists.sourceforge.net To: Alan Cox Cc: krzysztof.h1@wp.pl, Linux-fbdev-devel , Peter Zijlstra , geert@linux-m68k.org, Andrew Morton , Ingo Molnar , righi.andrea@gmail.com On Tue, 2 Jun 2009, Alan Cox wrote: > > > ie the fact that the TTY layer does user-mode copies while holding some > > tty lock. So now the tty layer introduces that chain from some random lock > > to the mmap_sem. > > Its basically holding the termios lock to copy from the struct termios to > user space which means its trivial to do copy to a stack buffer first. I > can fix that pretty easily if you want. It would be good. I don't know if it matters for any other path, but mmap_sem has always been a total _bitch_ to work around for deadlocks, so it's always good to try to avoid holding another lock while doing copying to/from user. I thought we already always copied things to a buffer (for conversion reasons, ie doing the whole "ktermios<->random-user-termios-of-the-day" thing), but I guess I was wrong. Linus ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get