linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] BKL removal, assorted patches
@ 2010-07-03 22:02 Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 1/8] do_coredump: do not take BKL Arnd Bergmann
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann, Bob Picco,
	Clemens Ladisch, Geert Uytterhoeven, Heiko Carstens,
	Jaroslav Kysela, Jesse Barnes, linux-pci, linux-s390,
	Martin Schwidefsky, Takashi Iwai, Tejun Heo

These patches are necessary for the removal of the
big kernel lock but don't fit in any other series.

The most important one is the addition of the
CONFIG_BKL Kconfig symbol, which can be used
to mark device drivers that are still using the
BKL so we can build a kernel that does not provide
or need it.

I'd like to add this series to linux-next and
submit it for linux-2.6.36 inclusion, but
would even more welcome the individual maintainers
to pick up the respective patches and put them
in their next trees.

	Arnd

Cc: Bob Picco <bob.picco@hp.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: linux-pci@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Tejun Heo <tj@kernel.org>


Arnd Bergmann (7):
  do_coredump: do not take BKL
  init: remove the BKL from startup code
  hpet: kill BKL, add compat_ioctl
  proc/pci: kill BKL
  dasd: no need for BKL in ioctl
  isapnp: BKL removal
  BKL: introduce CONFIG_BKL.

John Kacur (1):
  soundcore_open: Reduce the area BKL coverage

 drivers/char/Kconfig            |    2 +-
 drivers/char/hpet.c             |   98 +++++++++++++++++++++++++-------------
 drivers/gpu/drm/Kconfig         |    5 +-
 drivers/hid/usbhid/Kconfig      |    2 +-
 drivers/isdn/Kconfig            |    1 +
 drivers/isdn/capi/Kconfig       |    2 +-
 drivers/isdn/mISDN/Kconfig      |    1 +
 drivers/media/Kconfig           |    3 +-
 drivers/misc/Kconfig            |    2 +-
 drivers/net/appletalk/Kconfig   |    1 +
 drivers/pci/proc.c              |    4 +-
 drivers/pnp/isapnp/proc.c       |   13 +++--
 drivers/s390/block/dasd_ioctl.c |   17 +------
 drivers/sbus/char/Kconfig       |    2 +-
 drivers/staging/sep/Kconfig     |    2 +-
 drivers/staging/usbip/Kconfig   |    2 +-
 drivers/usb/gadget/Kconfig      |    2 +-
 fs/Kconfig                      |    1 +
 fs/adfs/Kconfig                 |    1 +
 fs/afs/Kconfig                  |    1 +
 fs/autofs/Kconfig               |    1 +
 fs/autofs4/Kconfig              |    1 +
 fs/coda/Kconfig                 |    1 +
 fs/ecryptfs/Kconfig             |    1 +
 fs/exec.c                       |    6 --
 fs/fat/Kconfig                  |    2 +
 fs/freevxfs/Kconfig             |    1 +
 fs/hpfs/Kconfig                 |    1 +
 fs/isofs/Kconfig                |    1 +
 fs/jffs2/Kconfig                |    1 +
 fs/ncpfs/Kconfig                |    1 +
 fs/nfs/Kconfig                  |    2 +-
 fs/nfsd/Kconfig                 |    1 +
 fs/ocfs2/Kconfig                |    1 +
 fs/qnx4/Kconfig                 |    1 +
 fs/reiserfs/Kconfig             |    1 +
 fs/smbfs/Kconfig                |    1 +
 fs/squashfs/Kconfig             |    2 +-
 fs/udf/Kconfig                  |    1 +
 fs/ufs/Kconfig                  |    2 +-
 include/linux/smp_lock.h        |    7 ++-
 init/Kconfig                    |    2 +-
 init/main.c                     |    5 --
 kernel/trace/trace.c            |    8 ---
 lib/Kconfig.debug               |   14 +++++-
 net/ipx/Kconfig                 |    1 +
 net/irda/Kconfig                |    2 +-
 net/irda/irnet/Kconfig          |    2 +-
 net/x25/Kconfig                 |    2 +-
 sound/oss/Kconfig               |    2 +-
 sound/sound_core.c              |   13 +++--
 51 files changed, 145 insertions(+), 104 deletions(-)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/8] do_coredump: do not take BKL
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-07-09 23:25   ` Frederic Weisbecker
  2010-07-03 22:02 ` [PATCH 2/8] init: remove the BKL from startup code Arnd Bergmann
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann

core_pattern is not actually protected and hasn't been
ever since we introduced procfs support for sysctl -- a
_long_ time. Don't take it here either.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/exec.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index e19de6a..3d7aeeb 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1891,13 +1891,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 	 */
 	clear_thread_flag(TIF_SIGPENDING);
 
-	/*
-	 * lock_kernel() because format_corename() is controlled by sysctl, which
-	 * uses lock_kernel()
-	 */
- 	lock_kernel();
 	ispipe = format_corename(corename, signr);
