From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: [PATCH 01/13] powerpc: Add rcu_read_lock() to gup_fast() implementation Date: Fri, 9 Apr 2010 13:11:40 +1000 Message-ID: <20100409031140.GF5683@laptop> References: <20100408191737.296180458@chello.nl> <20100408192722.643778654@chello.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from cantor2.suse.de ([195.135.220.15]:43938 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240Ab0DIDL4 (ORCPT ); Thu, 8 Apr 2010 23:11:56 -0400 Content-Disposition: inline In-Reply-To: <20100408192722.643778654@chello.nl> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Peter Zijlstra Cc: Andrea Arcangeli , Avi Kivity , Thomas Gleixner , Rik van Riel , Ingo Molnar , akpm@linux-foundation.org, Linus Torvalds , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Benjamin Herrenschmidt , David Miller , Hugh Dickins , Mel Gorman It's not wrong per se, but the entire powerpc memory management code does the IRQ disabling for its pagetable RCU code. So I think it would be better to do the whole thing in one go. I don't think Paul will surprise-break powerpc :) It's up to Ben really, though. On Thu, Apr 08, 2010 at 09:17:38PM +0200, Peter Zijlstra wrote: > The powerpc page table freeing relies on the fact that IRQs hold off > an RCU grace period, this is currently true for all existing RCU > implementations but is not an assumption Paul wants to support. > > Therefore, also take the RCU read lock along with disabling IRQs to > ensure the RCU grace period does at least cover these lookups. > > Requested-by: Paul E. McKenney > Signed-off-by: Peter Zijlstra > Cc: Nick Piggin > Cc: Benjamin Herrenschmidt > --- > arch/powerpc/mm/gup.c | 3 +++ > 1 file changed, 3 insertions(+) > > Index: linux-2.6/arch/powerpc/mm/gup.c > =================================================================== > --- linux-2.6.orig/arch/powerpc/mm/gup.c > +++ linux-2.6/arch/powerpc/mm/gup.c > @@ -142,6 +142,7 @@ int get_user_pages_fast(unsigned long st > * So long as we atomically load page table pointers versus teardown, > * we can follow the address down to the the page and take a ref on it. > */ > + rcu_read_lock(); > local_irq_disable(); > > pgdp = pgd_offset(mm, addr); > @@ -162,6 +163,7 @@ int get_user_pages_fast(unsigned long st > } while (pgdp++, addr = next, addr != end); > > local_irq_enable(); > + rcu_read_unlock(); > > VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT); > return nr; > @@ -171,6 +173,7 @@ int get_user_pages_fast(unsigned long st > > slow: > local_irq_enable(); > + rcu_read_unlock(); > slow_irqon: > pr_devel(" slow path ! nr = %d\n", nr); > >