Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-08-07 Thread Mike Frysinger
On Wed, Jul 27, 2011 at 06:17, Peter Zijlstra wrote: > On Wed, 2011-07-27 at 11:09 +0100, David Howells wrote: >> Can you inline this for the NOMMU case please? > > --- > Subject: mm: Fix fixup_user_fault() for MMU=n > > In commit 2efaca927 ("mm/futex: fix futex writes on archs with SW > tracking o

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-28 Thread David Howells
Peter Zijlstra wrote: > Subject: mm: Fix fixup_user_fault() for MMU=n > > In commit 2efaca927 ("mm/futex: fix futex writes on archs with SW > tracking of dirty & young") we forgot about MMU=n. This patch fixes > that. > > Signed-off-by: Peter Zijlstra Acked-by: David Howells ___

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-27 Thread Mike Frysinger
On Wed, Jul 27, 2011 at 03:20, Benjamin Herrenschmidt wrote: > Hoping the BUG() isn't trippable by userspace but then it's no mmu, it's > not like we care what userspace can do right :-) side note ... common misconception that "no mmu" == "no memory protection". a few of the nommu processors have

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-27 Thread Benjamin Herrenschmidt
On Wed, 2011-07-27 at 12:17 +0200, Peter Zijlstra wrote: > On Wed, 2011-07-27 at 11:09 +0100, David Howells wrote: > > Can you inline this for the NOMMU case please? > > --- > Subject: mm: Fix fixup_user_fault() for MMU=n > > In commit 2efaca927 ("mm/futex: fix futex writes on archs with SW > tr

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-27 Thread Peter Zijlstra
On Wed, 2011-07-27 at 11:09 +0100, David Howells wrote: > Can you inline this for the NOMMU case please? --- Subject: mm: Fix fixup_user_fault() for MMU=n In commit 2efaca927 ("mm/futex: fix futex writes on archs with SW tracking of dirty & young") we forgot about MMU=n. This patch fixes that.

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-27 Thread David Howells
Peter Zijlstra wrote: > > What should nommu do anyways ? it's not like there's much it can do > > right ? It should never even hit the fault path to start with ... > > Something like the below makes a nommu arm config build.. David, is this > indeed the correct thing to do for nommu? > > --- >

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-27 Thread Peter Zijlstra
On Wed, 2011-07-27 at 17:58 +1000, Benjamin Herrenschmidt wrote: > What should nommu do anyways ? it's not like there's much it can do > right ? It should never even hit the fault path to start with ... Something like the below makes a nommu arm config build.. David, is this indeed the correct th

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-27 Thread Benjamin Herrenschmidt
On Tue, 2011-07-26 at 23:50 -0700, Mike Frysinger wrote: > On Mon, Jul 18, 2011 at 21:29, Benjamin Herrenschmidt wrote: > > The futex code currently attempts to write to user memory within > > a pagefault disabled section, and if that fails, tries to fix it > > up using get_user_pages(). > > > > Th

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-26 Thread Mike Frysinger
On Mon, Jul 18, 2011 at 21:29, Benjamin Herrenschmidt wrote: > The futex code currently attempts to write to user memory within > a pagefault disabled section, and if that fails, tries to fix it > up using get_user_pages(). > > This doesn't work on archs where the dirty and young bits are > maintai

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-21 Thread Shan Hai
On 07/22/2011 06:59 AM, Andrew Morton wrote: On Fri, 22 Jul 2011 08:52:06 +1000 Benjamin Herrenschmidt wrote: On Thu, 2011-07-21 at 15:36 -0700, Andrew Morton wrote: On Tue, 19 Jul 2011 14:29:22 +1000 Benjamin Herrenschmidt wrote: The futex code currently attempts to write to user memory w

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-21 Thread Benjamin Herrenschmidt
> You're not understanding me. > > I need a good reason to merge this into 3.0. > > The -stable maintainers need even better reasons to merge this into > earlier kernels. > > Please provide those reasons! > > (Documentation/stable_kernel_rules.txt, 4th bullet) > > (And it's not just me and -s

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-21 Thread Andrew Morton
On Fri, 22 Jul 2011 08:52:06 +1000 Benjamin Herrenschmidt wrote: > On Thu, 2011-07-21 at 15:36 -0700, Andrew Morton wrote: > > On Tue, 19 Jul 2011 14:29:22 +1000 > > Benjamin Herrenschmidt wrote: > > > > > The futex code currently attempts to write to user memory within > > > a pagefault disabl

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-21 Thread Benjamin Herrenschmidt
On Fri, 2011-07-22 at 08:52 +1000, Benjamin Herrenschmidt wrote: > > um, what problem. There's no description here of the user-visible > > effects of the bug hence it's hard to work out what kernel version(s) > > should receive this patch. > > Shan could give you an actual example (it was in the

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-21 Thread Benjamin Herrenschmidt
On Thu, 2011-07-21 at 15:36 -0700, Andrew Morton wrote: > On Tue, 19 Jul 2011 14:29:22 +1000 > Benjamin Herrenschmidt wrote: > > > The futex code currently attempts to write to user memory within > > a pagefault disabled section, and if that fails, tries to fix it > > up using get_user_pages(). >

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-21 Thread Andrew Morton
On Tue, 19 Jul 2011 14:29:22 +1000 Benjamin Herrenschmidt wrote: > The futex code currently attempts to write to user memory within > a pagefault disabled section, and if that fails, tries to fix it > up using get_user_pages(). > > This doesn't work on archs where the dirty and young bits are >

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-20 Thread Darren Hart
Obviously no objection from the futex side of things, looks good. Couple nits on the function comment: On 07/18/2011 09:29 PM, Benjamin Herrenschmidt wrote: ... > -/** > +/* > + * fixup_user_fault() - manually resolve a user page fault s/ fault/ fault/ > + * @tsk: the task_struct to use fo

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-19 Thread Peter Zijlstra
On Tue, 2011-07-19 at 14:29 +1000, Benjamin Herrenschmidt wrote: > The futex code currently attempts to write to user memory within > a pagefault disabled section, and if that fails, tries to fix it > up using get_user_pages(). > > This doesn't work on archs where the dirty and young bits are > ma

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-19 Thread Shan Hai
On 07/19/2011 03:46 PM, Benjamin Herrenschmidt wrote: On Tue, 2011-07-19 at 13:38 +0800, Shan Hai wrote: What you said is another path, that is futex_wake_op(), but what about futex_lock_pi in which my test case failed? your patch will call handle_mm_fault on every futex contention in the futex

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-19 Thread Benjamin Herrenschmidt
On Tue, 2011-07-19 at 13:38 +0800, Shan Hai wrote: > What you said is another path, that is futex_wake_op(), > but what about futex_lock_pi in which my test case failed? > your patch will call handle_mm_fault on every futex contention > in the futex_lock_pi path. > > futex_lock_pi() > ret =

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-18 Thread Shan Hai
On 07/19/2011 01:24 PM, Benjamin Herrenschmidt wrote: On Tue, 2011-07-19 at 13:17 +0800, Shan Hai wrote: The patch works, but I have certain confusions, - Do we want to handle_mm_fault on each futex_lock_pi even though in most cases there is no write permission fixup's needed? Don'

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-18 Thread Benjamin Herrenschmidt
On Tue, 2011-07-19 at 13:17 +0800, Shan Hai wrote: > The patch works, but I have certain confusions, > - Do we want to handle_mm_fault on each futex_lock_pi > even though in most cases there is no write permission > fixup's needed? Don't we only ever call this when futex_atomic_op_inuse

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-18 Thread Shan Hai
On 07/19/2011 12:29 PM, Benjamin Herrenschmidt wrote: The futex code currently attempts to write to user memory within a pagefault disabled section, and if that fails, tries to fix it up using get_user_pages(). This doesn't work on archs where the dirty and young bits are maintained by software,

Re: [RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-18 Thread Shan Hai
On 07/19/2011 12:29 PM, Benjamin Herrenschmidt wrote: The futex code currently attempts to write to user memory within a pagefault disabled section, and if that fails, tries to fix it up using get_user_pages(). This doesn't work on archs where the dirty and young bits are maintained by software,

[RFC/PATCH] mm/futex: Fix futex writes on archs with SW tracking of dirty & young

2011-07-18 Thread Benjamin Herrenschmidt
The futex code currently attempts to write to user memory within a pagefault disabled section, and if that fails, tries to fix it up using get_user_pages(). This doesn't work on archs where the dirty and young bits are maintained by software, since they will gate access permission in the TLB, and