-	unlock_kernel();
 
  	if (ispipe) {
 		int dump_count;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/8] init: remove the BKL from startup code
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 1/8] do_coredump: do not take BKL Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-07-09  3:52   ` Frederic Weisbecker
  2010-07-09 13:37   ` Frederic Weisbecker
  2010-07-03 22:02 ` [PATCH 3/8] hpet: kill BKL, add compat_ioctl Arnd Bergmann
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann

I have shown by code review that no driver takes
the BKL at init time any more, so whatever the
init code was locking against is no longer there
and it is now safe to remove the BKL there.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Steven Rostedt <rostedt@goodmis>
---
 init/main.c          |    5 -----
 kernel/trace/trace.c |    8 --------
 2 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/init/main.c b/init/main.c
index a42fdf4..9b34c1b 100644
--- a/init/main.c
+++ b/init/main.c
@@ -444,7 +444,6 @@ static noinline void __init_refok rest_init(void)
 	kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
 	rcu_read_unlock();
 	complete(&kthreadd_done);
-	unlock_kernel();
 
 	/*
 	 * The boot idle thread must execute schedule()
@@ -565,7 +564,6 @@ asmlinkage void __init start_kernel(void)
  * Interrupts are still disabled. Do necessary setups, then
  * enable them
  */
-	lock_kernel();
 	tick_init();
 	boot_cpu_init();
 	page_address_init();
@@ -829,7 +827,6 @@ static noinline int init_post(void)
 	/* need to finish all async __init code before freeing the memory */
 	async_synchronize_full();
 	free_initmem();
-	unlock_kernel();
 	mark_rodata_ro();
 	system_state = SYSTEM_RUNNING;
 	numa_default_policy();
@@ -869,8 +866,6 @@ static int __init kernel_init(void * unused)
 	 * Wait until kthreadd is all set-up.
 	 */
 	wait_for_completion(&kthreadd_done);
-	lock_kernel();
-
 	/*
 	 * init can allocate pages on any node
 	 */
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 086d363..8047ca5 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -734,13 +734,6 @@ __acquires(kernel_lock)
 		return -1;
 	}
 
-	/*
-	 * When this gets called we hold the BKL which means that
-	 * preemption is disabled. Various trace selftests however
-	 * need to disable and enable preemption for successful tests.
-	 * So we drop the BKL here and grab it after the tests again.
-	 */
-	unlock_kernel();
 	mutex_lock(&trace_types_lock);
 
 	tracing_selftest_running = true;
@@ -822,7 +815,6 @@ __acquires(kernel_lock)
 #endif
 
  out_unlock:
-	lock_kernel();
 	return ret;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/8] hpet: kill BKL, add compat_ioctl
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 1/8] do_coredump: do not take BKL Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 2/8] init: remove the BKL from startup code Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 4/8] proc/pci: kill BKL Arnd Bergmann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann, Clemens Ladisch,
	Bob Picco

hpet uses the big kernel lock in its ioctl and open
functions. Replace this with a private mutex to be
sure. Since we're already touching the ioctl function,
add the compat_ioctl version as well -- all commands
except HPET_INFO are compatible and that one is easy
to add.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Bob Picco <bob.picco@hp.com>
---
 drivers/char/hpet.c |   98 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 64 insertions(+), 34 deletions(-)

diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index a0a1829..a4eee32 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -30,6 +30,7 @@
 #include <linux/bcd.h>
 #include <linux/seq_file.h>
 #include <linux/bitops.h>
+#include <linux/compat.h>
 #include <linux/clocksource.h>
 #include <linux/slab.h>
 
@@ -67,6 +68,7 @@
 #define	read_counter(MC)	readl(MC)
 #endif
 
+static DEFINE_MUTEX(hpet_mutex); /* replaces BKL */
 static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ;
 
 /* This clocksource driver currently only works on ia64 */
@@ -250,7 +252,7 @@ static int hpet_open(struct inode *inode, struct file *file)
 	if (file->f_mode & FMODE_WRITE)
 		return -EINVAL;
 
-	lock_kernel();
+	mutex_lock(&hpet_mutex);
 	spin_lock_irq(&hpet_lock);
 
 	for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next)
@@ -264,7 +266,7 @@ static int hpet_open(struct inode *inode, struct file *file)
 
 	if (!devp) {
 		spin_unlock_irq(&hpet_lock);
-		unlock_kernel();
+		mutex_unlock(&hpet_mutex);
 		return -EBUSY;
 	}
 
@@ -272,7 +274,7 @@ static int hpet_open(struct inode *inode, struct file *file)
 	devp->hd_irqdata = 0;
 	devp->hd_flags |= HPET_OPEN;
 	spin_unlock_irq(&hpet_lock);
-	unlock_kernel();
+	mutex_unlock(&hpet_mutex);
 
 	hpet_timer_set_irq(devp);
 
@@ -429,22 +431,6 @@ static int hpet_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static int hpet_ioctl_common(struct hpet_dev *, int, unsigned long, int);
-
-static long hpet_ioctl(struct file *file, unsigned int cmd,
-			unsigned long arg)
-{
-	struct hpet_dev *devp;
-	int ret;
-
-	devp = file->private_data;
-	lock_kernel();
-	ret = hpet_ioctl_common(devp, cmd, arg, 0);
-	unlock_kernel();
-
-	return ret;
-}
-
 static int hpet_ioctl_ieon(struct hpet_dev *devp)
 {
 	struct hpet_timer __iomem *timer;
@@ -553,7 +539,8 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
 }
 
 static int
-hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
+hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg,
+		  struct hpet_info *info)
 {
 	struct hpet_timer __iomem *timer;
 	struct hpet __iomem *hpet;
@@ -594,23 +581,15 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
 		break;
 	case HPET_INFO:
 		{
-			struct hpet_info info;
-
 			if (devp->hd_ireqfreq)
-				info.hi_ireqfreq =
+				info->hi_ireqfreq =
 					hpet_time_div(hpetp, devp->hd_ireqfreq);
 			else
-				info.hi_ireqfreq = 0;
-			info.hi_flags =
+				info->hi_ireqfreq = 0;
+			info->hi_flags =
 			    readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
-			info.hi_hpet = hpetp->hp_which;
-			info.hi_timer = devp - hpetp->hp_dev;
-			if (kernel)
-				memcpy((void *)arg, &info, sizeof(info));
-			else
-				if (copy_to_user((void __user *)arg, &info,
-						 sizeof(info)))
-					err = -EFAULT;
+			info->hi_hpet = hpetp->hp_which;
+			info->hi_timer = devp - hpetp->hp_dev;
 			break;
 		}
 	case HPET_EPI:
@@ -636,7 +615,7 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
 		devp->hd_flags &= ~HPET_PERIODIC;
 		break;
 	case HPET_IRQFREQ:
-		if (!kernel && (arg > hpet_max_freq) &&
+		if ((arg > hpet_max_freq) &&
 		    !capable(CAP_SYS_RESOURCE)) {
 			err = -EACCES;
 			break;
@@ -653,12 +632,63 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
 	return err;
 }
 
+static long
+hpet_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	struct hpet_info info;
+	int err;
+
+	mutex_lock(&hpet_mutex);
+	err = hpet_ioctl_common(file->private_data, cmd, arg, &info);
+	mutex_unlock(&hpet_mutex);
+
+	if ((cmd == HPET_INFO) && !err &&
+	    (copy_to_user((void __user *)arg, &info, sizeof(info))))
+		err = -EFAULT;
+
+	return err;
+}
+
+#ifdef CONFIG_COMPAT
+struct compat_hpet_info {
+	compat_ulong_t hi_ireqfreq;	/* Hz */
+	compat_ulong_t hi_flags;	/* information */
+	unsigned short hi_hpet;
+	unsigned short hi_timer;
+};
+
+static long
+hpet_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	struct hpet_info info;
+	int err;
+
+	mutex_lock(&hpet_mutex);
+	err = hpet_ioctl_common(file->private_data, cmd, arg, &info);
+	mutex_unlock(&hpet_mutex);
+
+	if ((cmd == HPET_INFO) && !err) {
+		struct compat_hpet_info __user *u = compat_ptr(arg);
+		if (put_user(info.hi_ireqfreq, &u->hi_ireqfreq) ||
+		    put_user(info.hi_flags, &u->hi_flags) ||
+		    put_user(info.hi_hpet, &u->hi_hpet) ||
+		    put_user(info.hi_timer, &u->hi_timer))
+			err = -EFAULT;
+	}
+
+	return err;
+}
+#endif
+
 static const struct file_operations hpet_fops = {
 	.owner = THIS_MODULE,
 	.llseek = no_llseek,
 	.read = hpet_read,
 	.poll = hpet_poll,
 	.unlocked_ioctl = hpet_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = hpet_compat_ioctl,
+#endif
 	.open = hpet_open,
 	.release = hpet_release,
 	.fasync = hpet_fasync,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/8] proc/pci: kill BKL
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
                   ` (2 preceding siblings ...)
  2010-07-03 22:02 ` [PATCH 3/8] hpet: kill BKL, add compat_ioctl Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-08-13 23:33   ` Jesse Barnes
  2010-07-03 22:02 ` [PATCH 5/8] dasd: no need for BKL in ioctl Arnd Bergmann
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann, Jesse Barnes,
	Tejun Heo, linux-pci

All operations in the pci procfs ioctl functions are
atomic, so no lock is needed here.

Also add a compat_ioctl method, since all the commands
are compatible in 32 bit mode.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-pci@vger.kernel.org
---
 drivers/pci/proc.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 449e890..35b80c7 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -212,8 +212,6 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 #endif /* HAVE_PCI_MMAP */
 	int ret = 0;
 
-	lock_kernel();
-
 	switch (cmd) {
 	case PCIIOC_CONTROLLER:
 		ret = pci_domain_nr(dev->bus);
@@ -242,7 +240,6 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		break;
 	};
 
-	unlock_kernel();
 	return ret;
 }
 
@@ -306,6 +303,7 @@ static const struct file_operations proc_bus_pci_operations = {
 	.read		= proc_bus_pci_read,
 	.write		= proc_bus_pci_write,
 	.unlocked_ioctl	= proc_bus_pci_ioctl,
+	.compat_ioctl	= proc_bus_pci_ioctl,
 #ifdef HAVE_PCI_MMAP
 	.open		= proc_bus_pci_open,
 	.release	= proc_bus_pci_release,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/8] dasd: no need for BKL in ioctl
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
                   ` (3 preceding siblings ...)
  2010-07-03 22:02 ` [PATCH 4/8] proc/pci: kill BKL Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 6/8] isapnp: BKL removal Arnd Bergmann
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann,
	Martin Schwidefsky, Heiko Carstens, linux-s390

The dasd driver does not need the BKL, so we can
remove it here as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
---
 drivers/s390/block/dasd_ioctl.c |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index 1557214..26075e9 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -16,7 +16,6 @@
 #include <linux/major.h>
 #include <linux/fs.h>
 #include <linux/blkpg.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <asm/compat.h>
 #include <asm/ccwdev.h>
@@ -370,9 +369,8 @@ static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd,
 	return ret;
 }
 
-static int
-dasd_do_ioctl(struct block_device *bdev, fmode_t mode,
-	      unsigned int cmd, unsigned long arg)
+int dasd_ioctl(struct block_device *bdev, fmode_t mode,
+	       unsigned int cmd, unsigned long arg)
 {
 	struct dasd_block *block = bdev->bd_disk->private_data;
 	void __user *argp;
@@ -430,14 +428,3 @@ dasd_do_ioctl(struct block_device *bdev, fmode_t mode,
 		return -EINVAL;
 	}
 }
-
-int dasd_ioctl(struct block_device *bdev, fmode_t mode,
-	       unsigned int cmd, unsigned long arg)
-{
-	int rc;
-
-	lock_kernel();
-	rc = dasd_do_ioctl(bdev, mode, cmd, arg);
-	unlock_kernel();
-	return rc;
-}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/8] isapnp: BKL removal
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
                   ` (4 preceding siblings ...)
  2010-07-03 22:02 ` [PATCH 5/8] dasd: no need for BKL in ioctl Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 7/8] soundcore_open: Reduce the area BKL coverage Arnd Bergmann
  2010-07-03 22:02 ` [PATCH 8/8] BKL: introduce CONFIG_BKL Arnd Bergmann
  7 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann,
	Geert Uytterhoeven, Jaroslav Kysela

