From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756165AbZJKJZH (ORCPT ); Sun, 11 Oct 2009 05:25:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755970AbZJKJZG (ORCPT ); Sun, 11 Oct 2009 05:25:06 -0400 Received: from gate.crashing.org ([63.228.1.57]:46068 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755706AbZJKJZE (ORCPT ); Sun, 11 Oct 2009 05:25:04 -0400 Subject: Re: [patch 21/28] bkl: pushdown BKL locking to do_sysctl() From: Benjamin Herrenschmidt To: Thomas Gleixner Cc: LKML , Andrew Morton , Ingo Molnar , Peter Zijlstra , Frederic Weisbecker , Vincent Sanders , John Kacur , Jonathan Corbet , Christoph Hellwig , Tony Luck , Ralf Baechle , Martin Schwidefsky , "David S. Miller" In-Reply-To: <20091010153349.925243928@linutronix.de> References: <20091010153314.827301943@linutronix.de> <20091010153349.925243928@linutronix.de> Content-Type: text/plain; charset="UTF-8" Date: Sun, 11 Oct 2009 20:03:38 +1100 Message-Id: <1255251818.2192.34.camel@pasglop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2009-10-10 at 15:37 +0000, Thomas Gleixner wrote: > plain text document attachment (push-bkl-to-do-sysctl.patch) > Push lock/unlock_kernel() into do_sysctl() and remove it from all call > sites of do_sysctl(). > > Signed-off-by: Thomas Gleixner > Cc: Tony Luck > Cc: Ralf Baechle > Cc: Benjamin Herrenschmidt > Cc: Martin Schwidefsky > Cc: "David S. Miller" For the powerpc parts, Acked-by: Benjamin Herrenschmidt > --- > arch/ia64/ia32/sys_ia32.c | 2 -- > arch/mips/kernel/linux32.c | 2 -- > arch/parisc/kernel/sys_parisc32.c | 2 -- > arch/powerpc/kernel/sys_ppc32.c | 2 -- > arch/s390/kernel/compat_linux.c | 2 -- > arch/sparc/kernel/sys_sparc32.c | 2 -- > arch/x86/ia32/sys_ia32.c | 2 -- > kernel/sysctl.c | 6 ++++-- > 8 files changed, 4 insertions(+), 16 deletions(-) > > Index: linux-2.6-tip/arch/ia64/ia32/sys_ia32.c > =================================================================== > --- linux-2.6-tip.orig/arch/ia64/ia32/sys_ia32.c > +++ linux-2.6-tip/arch/ia64/ia32/sys_ia32.c > @@ -1670,10 +1670,8 @@ sys32_sysctl (struct sysctl32 __user *ar > return -EFAULT; > > set_fs(KERNEL_DS); > - lock_kernel(); > ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *) &oldlen, > newvalp, (size_t) a32.newlen); > - unlock_kernel(); > set_fs(old_fs); > > if (oldvalp && put_user (oldlen, (int __user *) compat_ptr(a32.oldlenp))) > Index: linux-2.6-tip/arch/mips/kernel/linux32.c > =================================================================== > --- linux-2.6-tip.orig/arch/mips/kernel/linux32.c > +++ linux-2.6-tip/arch/mips/kernel/linux32.c > @@ -302,10 +302,8 @@ SYSCALL_DEFINE1(32_sysctl, struct sysctl > oldlenp = (size_t __user *)addr; > } > > - lock_kernel(); > error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval), > oldlenp, (void __user *)A(tmp.newval), tmp.newlen); > - unlock_kernel(); > if (oldlenp) { > if (!error) { > if (get_user(oldlen, (size_t __user *)addr) || > Index: linux-2.6-tip/arch/parisc/kernel/sys_parisc32.c > =================================================================== > --- linux-2.6-tip.orig/arch/parisc/kernel/sys_parisc32.c > +++ linux-2.6-tip/arch/parisc/kernel/sys_parisc32.c > @@ -137,11 +137,9 @@ asmlinkage long sys32_sysctl(struct __sy > oldlenp = (size_t *)addr; > } > > - lock_kernel(); > error = do_sysctl((int __user *)(u64)tmp.name, tmp.nlen, > (void __user *)(u64)tmp.oldval, oldlenp, > (void __user *)(u64)tmp.newval, tmp.newlen); > - unlock_kernel(); > if (oldlenp) { > if (!error) { > if (get_user(oldlen, (size_t *)addr)) { > Index: linux-2.6-tip/arch/powerpc/kernel/sys_ppc32.c > =================================================================== > --- linux-2.6-tip.orig/arch/powerpc/kernel/sys_ppc32.c > +++ linux-2.6-tip/arch/powerpc/kernel/sys_ppc32.c > @@ -555,11 +555,9 @@ asmlinkage long compat_sys_sysctl(struct > return -EFAULT; > } > > - lock_kernel(); > error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, > compat_ptr(tmp.oldval), oldlenp, > compat_ptr(tmp.newval), tmp.newlen); > - unlock_kernel(); > if (oldlenp) { > if (!error) { > if (get_user(oldlen, oldlenp) || > Index: linux-2.6-tip/arch/s390/kernel/compat_linux.c > =================================================================== > --- linux-2.6-tip.orig/arch/s390/kernel/compat_linux.c > +++ linux-2.6-tip/arch/s390/kernel/compat_linux.c > @@ -562,10 +562,8 @@ asmlinkage long sys32_sysctl(struct __sy > oldlenp = (size_t __user *)addr; > } > > - lock_kernel(); > error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval), > oldlenp, compat_ptr(tmp.newval), tmp.newlen); > - unlock_kernel(); > if (oldlenp) { > if (!error) { > if (get_user(oldlen, (size_t __user *)addr) || > Index: linux-2.6-tip/arch/sparc/kernel/sys_sparc32.c > =================================================================== > --- linux-2.6-tip.orig/arch/sparc/kernel/sys_sparc32.c > +++ linux-2.6-tip/arch/sparc/kernel/sys_sparc32.c > @@ -627,14 +627,12 @@ asmlinkage long sys32_sysctl(struct __sy > oldlenp = (size_t __user *)addr; > } > > - lock_kernel(); > error = do_sysctl((int __user *)(unsigned long) tmp.name, > tmp.nlen, > (void __user *)(unsigned long) tmp.oldval, > oldlenp, > (void __user *)(unsigned long) tmp.newval, > tmp.newlen); > - unlock_kernel(); > if (oldlenp) { > if (!error) { > if (get_user(oldlen, (size_t __user *)addr) || > Index: linux-2.6-tip/arch/x86/ia32/sys_ia32.c > =================================================================== > --- linux-2.6-tip.orig/arch/x86/ia32/sys_ia32.c > +++ linux-2.6-tip/arch/x86/ia32/sys_ia32.c > @@ -477,10 +477,8 @@ asmlinkage long sys32_sysctl(struct sysc > return -EFAULT; > > set_fs(KERNEL_DS); > - lock_kernel(); > ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *)&oldlen, > newvalp, (size_t) a32.newlen); > - unlock_kernel(); > set_fs(old_fs); > > if (oldvalp && put_user(oldlen, (int __user *)compat_ptr(a32.oldlenp))) > Index: linux-2.6-tip/kernel/sysctl.c > =================================================================== > --- linux-2.6-tip.orig/kernel/sysctl.c > +++ linux-2.6-tip/kernel/sysctl.c > @@ -1848,6 +1848,8 @@ int do_sysctl(int __user *name, int nlen > return -EFAULT; > } > > + lock_kernel(); > + > for (head = sysctl_head_next(NULL); head; > head = sysctl_head_next(head)) { > error = parse_table(name, nlen, oldval, oldlenp, > @@ -1858,6 +1860,8 @@ int do_sysctl(int __user *name, int nlen > break; > } > } > + > + unlock_kernel(); > return error; > } > > @@ -1873,10 +1877,8 @@ SYSCALL_DEFINE1(sysctl, struct __sysctl_ > if (error) > goto out; > > - lock_kernel(); > error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp, > tmp.newval, tmp.newlen); > - unlock_kernel(); > out: > return error; > } >