bkl core patches for 2.6.33
Linus,
Please pull the latest bkl-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git bkl-core-for-linus
Thanks,
tglx
------------------>
Jonathan Corbet (2):
pm_qos: remove BKL
pm_qos: clean up racy global "name" variable
Thomas Gleixner (2):
sys: Remove BKL from sys_reboot
bkl: pushdown BKL locking to do_sysctl()
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/pm_qos_params.c | 20 ++++++++------------ kernel/sys.c | 14 +++++++------- kernel/sysctl.c | 6 ++++-- 10 files changed, 19 insertions(+), 35 deletions(-)
arch/ia64/ia32/sys_ia32.c +0 -2
@@ -1670,10 +1670,8 @@ sys32_sysctl (struct sysctl32 __user *args)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)))
arch/mips/kernel/linux32.c +0 -2
@@ -302,10 +302,8 @@ SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args) 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) ||
arch/parisc/kernel/sys_parisc32.c +0 -2
@@ -137,11 +137,9 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) 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)) {
arch/powerpc/kernel/sys_ppc32.c +0 -2
@@ -555,11 +555,9 @@ asmlinkage long compat_sys_sysctl(struct __sysctl_args32 __user *args)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) ||
arch/s390/kernel/compat_linux.c +0 -2
@@ -562,10 +562,8 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) 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) ||
arch/sparc/kernel/sys_sparc32.c +0 -2
@@ -627,14 +627,12 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) 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) ||
arch/x86/ia32/sys_ia32.c +0 -2
@@ -477,10 +477,8 @@ asmlinkage long sys32_sysctl(struct sysctl_ia32 __user *args32)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)))
kernel/pm_qos_params.c +8 -12
@@ -29,7 +29,6 @@#include <linux/pm_qos_params.h> #include <linux/sched.h> -#include <linux/smp_lock.h> #include <linux/spinlock.h> #include <linux/slab.h> #include <linux/time.h>
@@ -344,37 +343,33 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier) }EXPORT_SYMBOL_GPL (pm_qos_remove_notifier); -#define PID_NAME_LEN sizeof("process_1234567890") -static char name[PID_NAME_LEN ]; +#define PID_NAME_LEN 32static int pm_qos_power_open (struct inode *inode,struct file *filp) {int ret;long pm_qos_class; +char name[PID_NAME_LEN ]; -lock_kernel (); pm_qos_class =find_pm_qos_object_by_minor (iminor (inode));if (pm_qos_class >=0 ) { filp->private_data = (void *)pm_qos_class; -sprintf (name,"process_%d" , current->pid); +snprintf (name,PID_NAME_LEN ,"process_%d" , current->pid); ret =pm_qos_add_requirement (pm_qos_class, name,PM_QOS_DEFAULT_VALUE ); -if (ret >=0 ) { -unlock_kernel (); +if (ret >=0 )return 0 ; - } } -unlock_kernel (); -return -EPERM ; }static int pm_qos_power_release (struct inode *inode,struct file *filp) {int pm_qos_class; +char name[PID_NAME_LEN ]; pm_qos_class = (long )filp->private_data; -sprintf (name,"process_%d" , current->pid); +snprintf (name,PID_NAME_LEN ,"process_%d" , current->pid);pm_qos_remove_requirement (pm_qos_class, name);return 0 ;
@@ -385,13 +380,14 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, {s32 value;int pm_qos_class; +char name[PID_NAME_LEN ]; pm_qos_class = (long )filp->private_data;if (count !=sizeof (s32))return -EINVAL ;if (copy_from_user (&value, buf,sizeof (s32)))return -EFAULT ; -sprintf (name,"process_%d" , current->pid); +snprintf (name,PID_NAME_LEN ,"process_%d" , current->pid);pm_qos_update_requirement (pm_qos_class, name, value);return sizeof (s32);
kernel/sys.c +7 -7
@@ -8,7 +8,6 @@#include <linux/mm.h> #include <linux/utsname.h> #include <linux/mman.h> -#include <linux/smp_lock.h> #include <linux/notifier.h> #include <linux/reboot.h> #include <linux/prctl.h>
@@ -349,6 +348,9 @@ void kernel_power_off(void)machine_power_off (); }EXPORT_SYMBOL_GPL (kernel_power_off); + +static DEFINE_MUTEX (reboot_mutex); +/* * Reboot system call: for obvious reasons only root may call it, * and even root needs to set up some magic numbers in the registers
@@ -381,7 +383,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,if ((cmd ==LINUX_REBOOT_CMD_POWER_OFF ) && !pm_power_off) cmd =LINUX_REBOOT_CMD_HALT ; -lock_kernel (); +mutex_lock (&reboot_mutex);switch (cmd) {case LINUX_REBOOT_CMD_RESTART :kernel_restart (NULL );
@@ -397,20 +399,18 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,case LINUX_REBOOT_CMD_HALT :kernel_halt (); -unlock_kernel ();do_exit (0 );panic ("cannot halt" );case LINUX_REBOOT_CMD_POWER_OFF :kernel_power_off (); -unlock_kernel ();do_exit (0 );break ;case LINUX_REBOOT_CMD_RESTART2 :if (strncpy_from_user (&buffer[0 ], arg,sizeof (buffer) -1 ) <0 ) { -unlock_kernel (); -return -EFAULT ; + ret = -EFAULT ; +break ; } buffer[sizeof (buffer) -1 ] ='\0' ;
@@ -433,7 +433,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, ret = -EINVAL ;break ; } -unlock_kernel (); +mutex_unlock (&reboot_mutex);return ret; }
kernel/sysctl.c +4 -2
@@ -1848,6 +1848,8 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *olreturn -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, void __user *oldval, size_t __user *olbreak ; } } + +unlock_kernel ();return error; }
@@ -1873,10 +1877,8 @@ SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)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; }
Quoted 2 lines · Thomas Gleixner
Please pull the latest bkl-core-for-linus git tree from:
Hmm. Seeing this, I wonder: has anybody kept track of the reiserfs bkl removal?
Linus
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Thomas Gleixner
Please pull the latest bkl-core-for-linus git tree from:
Hmm. Seeing this, I wonder: has anybody kept track of the reiserfs bkl removal?
Yes, Frederic has his own git tree for that, which I reviewed and monitored. Frederic, what's the latest status ?
Thanks,
tglx
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Thomas Gleixner
Please pull the latest bkl-core-for-linus git tree from:
Hmm. Seeing this, I wonder: has anybody kept track of the reiserfs bkl removal?
Quoted 6 lines
Yes, Frederic has his own git tree for that, which I reviewed and monitored. Frederic, what's the latest status ?
Thanks,
tglx
I'm preparing the pull request :)
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Thomas Gleixner
Please pull the latest bkl-core-for-linus git tree from:
Hmm. Seeing this, I wonder: has anybody kept track of the reiserfs bkl removal?
I've Cc:-ed Frederic - he's been hacking away on it diligently, for months meanwhile. Frederic, mind posting the URI to your tree?
Ingo
Hi all,
Quoted 8 lines · On Sun, 6 Dec 2009 19:52:21 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 2 lines · Linus Torvalds
Hmm. Seeing this, I wonder: has anybody kept track of the reiserfs bkl removal?
I've Cc:-ed Frederic - he's been hacking away on it diligently, for months meanwhile. Frederic, mind posting the URI to your tree?
The tree in linus-next is:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git#reiserfs/kill-bkl
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Quoted 7 lines · Thomas Gleixner
Linus,
Please pull the latest bkl-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitbkl-core-for-linusThanks,
Was this tree in linux-next? I'm certain I would have remembered the conflict in kernel/sysctl.c. Among other things in my sysctl tree lock_kernel() is gone. The removal of lock_kernel() happened to fall out of my other changes. I remember having a conversation with Arnd Bergmann about this, and the conclusion being was that my change correct and superior to this patch. So I'm surprised a sysctl change made it into your tree.
Eric
Quoted 38 lines
kernel/sysctl.c +4
-3@@ -1848,6 +1848,8 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *olreturn -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, void __user *oldval, size_t __user *olbreak ; } } + +unlock_kernel ();return error; }@@ -1873,10 +1877,8 @@ SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)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; } --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 11 lines · Eric W. Biederman
Quoted 7 lines · Thomas Gleixner
Linus,
Please pull the latest bkl-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitbkl-core-for-linusThanks,
Quoted 7 lines
Was this tree in linux-next? I'm certain I would have remembered the conflict in
kernel/sysctl.c. Among other things in my sysctl treelock_kernel()is gone. The removal oflock_kernel()happened to fall out of my other changes. I remember having a conversation with Arnd Bergmann about this, and the conclusion being was that my change correct and superior to this patch. So I'm surprised a sysctl change made it into your tree.
Sorry, that change was excluded from next and I completely forgot about your patches when I was preparing the pull request. Zapped the commit in question already.
Thanks,
tglx
Quoted 20 lines · Thomas Gleixner
Quoted 11 lines · Eric W. Biederman
Quoted 7 lines · Thomas Gleixner
Linus,
Please pull the latest bkl-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitbkl-core-for-linusThanks,
Quoted 7 lines
Was this tree in linux-next? I'm certain I would have remembered the conflict in
kernel/sysctl.c. Among other things in my sysctl treelock_kernel()is gone. The removal oflock_kernel()happened to fall out of my other changes. I remember having a conversation with Arnd Bergmann about this, and the conclusion being was that my change correct and superior to this patch. So I'm surprised a sysctl change made it into your tree.
Quoted 3 lines
Sorry, that change was excluded from next and I completely forgot about your patches when I was preparing the pull request. Zapped the commit in question already.
Thanks. That is one less minor conflict to worry about.
Eric