Remove BKL use from isapnp_proc_bus_lseek(), like was done for
proc_bus_pci_lseek() a long time ago and recently for Zorro
by Geert Uytterhoeven.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jaroslav Kysela <perex@perex.cz>
---
 drivers/pnp/isapnp/proc.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index 3f94eda..4249999 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -31,8 +31,9 @@ static struct proc_dir_entry *isapnp_proc_bus_dir = NULL;
 static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
 {
 	loff_t new = -1;
+	struct inode *inode = file->f_path.dentry->d_inode;
 
-	lock_kernel();
+	mutex_lock(&inode->i_mutex);
 	switch (whence) {
 	case 0:
 		new = off;
@@ -45,11 +46,11 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
 		break;
 	}
 	if (new < 0 || new > 256) {
-		unlock_kernel();
-		return -EINVAL;
-	}
-	unlock_kernel();
-	return (file->f_pos = new);
+		new = -EINVAL;
+	else
+		file->f_pos = new;
+	mutex_unlock(&inode->i_mutex);
+	return new;
 }
 
 static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 7/8] soundcore_open: Reduce the area BKL coverage
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
                   ` (5 preceding siblings ...)
  2010-07-03 22:02 ` [PATCH 6/8] isapnp: BKL removal Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  2010-07-05 16:09   ` Takashi Iwai
  2010-07-03 22:02 ` [PATCH 8/8] BKL: introduce CONFIG_BKL Arnd Bergmann
  7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann, Takashi Iwai

From: John Kacur <jkacur@redhat.com>

Most of this function is protected by the sound_loader_lock.
We can push down the BKL to this call out err = file->f_op->open(inode,file);

In order to build the sound core without the BKL, we
will need to push the lock_kernel() call into the ~20
device drivers that register their file operations.

Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Cox <alan@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
---
 sound/sound_core.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/sound_core.c b/sound/sound_core.c
index 7c2d677..c8627fc 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -576,8 +576,6 @@ static int soundcore_open(struct inode *inode, struct file *file)
 	struct sound_unit *s;
 	const struct file_operations *new_fops = NULL;
 
