[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080910114755.GA9696@elte.hu>
Date: Wed, 10 Sep 2008 13:47:55 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Nick Piggin <npiggin@...e.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [patch] x86: some lock annotations for user copy paths
* Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
> On Wed, 2008-09-10 at 13:37 +0200, Nick Piggin wrote:
> > copy_to/from_user and all its variants (except the atomic ones) can take a
> > page fault and perform non-trivial work like taking mmap_sem and entering
> > the filesyste/pagecache.
> >
> > Unfortunately, this often escapes lockdep because a common pattern is to
> > use it to read in some arguments just set up from userspace, or write data
> > back to a hot buffer. In those cases, it will be unlikely for page reclaim
> > to get a window in to cause copy_*_user to fault.
> >
> > With the new might_lock primitives, add some annotations to x86. I don't
> > know if I caught all possible faulting points (it's a bit of a maze, and I
> > didn't really look at 32-bit). But this is a starting point.
> >
> > Boots and runs OK so far.
>
> shouldn't some of that be conditional on pagefault_disable() 'n such?
i dont think so - those have their own special __atomic user-copy
primitives which Nick didnt touch.
but i think it should be a single primitive sprinkled around,
might_fault(), which would be something like:
> > + might_sleep();
> > + if (current->mm)
> > + might_lock_read(¤t->mm->mmap_sem);
that way it's a lot less visually intrusive as well.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists