From patchwork Tue Apr 27 21:10:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 51102 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 5EC58B7FB8 for ; Wed, 28 Apr 2010 07:11:41 +1000 (EST) Received: by ozlabs.org (Postfix) id C9ADBB7D76; Wed, 28 Apr 2010 07:11:25 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "smtp.linux-foundation.org", Issuer "CA Cert Signing Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 6CBA4B7E2C for ; Wed, 28 Apr 2010 07:11:25 +1000 (EST) Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id o3RLAmrf020822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Apr 2010 14:10:49 -0700 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id o3RLAl7P019943; Tue, 27 Apr 2010 14:10:47 -0700 Message-Id: <201004272110.o3RLAl7P019943@imap1.linux-foundation.org> Subject: [patch 1/1] powerpc: add rcu_read_lock() to gup_fast() implementation To: benh@kernel.crashing.org From: akpm@linux-foundation.org Date: Tue, 27 Apr 2010 14:10:47 -0700 MIME-Version: 1.0 X-Spam-Status: No, hits=-3.504 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Cc: npiggin@suse.de, riel@redhat.com, a.p.zijlstra@chello.nl, linuxppc-dev@ozlabs.org, akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org From: Peter Zijlstra 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. Signed-off-by: Peter Zijlstra Requested-by: Paul E. McKenney Cc: Nick Piggin Cc: Benjamin Herrenschmidt Reviewed-by: Rik van Riel Signed-off-by: Andrew Morton --- arch/powerpc/mm/gup.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN arch/powerpc/mm/gup.c~powerpc-add-rcu_read_lock-to-gup_fast-implementation arch/powerpc/mm/gup.c --- a/arch/powerpc/mm/gup.c~powerpc-add-rcu_read_lock-to-gup_fast-implementation +++ a/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);