-	lock_kernel ();
-
 	chain=unit&0x0F;
 	if(chain==4 || chain==5)	/* dsp/audio/dsp16 */
 	{
@@ -630,18 +628,23 @@ static int soundcore_open(struct inode *inode, struct file *file)
 		const struct file_operations *old_fops = file->f_op;
 		file->f_op = new_fops;
 		spin_unlock(&sound_loader_lock);
-		if(file->f_op->open)
+
+		if (file->f_op->open) {
+			/* TODO: push down BKL into indivial open functions */
+			lock_kernel();
 			err = file->f_op->open(inode,file);
+			unlock_kernel();
+		}
+
 		if (err) {
 			fops_put(file->f_op);
 			file->f_op = fops_get(old_fops);
 		}
+
 		fops_put(old_fops);
-		unlock_kernel();
 		return err;
 	}
 	spin_unlock(&sound_loader_lock);
-	unlock_kernel();
 	return -ENODEV;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 8/8] BKL: introduce CONFIG_BKL.
  2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
                   ` (6 preceding siblings ...)
  2010-07-03 22:02 ` [PATCH 7/8] soundcore_open: Reduce the area BKL coverage Arnd Bergmann
@ 2010-07-03 22:02 ` Arnd Bergmann
  7 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2010-07-03 22:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Kacur, Frederic Weisbecker, Arnd Bergmann

To make it possible to build a kernel without the
big kernel lock, we need to make sure we don't
build any code that still uses it, so disable
the options in Kconfig.

Most of the v4l, drm and oss drivers still need
it too, but their respective top-level interfaces
get disabled here, so we don't need to list them
separately.

For now, the option is invisible, which will change
as soon as all dependencies have been merged.
As of 2.6.35-rc3, this includes patch series for
block and vfs super_operations as well as the final
removal of the BKL from the ioctl and llseek path
in VFS.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/Kconfig          |    2 +-
 drivers/gpu/drm/Kconfig       |    5 +++--
 drivers/hid/usbhid/Kconfig    |    2 +-
 drivers/isdn/Kconfig          |    1 +
 drivers/isdn/capi/Kconfig     |    2 +-
 drivers/isdn/mISDN/Kconfig    |    1 +
 drivers/media/Kconfig         |    3 ++-
 drivers/misc/Kconfig          |    2 +-
 drivers/net/appletalk/Kconfig |    1 +
 drivers/sbus/char/Kconfig     |    2 +-
 drivers/staging/sep/Kconfig   |    2 +-
 drivers/staging/usbip/Kconfig |    2 +-
 drivers/usb/gadget/Kconfig    |    2 +-
 fs/Kconfig                    |    1 +
 fs/adfs/Kconfig               |    1 +
 fs/afs/Kconfig                |    1 +
 fs/autofs/Kconfig             |    1 +
 fs/autofs4/Kconfig            |    1 +
 fs/coda/Kconfig               |    1 +
 fs/ecryptfs/Kconfig           |    1 +
 fs/fat/Kconfig                |    2 ++
 fs/freevxfs/Kconfig           |    1 +
 fs/hpfs/Kconfig               |    1 +
 fs/isofs/Kconfig              |    1 +
 fs/jffs2/Kconfig              |    1 +
 fs/ncpfs/Kconfig              |    1 +
 fs/nfs/Kconfig                |    2 +-
 fs/nfsd/Kconfig               |    1 +
 fs/ocfs2/Kconfig              |    1 +
 fs/qnx4/Kconfig               |    1 +
 fs/reiserfs/Kconfig           |    1 +
 fs/smbfs/Kconfig              |    1 +
 fs/squashfs/Kconfig           |    2 +-
 fs/udf/Kconfig                |    1 +
 fs/ufs/Kconfig                |    2 +-
 include/linux/smp_lock.h      |    7 +++++--
 init/Kconfig                  |    2 +-
 lib/Kconfig.debug             |   14 +++++++++++++-
 net/ipx/Kconfig               |    1 +
 net/irda/Kconfig              |    2 +-
 net/irda/irnet/Kconfig        |    2 +-
 net/x25/Kconfig               |    2 +-
 sound/oss/Kconfig             |    2 +-
 43 files changed, 63 insertions(+), 22 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 7cfcc62..40cc670 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -129,7 +129,7 @@ config SERIAL_NONSTANDARD
 
 config COMPUTONE
 	tristate "Computone IntelliPort Plus serial support"
-	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
+	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) && BKL
 	---help---
 	  This driver supports the entire family of Intelliport II/Plus
 	  controllers with the exception of the MicroChannel controllers and
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 88910e5..f59e263 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -6,7 +6,7 @@
 #
 menuconfig DRM
 	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
-	depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG && MMU
+	depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG && MMU && BKL
 	select I2C
 	select I2C_ALGOBIT
 	select SLOW_WORK
@@ -72,7 +72,7 @@ source "drivers/gpu/drm/radeon/Kconfig"
 
 config DRM_I810
 	tristate "Intel I810"
-	depends on DRM && AGP && AGP_INTEL
+	depends on DRM && AGP && AGP_INTEL && BKL
 	help
 	  Choose this option if you have an Intel I810 graphics card.  If M is
 	  selected, the module will be called i810.  AGP support is required
@@ -85,6 +85,7 @@ choice
 
 config DRM_I830
 	tristate "i830 driver"
+	depends on BKL
 	help
 	  Choose this option if you have a system that has Intel 830M, 845G,
 	  852GM, 855GM or 865G integrated graphics.  If M is selected, the
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 4edb3be..deee423 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -4,7 +4,7 @@ comment "USB Input Devices"
 config USB_HID
 	tristate "USB Human Interface Device (full HID) support"
 	default y
-	depends on USB && INPUT
+	depends on USB && INPUT && BKL
 	select HID
 	---help---
 	  Say Y here if you want full HID support to connect USB keyboards,
diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index 4fb6016..ecf58c5 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -22,6 +22,7 @@ if ISDN
 
 menuconfig ISDN_I4L
 	tristate "Old ISDN4Linux (deprecated)"
+	depends on BKL
 	---help---
 	  This driver allows you to use an ISDN adapter for networking
 	  connections and as dialin/out device.  The isdn-tty's have a built
diff --git a/drivers/isdn/capi/Kconfig b/drivers/isdn/capi/Kconfig
index a168e8a..bb40d8d 100644
--- a/drivers/isdn/capi/Kconfig
+++ b/drivers/isdn/capi/Kconfig
@@ -35,7 +35,7 @@ config ISDN_CAPI_CAPI20
 
 config ISDN_CAPI_CAPIFS_BOOL
 	bool "CAPI2.0 filesystem support (DEPRECATED)"
-	depends on ISDN_CAPI_MIDDLEWARE && ISDN_CAPI_CAPI20
+	depends on ISDN_CAPI_MIDDLEWARE && ISDN_CAPI_CAPI20 && BKL
 	help
 	  This option provides a special file system, similar to /dev/pts with
 	  device nodes for the special ttys established by using the
diff --git a/drivers/isdn/mISDN/Kconfig b/drivers/isdn/mISDN/Kconfig
index 1747a02..ba4fbd9 100644
--- a/drivers/isdn/mISDN/Kconfig
+++ b/drivers/isdn/mISDN/Kconfig
@@ -4,6 +4,7 @@
 
 menuconfig MISDN
 	tristate "Modular ISDN driver"
+	depends on BKL
 	help
 	  Enable support for the modular ISDN driver.
 
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index a28541b..95d2a8b 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -19,6 +19,7 @@ comment "Multimedia core support"
 
 config VIDEO_DEV
 	tristate "Video For Linux"
+	depends on BKL
 	---help---
 	  V4L core support for video capture and overlay devices, webcams and
 	  AM/FM radio cards.
@@ -75,7 +76,7 @@ config VIDEO_V4L1_COMPAT
 
 config DVB_CORE
 	tristate "DVB for Linux"
-	depends on NET && INET
+	depends on NET && INET && BKL
 	select CRC32
 	help
 	  DVB core utility functions for device handling, software fallbacks etc.
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 26386a9..a79d8d2 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -263,7 +263,7 @@ config HP_ILO
 
 config SGI_GRU
 	tristate "SGI GRU driver"
-	depends on X86_UV && SMP
+	depends on X86_UV && SMP && BKL
 	default n
 	select MMU_NOTIFIER
 	---help---
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig
index 0a0e0cd..04fa1e7 100644
--- a/drivers/net/appletalk/Kconfig
+++ b/drivers/net/appletalk/Kconfig
@@ -3,6 +3,7 @@
 #
 config ATALK
 	tristate "Appletalk protocol support"
+	depends on BKL
 	select LLC
 	---help---
 	  AppleTalk is the protocol that Apple computers can use to communicate
diff --git a/drivers/sbus/char/Kconfig b/drivers/sbus/char/Kconfig
index 73cde85..b0272e2 100644
--- a/drivers/sbus/char/Kconfig
+++ b/drivers/sbus/char/Kconfig
@@ -31,7 +31,7 @@ config TADPOLE_TS102_UCTRL
 
 config SUN_JSFLASH
 	tristate "JavaStation OS Flash SIMM (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && SPARC32
+	depends on EXPERIMENTAL && SPARC32 && BKL
 	help
 	  If you say Y here, you will be able to boot from your JavaStation's
 	  Flash memory.
diff --git a/drivers/staging/sep/Kconfig b/drivers/staging/sep/Kconfig
index 0a9c39c..ae1e181 100644
--- a/drivers/staging/sep/Kconfig
+++ b/drivers/staging/sep/Kconfig
@@ -1,7 +1,7 @@
 config DX_SEP
 	tristate "Discretix SEP driver"
 #	depends on MRST
-	depends on RAR_REGISTER && PCI
+	depends on RAR_REGISTER && PCI && BKL
 	default y
 	help
 	  Discretix SEP driver
diff --git a/drivers/staging/usbip/Kconfig b/drivers/staging/usbip/Kconfig
index 2c1d10a..b11ec37 100644
--- a/drivers/staging/usbip/Kconfig
+++ b/drivers/staging/usbip/Kconfig
@@ -1,6 +1,6 @@
 config USB_IP_COMMON
 	tristate "USB IP support (EXPERIMENTAL)"
-	depends on USB && NET && EXPERIMENTAL
+	depends on USB && NET && EXPERIMENTAL && BKL
 	default N
 	---help---
 	  This enables pushing USB packets over IP to allow remote
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 591ae9f..39a80c6 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -697,7 +697,7 @@ config USB_ETH_EEM
 
 config USB_GADGETFS
 	tristate "Gadget Filesystem (EXPERIMENTAL)"
-	depends on EXPERIMENTAL
+	depends on EXPERIMENTAL && BKL
 	help
 	  This driver provides a filesystem based API that lets user mode
 	  programs implement a single-configuration USB device, including
diff --git a/fs/Kconfig b/fs/Kconfig
index 5f85b59..ba772ef 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -49,6 +49,7 @@ endif # BLOCK
 
 config FILE_LOCKING
 	bool "Enable POSIX file locking API" if EMBEDDED
+	depends on BKL
 	default y
 	help
 	  This option enables standard file locking support, required
diff --git a/fs/adfs/Kconfig b/fs/adfs/Kconfig
index e55182a..d72c786 100644
--- a/fs/adfs/Kconfig
+++ b/fs/adfs/Kconfig
@@ -1,6 +1,7 @@
 config ADFS_FS
 	tristate "ADFS file system support (EXPERIMENTAL)"
 	depends on BLOCK && EXPERIMENTAL
+	depends on BKL
 	help
 	  The Acorn Disc Filing System is the standard file system of the
 	  RiscOS operating system which runs on Acorn's ARM-based Risc PC
diff --git a/fs/afs/Kconfig b/fs/afs/Kconfig
index 5c4e61d..0874017 100644
--- a/fs/afs/Kconfig
+++ b/fs/afs/Kconfig
@@ -1,6 +1,7 @@
 config AFS_FS
 	tristate "Andrew File System support (AFS) (EXPERIMENTAL)"
 	depends on INET && EXPERIMENTAL
+	depends on BKL
 	select AF_RXRPC
 	help
 	  If you say Y here, you will get an experimental Andrew File System
diff --git a/fs/autofs/Kconfig b/fs/autofs/Kconfig
index 5f3bea9..9126a42 100644
--- a/fs/autofs/Kconfig
+++ b/fs/autofs/Kconfig
@@ -1,5 +1,6 @@
 config AUTOFS_FS
 	tristate "Kernel automounter support"
+	depends on BKL
 	help
 	  The automounter is a tool to automatically mount remote file systems
 	  on demand. This implementation is partially kernel-based to reduce
diff --git a/fs/autofs4/Kconfig b/fs/autofs4/Kconfig
index 1204d63..06831b5 100644
--- a/fs/autofs4/Kconfig
+++ b/fs/autofs4/Kconfig
@@ -1,5 +1,6 @@
 config AUTOFS4_FS
 	tristate "Kernel automounter version 4 support (also supports v3)"
+	depends on BKL
 	help
 	  The automounter is a tool to automatically mount remote file systems
 	  on demand. This implementation is partially kernel-based to reduce
diff --git a/fs/coda/Kconfig b/fs/coda/Kconfig
index c0e5a7f..8689de8 100644
--- a/fs/coda/Kconfig
+++ b/fs/coda/Kconfig
@@ -1,6 +1,7 @@
 config CODA_FS
 	tristate "Coda file system support (advanced network fs)"
 	depends on INET
+	depends on BKL
 	help
 	  Coda is an advanced network file system, similar to NFS in that it
 	  enables you to mount file systems of a remote server and access them
diff --git a/fs/ecryptfs/Kconfig b/fs/ecryptfs/Kconfig
index 1cd6d9d..2e8660f 100644
--- a/fs/ecryptfs/Kconfig
+++ b/fs/ecryptfs/Kconfig
@@ -1,6 +1,7 @@
 config ECRYPT_FS
 	tristate "eCrypt filesystem layer support (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && KEYS && CRYPTO
+	depends on BKL
 	select CRYPTO_ECB
 	select CRYPTO_CBC
 	select CRYPTO_MD5
diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig
index 182f9ff..c4777ea 100644
--- a/fs/fat/Kconfig
+++ b/fs/fat/Kconfig
@@ -34,6 +34,7 @@ config FAT_FS
 
 config MSDOS_FS
 	tristate "MSDOS fs support"
+	depends on BKL
 	select FAT_FS
 	help
 	  This allows you to mount MSDOS partitions of your hard drive (unless
@@ -59,6 +60,7 @@ config MSDOS_FS
 
 config VFAT_FS
 	tristate "VFAT (Windows-95) fs support"
+	depends on BKL
 	select FAT_FS
 	help
 	  This option provides support for normal Windows file systems with
diff --git a/fs/freevxfs/Kconfig b/fs/freevxfs/Kconfig
index 8dc1cd5..aba5cb5 100644
--- a/fs/freevxfs/Kconfig
+++ b/fs/freevxfs/Kconfig
@@ -1,6 +1,7 @@
 config VXFS_FS
 	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
 	depends on BLOCK
+	depends on BKL
 	help
 	  FreeVxFS is a file system driver that support the VERITAS VxFS(TM)
 	  file system format.  VERITAS VxFS(TM) is the standard file system
diff --git a/fs/hpfs/Kconfig b/fs/hpfs/Kconfig
index 56bd15c..1012579 100644
--- a/fs/hpfs/Kconfig
+++ b/fs/hpfs/Kconfig
@@ -1,6 +1,7 @@
 config HPFS_FS
 	tristate "OS/2 HPFS file system support"
 	depends on BLOCK
+	depends on BKL
 	help
 	  OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
 	  is the file system used for organizing files on OS/2 hard disk
diff --git a/fs/isofs/Kconfig b/fs/isofs/Kconfig
index 8ab9878..2c45a34 100644
--- a/fs/isofs/Kconfig
+++ b/fs/isofs/Kconfig
@@ -1,5 +1,6 @@
 config ISO9660_FS
 	tristate "ISO 9660 CDROM file system support"
+	depends on BKL
 	help
 	  This is the standard file system used on CD-ROMs.  It was previously
 	  known as "High Sierra File System" and is called "hsfs" on other
diff --git a/fs/jffs2/Kconfig b/fs/jffs2/Kconfig
index 6ae169c..d13b148 100644
--- a/fs/jffs2/Kconfig
+++ b/fs/jffs2/Kconfig
@@ -1,6 +1,7 @@
 config JFFS2_FS
 	tristate "Journalling Flash File System v2 (JFFS2) support"
 	select CRC32
+	depends on BKL
 	depends on MTD
 	help
 	  JFFS2 is the second generation of the Journalling Flash File System
diff --git a/fs/ncpfs/Kconfig b/fs/ncpfs/Kconfig
index c931cf2..d0ed28d 100644
--- a/fs/ncpfs/Kconfig
+++ b/fs/ncpfs/Kconfig
@@ -3,6 +3,7 @@
 #
 config NCP_FS
 	tristate "NCP file system support (to mount NetWare volumes)"
+	depends on BKL
 	depends on IPX!=n || INET
 	help
 	  NCP (NetWare Core Protocol) is a protocol that runs over IPX and is
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index a43d07e..16ab92c 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -1,6 +1,6 @@
 config NFS_FS
 	tristate "NFS client support"
-	depends on INET && FILE_LOCKING
+	depends on INET && FILE_LOCKING && BKL
 	select LOCKD
 	select SUNRPC
 	select NFS_ACL_SUPPORT if NFS_V3_ACL
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
index 503b9da..afdf7ce 100644
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -2,6 +2,7 @@ config NFSD
 	tristate "NFS server support"
 	depends on INET
 	depends on FILE_LOCKING
+	depends on BKL
 	select LOCKD
 	select SUNRPC
 	select EXPORTFS
diff --git a/fs/ocfs2/Kconfig b/fs/ocfs2/Kconfig
index 0d84066..11b66d0 100644
--- a/fs/ocfs2/Kconfig
+++ b/fs/ocfs2/Kconfig
@@ -1,5 +1,6 @@
 config OCFS2_FS
 	tristate "OCFS2 file system support"
+	depends on BKL
 	depends on NET && SYSFS
 	select CONFIGFS_FS
 	select JBD2
diff --git a/fs/qnx4/Kconfig b/fs/qnx4/Kconfig
index 5f60899..4fae4a9 100644
--- a/fs/qnx4/Kconfig
+++ b/fs/qnx4/Kconfig
@@ -1,5 +1,6 @@
 config QNX4FS_FS
 	tristate "QNX4 file system support (read only)"
+	depends on BKL
 	depends on BLOCK
 	help
 	  This is the file system used by the real-time operating systems
diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig
index 513f431..d9ac7c5 100644
--- a/fs/reiserfs/Kconfig
+++ b/fs/reiserfs/Kconfig
@@ -1,5 +1,6 @@
 config REISERFS_FS
 	tristate "Reiserfs support"
+	depends on BKL
 	select CRC32
 	help
 	  Stores not just filenames but the files themselves in a balanced
diff --git a/fs/smbfs/Kconfig b/fs/smbfs/Kconfig
index e668127..5361221 100644
--- a/fs/smbfs/Kconfig
+++ b/fs/smbfs/Kconfig
@@ -1,5 +1,6 @@
 config SMB_FS
 	tristate "SMB file system support (OBSOLETE, please use CIFS)"
+	depends on BKL
 	depends on INET
 	select NLS
 	help
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index cc6ce8a..26fcaf3 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -1,6 +1,6 @@
 config SQUASHFS
 	tristate "SquashFS 4.0 - Squashed file system support"
-	depends on BLOCK
+	depends on BLOCK && BKL
 	select ZLIB_INFLATE
 	help
 	  Saying Y here includes support for SquashFS 4.0 (a Compressed
diff --git a/fs/udf/Kconfig b/fs/udf/Kconfig
index 0e0e99b..b344257 100644
--- a/fs/udf/Kconfig
+++ b/fs/udf/Kconfig
@@ -1,5 +1,6 @@
 config UDF_FS
 	tristate "UDF file system support"
+	depends on BKL
 	select CRC_ITU_T
 	help
 	  This is the new file system used on some CD-ROMs and DVDs. Say Y if
diff --git a/fs/ufs/Kconfig b/fs/ufs/Kconfig
index e4f10a4..7f1410f 100644
--- a/fs/ufs/Kconfig
+++ b/fs/ufs/Kconfig
@@ -1,6 +1,6 @@
 config UFS_FS
 	tristate "UFS file system support (read only)"
-	depends on BLOCK
+	depends on BLOCK && BKL
 	help
 	  BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
 	  OpenBSD and NeXTstep) use a file system called UFS. Some System V
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index 2ea1dd1..291f721 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -54,12 +54,15 @@ static inline void cycle_kernel_lock(void)
 
 #else
 
+#ifdef CONFIG_BKL /* provoke build bug if not set */
 #define lock_kernel()
 #define unlock_kernel()
-#define release_kernel_lock(task)		do { } while(0)
 #define cycle_kernel_lock()			do { } while(0)
-#define reacquire_kernel_lock(task)		0
 #define kernel_locked()				1
+#endif /* CONFIG_BKL */
+
+#define release_kernel_lock(task)		do { } while(0)
+#define reacquire_kernel_lock(task)		0
 
 #endif /* CONFIG_LOCK_KERNEL */
 #endif /* __LINUX_SMPLOCK_H */
diff --git a/init/Kconfig b/init/Kconfig
index 5cff9a9..8cbc035 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -64,7 +64,7 @@ config BROKEN_ON_SMP
 
 config LOCK_KERNEL
 	bool
-	depends on SMP || PREEMPT
+	depends on (SMP || PREEMPT) && BKL
 	default y
 
 config INIT_ENV_ARG_LIMIT
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index e722e9d..84ef129 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -424,7 +424,7 @@ config DEBUG_PI_LIST
 
 config RT_MUTEX_TESTER
 	bool "Built-in scriptable tester for rt-mutexes"
-	depends on DEBUG_KERNEL && RT_MUTEXES
+	depends on DEBUG_KERNEL && RT_MUTEXES && BKL = y
 	help
 	  This option enables a rt-mutex tester.
 
@@ -444,6 +444,18 @@ config DEBUG_MUTEXES
 	 This feature allows mutex semantics violations to be detected and
 	 reported.
 
+config BKL
+	bool "Big Kernel Lock" if (SMP || PREEMPT) && BROKEN
+	default y
+	help
+	  This is the traditional lock that is used in old code instead
+	  of proper locking. All drivers that use the BKL should depend
+	  on this symbol.
+	  Say Y here unless you are working on removing the BKL.
+
+	  The option depends on CONFIG_BROKEN as long as the BKL is still
+	  used in the VFS and block layer.
+
 config DEBUG_LOCK_ALLOC
 	bool "Lock debugging: detect incorrect freeing of live locks"
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
diff --git a/net/ipx/Kconfig b/net/ipx/Kconfig
index e9ad006..45b232e 100644
--- a/net/ipx/Kconfig
+++ b/net/ipx/Kconfig
@@ -3,6 +3,7 @@
 #
 config IPX
 	tristate "The IPX protocol"
+	depends on BKL
 	select LLC
 	---help---
 	  This is support for the Novell networking protocol, IPX, commonly
diff --git a/net/irda/Kconfig b/net/irda/Kconfig
index c8671a7..b92874b 100644
--- a/net/irda/Kconfig
+++ b/net/irda/Kconfig
@@ -3,7 +3,7 @@
 #
 
 menuconfig IRDA
-	depends on NET && !S390
+	depends on NET && !S390 && BKL
 	tristate "IrDA (infrared) subsystem support"
 	select CRC_CCITT
 	---help---
diff --git a/net/irda/irnet/Kconfig b/net/irda/irnet/Kconfig
index 28c557f..4646380 100644
--- a/net/irda/irnet/Kconfig
+++ b/net/irda/irnet/Kconfig
@@ -1,6 +1,6 @@
 config IRNET
 	tristate "IrNET protocol"
-	depends on IRDA && PPP
+	depends on IRDA && PPP && BKL
 	help
 	  Say Y here if you want to build support for the IrNET protocol.
 	  To compile it as a module, choose M here: the module will be
diff --git a/net/x25/Kconfig b/net/x25/Kconfig
index e6759c9..71f3164 100644
--- a/net/x25/Kconfig
+++ b/net/x25/Kconfig
@@ -4,7 +4,7 @@
 
 config X25
 	tristate "CCITT X.25 Packet Layer (EXPERIMENTAL)"
-	depends on EXPERIMENTAL
+	depends on EXPERIMENTAL && BKL
 	---help---
 	  X.25 is a set of standardized network protocols, similar in scope to
 	  frame relay; the one physical line from your box to the X.25 network
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index a513651..9552197 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -253,7 +253,7 @@ config MSND_FIFOSIZE
 
 menuconfig SOUND_OSS
 	tristate "OSS sound modules"
-	depends on ISA_DMA_API && VIRT_TO_BUS
+	depends on ISA_DMA_API && VIRT_TO_BUS && BKL
 	help
 	  OSS is the Open Sound System suite of sound card drivers.  They make
 	  sound programming easier since they provide a common API.  Say Y or
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 7/8] soundcore_open: Reduce the area BKL coverage
  2010-07-03 22:02 ` [PATCH 7/8] soundcore_open: Reduce the area BKL coverage Arnd Bergmann
