Re: [PATCH 1/3, RFC] misc char dev BKL pushdown

From: Mike Frysinger
Date: Mon May 19 2008 - 20:08:19 EST


On Mon, May 19, 2008 at 7:26 PM, Arnd Bergmann wrote:
> The Big Kernel Lock has been pushed down from chardev_open
> to misc_open, this change moves it to the individual misc
> driver open functions.
>
> As before, the change was purely mechanical, most drivers
> should actually not need the BKL. In particular, we still
> hold the misc_mtx() while calling the open() function
> The patch should probably be split into one changeset
> per driver.
>
> --- linux-2.6.orig/arch/blackfin/mach-bf561/coreb.c
> +++ linux-2.6/arch/blackfin/mach-bf561/coreb.c
> @@ -32,6 +32,7 @@
> #include <linux/device.h>
> #include <linux/ioport.h>
> #include <linux/module.h>
> +#include <linux/smp_lock.h>
> #include <linux/uaccess.h>
> #include <linux/fs.h>
> #include <asm/dma.h>
> @@ -196,6 +197,7 @@ static loff_t coreb_lseek(struct file *f
>
> static int coreb_open(struct inode *inode, struct file *file)
> {
> + lock_kernel();
> spin_lock_irq(&coreb_lock);
>
> if (coreb_status & COREB_IS_OPEN)
> @@ -204,10 +206,12 @@ static int coreb_open(struct inode *inod
> coreb_status |= COREB_IS_OPEN;
>
> spin_unlock_irq(&coreb_lock);
> + unlock_kernel();
> return 0;
>
> out_busy:
> spin_unlock_irq(&coreb_lock);
> + unlock_kernel();
> return -EBUSY;
> }

this open func already has a spinlock protecting it. doesnt that mean
we dont need the bkl in it ?
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/