linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: krzysztof.h1@wp.pl,
	Linux-fbdev-devel <linux-fbdev-devel@lists.sourceforge.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	geert@linux-m68k.org, akpm@linux-foundation.org,
	Ingo Molnar <mingo@elte.hu>,
	righi.andrea@gmail.com
Subject: Re: [PATCH] add mutex to fbdev for fb_mmap locking
Date: Mon, 1 Jun 2009 13:38:40 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0906011329400.3435@localhost.localdomain> (raw)
In-Reply-To: <20090601222413.c2b57c9f.krzysztof.h1@poczta.fm>



On Mon, 1 Jun 2009, Krzysztof Helt wrote:
> 
> I will fix it. 

Thanks.

> If the revert to BKL is rejected this patch may wait till 2.6.31.

Ahh, so this one helps clean up locking, but doesn't fix any actual 
regressions? I was going to ask you about that.

Btw - one thing you could try on the whole lockdep front - and I realize 
that this is a _total_ hack - is to try the patch below.

The _only_ thing it does is to hide the sysfs_mutex -> mm_lock chain from 
lockdep, by using the (incorrect) __copy_to_user_inatomic() instead of the 
(correct) copy_to_user(). But I'd like to hear if that sysfs_mutex in 
readdir is the only way you can get a chain.

So this is in _no_ way meant to be a serious patch, and is literally just 
a test to see if "ok, readdir and sysfs_mutex is really the only real 
deadlock case" is true. Or are there possibly other cases that trigger 
this?

Because if it's really just this chain through sysfs_mutex, then the 
deadlock scenario should boil down to just the "two different fbcon's and 
really unlucky activity just as you register the second of them". Which is 
still a bug, of course - it's just not ever going to bite anybody in 
practice.

		Linus

---
 fs/readdir.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/readdir.c b/fs/readdir.c
index 7723401..431f647 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -172,7 +172,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
 		goto efault;
 	if (__put_user(reclen, &dirent->d_reclen))
 		goto efault;
-	if (copy_to_user(dirent->d_name, name, namlen))
+	if (__copy_to_user_inatomic(dirent->d_name, name, namlen))
 		goto efault;
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;
@@ -256,7 +256,7 @@ static int filldir64(void * __buf, const char * name, int namlen, loff_t offset,
 		goto efault;
 	if (__put_user(d_type, &dirent->d_type))
 		goto efault;
-	if (copy_to_user(dirent->d_name, name, namlen))
+	if (__copy_to_user_inatomic(dirent->d_name, name, namlen))
 		goto efault;
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;

------------------------------------------------------------------------------
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

  reply	other threads:[~2009-06-01 20:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200905282134.n4SLYNwv027999@imap1.linux-foundation.org>
     [not found] ` <alpine.LFD.2.01.0905290820510.3435@localhost.localdomain>
     [not found]   ` <20090530121128.5f04179d.krzysztof.h1@poczta.fm>
     [not found]     ` <alpine.LFD.2.01.0905300805350.3435@localhost.localdomain>
2009-05-31 14:24       ` [PATCH] add mutex to fbdev for fb_mmap locking Krzysztof Helt
2009-05-31 17:09         ` Linus Torvalds
2009-06-01 20:24           ` Krzysztof Helt
2009-06-01 20:38             ` Linus Torvalds [this message]
2009-06-01 20:45               ` Ingo Molnar
2009-06-02 15:09               ` Krzysztof Helt
2009-06-02 18:06               ` Krzysztof Helt
2009-06-02 18:13                 ` Linus Torvalds
2009-06-02 18:52                   ` Alan Cox
2009-06-02 18:56                     ` Linus Torvalds
2009-06-02 19:11                       ` Linus Torvalds
2009-06-02 19:36                         ` Alan Cox
2009-06-02 19:51                           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.01.0906011329400.3435@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=krzysztof.h1@poczta.fm \
    --cc=krzysztof.h1@wp.pl \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=mingo@elte.hu \
    --cc=righi.andrea@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).