@ 2010-07-05 16:09   ` Takashi Iwai
  0 siblings, 0 replies; 14+ messages in thread
From: Takashi Iwai @ 2010-07-05 16:09 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, John Kacur, Frederic Weisbecker

At Sun,  4 Jul 2010 00:02:31 +0200,
Arnd Bergmann wrote:
> 
> From: John Kacur <jkacur@redhat.com>
> 
> Most of this function is protected by the sound_loader_lock.
> We can push down the BKL to this call out err = file->f_op->open(inode,file);
> 
> In order to build the sound core without the BKL, we
> will need to push the lock_kernel() call into the ~20
> device drivers that register their file operations.
> 
> Signed-off-by: John Kacur <jkacur@redhat.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Alan Cox <alan@linux.intel.com>
> Cc: Takashi Iwai <tiwai@suse.de>

I applied this one to sound git tree now.  Thanks!


Takashi

> ---
>  sound/sound_core.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/sound_core.c b/sound/sound_core.c
> index 7c2d677..c8627fc 100644
> --- a/sound/sound_core.c
> +++ b/sound/sound_core.c
> @@ -576,8 +576,6 @@ static int soundcore_open(struct inode *inode, struct file *file)
>  	struct sound_unit *s;
>  	const struct file_operations *new_fops = NULL;
>  
> -	lock_kernel ();
> -
>  	chain=unit&0x0F;
>  	if(chain==4 || chain==5)	/* dsp/audio/dsp16 */
>  	{
> @@ -630,18 +628,23 @@ static int soundcore_open(struct inode *inode, struct file *file)
>  		const struct file_operations *old_fops = file->f_op;
>  		file->f_op = new_fops;
>  		spin_unlock(&sound_loader_lock);
> -		if(file->f_op->open)
> +
> +		if (file->f_op->open) {
> +			/* TODO: push down BKL into indivial open functions */
> +			lock_kernel();
>  			err = file->f_op->open(inode,file);
> +			unlock_kernel();
> +		}
> +
>  		if (err) {
>  			fops_put(file->f_op);
>  			file->f_op = fops_get(old_fops);
>  		}
> +
>  		fops_put(old_fops);
> -		unlock_kernel();
>  		return err;
>  	}
>  	spin_unlock(&sound_loader_lock);
> -	unlock_kernel();
>  	return -ENODEV;
>  }
>  
> -- 
> 1.7.1
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/8] init: remove the BKL from startup code
  2010-07-03 22:02 ` [PATCH 2/8] init: remove the BKL from startup code Arnd Bergmann
@ 2010-07-09  3:52   ` Frederic Weisbecker
  2010-07-09 13:37   ` Frederic Weisbecker
  1 sibling, 0 replies; 14+ messages in thread
From: Frederic Weisbecker @ 2010-07-09  3:52 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, John Kacur

On Sun, Jul 04, 2010 at 12:02:26AM +0200, Arnd Bergmann wrote:
> I have shown by code review that no driver takes
> the BKL at init time any more, so whatever the
> init code was locking against is no longer there
> and it is now safe to remove the BKL there.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Steven Rostedt <rostedt@goodmis>
> ---


I'll queue this one.

Thanks.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/8] init: remove the BKL from startup code
  2010-07-03 22:02 ` [PATCH 2/8] init: remove the BKL from startup code Arnd Bergmann
  2010-07-09  3:52   ` Frederic Weisbecker
@ 2010-07-09 13:37   ` Frederic Weisbecker
  1 sibling, 0 replies; 14+ messages in thread
From: Frederic Weisbecker @ 2010-07-09 13:37 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, John Kacur

On Sun, Jul 04, 2010 at 12:02:26AM +0200, Arnd Bergmann wrote:
> I have shown by code review that no driver takes
> the BKL at init time any more, so whatever the
> init code was locking against is no longer there
> and it is now safe to remove the BKL there.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Steven Rostedt <rostedt@goodmis>
> ---



Just trying to find any possible races here but I can't find any
obvious. But I hope other reviewers can give it a look.

In the meantime, I'll queue that in my bkl/core branch so that
it can live some times in linux-next.

Thanks.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/8] do_coredump: do not take BKL
  2010-07-03 22:02 ` [PATCH 1/8] do_coredump: do not take BKL Arnd Bergmann
@ 2010-07-09 23:25   ` Frederic Weisbecker
  0 siblings, 0 replies; 14+ messages in thread
From: Frederic Weisbecker @ 2010-07-09 23:25 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, John Kacur

On Sun, Jul 04, 2010 at 12:02:25AM +0200, Arnd Bergmann wrote:
> core_pattern is not actually protected and hasn't been
> ever since we introduced procfs support for sysctl -- a
> _long_ time. Don't take it here either.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---


Applied in bkl/core, thanks.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/8] proc/pci: kill BKL
  2010-07-03 22:02 ` [PATCH 4/8] proc/pci: kill BKL Arnd Bergmann
@ 2010-08-13 23:33   ` Jesse Barnes
  0 siblings, 0 replies; 14+ messages in thread
From: Jesse Barnes @ 2010-08-13 23:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, John Kacur, Frederic Weisbecker, Tejun Heo,
	linux-pci

On Sun,  4 Jul 2010 00:02:28 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> All operations in the pci procfs ioctl functions are
> atomic, so no lock is needed here.
> 
> Also add a compat_ioctl method, since all the commands
> are compatible in 32 bit mode.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: linux-pci@vger.kernel.org
> ---

Oops, I had assumed this was going through some master 'kill the bkl'
tree.  Applied to my linux-next branch now though, sorry for the delay.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-08-13 23:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-03 22:02 [PATCH 0/8] BKL removal, assorted patches Arnd Bergmann
2010-07-03 22:02 ` [PATCH 1/8] do_coredump: do not take BKL Arnd Bergmann
2010-07-09 23:25   ` Frederic Weisbecker
2010-07-03 22:02 ` [PATCH 2/8] init: remove the BKL from startup code Arnd Bergmann
2010-07-09  3:52   ` Frederic Weisbecker
2010-07-09 13:37   ` Frederic Weisbecker
2010-07-03 22:02 ` [PATCH 3/8] hpet: kill BKL, add compat_ioctl Arnd Bergmann
2010-07-03 22:02 ` [PATCH 4/8] proc/pci: kill BKL Arnd Bergmann
2010-08-13 23:33   ` Jesse Barnes
2010-07-03 22:02 ` [PATCH 5/8] dasd: no need for BKL in ioctl Arnd Bergmann
2010-07-03 22:02 ` [PATCH 6/8] isapnp: BKL removal Arnd Bergmann
2010-07-03 22:02 ` [PATCH 7/8] soundcore_open: Reduce the area BKL coverage Arnd Bergmann
2010-07-05 16:09   ` Takashi Iwai
2010-07-03 22:02 ` [PATCH 8/8] BKL: introduce CONFIG_BKL Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).