[PATCH] Remove unneded lock_kernel() in drivers/pci/syscall.c.
sys_pciconfig_{read,write}() are protected against PCI removal with the reference count in struct pci_dev. The concurrency of pci_user_{read,write}_config_* functions are already protected by pci_lock in drivers/pci/access.c. Signed-off-by: Diego Woitasen <[EMAIL PROTECTED]> --- drivers/pci/syscall.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index 2ac050d..645d7a6 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c @@ -34,7 +34,6 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, if (!dev) goto error; - lock_kernel(); switch (len) { case 1: cfg_ret = pci_user_read_config_byte(dev, off, &byte); @@ -47,10 +46,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, break; default: err = -EINVAL; - unlock_kernel(); goto error; }; - unlock_kernel(); err = -EIO; if (cfg_ret != PCIBIOS_SUCCESSFUL) @@ -107,7 +104,6 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, if (!dev) return -ENODEV; - lock_kernel(); switch(len) { case 1: err = get_user(byte, (u8 __user *)buf); @@ -140,7 +136,6 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, err = -EINVAL; break; } - unlock_kernel(); pci_dev_put(dev); return err; } -- 1.5.2.4 - 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/
Re: - loop-use-unlocked_ioctl.patch removed from -mm tree
On Fri, Aug 24, 2007 at 08:43:16PM -0700, [EMAIL PROTECTED] wrote: > > The patch titled > loop: use unlocked_ioctl > has been removed from the -mm tree. Its filename was > loop-use-unlocked_ioctl.patch > > This patch was dropped because it isn't in the present -mm lineup > > -- > Subject: loop: use unlocked_ioctl > From: Andrew Morton <[EMAIL PROTECTED]> > > The last lock_kernel() has disappeared from loop.c. Switch it over to using > unlocked_ioctl. > > Cc: Diego Woitasen <[EMAIL PROTECTED]> > Cc: Christoph Hellwig <[EMAIL PROTECTED]> > Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> > --- > > drivers/block/loop.c | 12 +++- > 1 files changed, 7 insertions(+), 5 deletions(-) > > diff -puN drivers/block/loop.c~loop-use-unlocked_ioctl drivers/block/loop.c > --- a/drivers/block/loop.c~loop-use-unlocked_ioctl > +++ a/drivers/block/loop.c > @@ -1124,12 +1124,14 @@ loop_get_status64(struct loop_device *lo > return err; > } > > -static int lo_ioctl(struct inode * inode, struct file * file, > - unsigned int cmd, unsigned long arg) > +static long lo_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > { > - struct loop_device *lo = inode->i_bdev->bd_disk->private_data; > + struct inode *inode; > + struct loop_device *lo; > int err; > > + inode = file->f_mapping->host; > + lo = inode->i_bdev->bd_disk->private_data; > mutex_lock(&lo->lo_ctl_mutex); > switch (cmd) { > case LOOP_SET_FD: > @@ -1304,7 +1306,7 @@ static long lo_compat_ioctl(struct file > arg = (unsigned long) compat_ptr(arg); > case LOOP_SET_FD: > case LOOP_CHANGE_FD: > - err = lo_ioctl(inode, file, cmd, arg); > + err = lo_ioctl(file, cmd, arg); > break; > default: > err = -ENOIOCTLCMD; > @@ -1340,7 +1342,7 @@ static struct block_device_operations lo > .owner =THIS_MODULE, > .open = lo_open, > .release = lo_release, > - .ioctl =lo_ioctl, > + .unlocked_ioctl = lo_ioctl, > #ifdef CONFIG_COMPAT > .compat_ioctl = lo_compat_ioctl, > #endif > _ > > Patches currently in -mm which might be from [EMAIL PROTECTED] are > > origin.patch > revert-ecryptfs-fix-lookup-error-for-special-files.patch > process_zones-fix-recovery-code.patch > remove-bdput-from-do_open-in-fs-block_devc.patch > slow-down-printk-during-boot.patch > slow-down-printk-during-boot-fix-2.patch > git-acpi.patch > acpi-add-reboot-mechanism.patch > git-alsa.patch > working-3d-dri-intel-agpko-resume-for-i815-chip.patch > revert-gregkh-driver-block-device.patch > revert-gregkh-driver-warn-when-statically-allocated-kobjects-are-used.patch > sysfs-crash-debugging.patch > git-dma.patch > git-dma-makefile-fix.patch > disable-ioat.patch > git-dvb.patch > git-dvb-fixup-2.patch > infiniband-work-around-gcc-slub-problem.patch > adbhid-produce-all-capslock-key-events.patch > iforce-warning-fix.patch > console-keyboard-events-and-accessibility-fix.patch > console-keyboard-events-and-accessibility-fix-2.patch > git-kvm.patch > git-libata-all.patch > ata-add-the-sw-ncq-support-to-sata_nv-for-mcp51-mcp55-mcp61patch.patch > ide-arm-hack.patch > git-mmc.patch > git-mmc-fixup.patch > gregkh-driver-driver-core-change-add_uevent_var-to-use-a-struct-vs-git-mmc.patch > git-mtd.patch > git-netdev-all.patch > e1000e-build-fix.patch > revert-8139too-clean-up-i-o-remapping.patch > git-net.patch > git-net-fixup.patch > git-backlight.patch > git-nfs-vs-git-unionfs.patch > git-nfsd.patch > revert-gregkh-pci-pci_bridge-device.patch > pci-remove-irritating-try-pci=assign-busses-warning.patch > fix-ide-legacy-mode-resources-fix.patch > git-s390.patch > git-scsi-misc.patch > advansys-printk-fix.patch > git-block-fixup.patch > git-block-fix-headers_check.patch > git-unionfs.patch > git-unionfs-build-fix.patch > git-unionfs-fix-2.patch > fix-gregkh-usb-usb-sisusb2vga-convert-printk-to-dev_-macros.patch > git-wireless.patch > git-wireless-fixup.patch > git-wireless-vs-gregkh-driver-driver-core-change-add_uevent_var-to-use-a-struct.patch > git-wireless-printk-fixes.patch > net-add-ath5k-wireless-driver-fix.patch > x86_64-get-mp_bus_to_node-as-early-v3.patch > ich-force-hpet-ich7-or-later-quirk-to-force-detect-enable-fix.patch > ich-force-hpet-ich5-quirk-to-force-detect-enable-fix.patch > git-xfs.patch > git-kgdb-fixup.patch > vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru
[PATCH] remove unneded lock_kernel in drivers/md/dm.c and use unlocked_ioctl.
Signed-off-by: Diego Woitasen <[EMAIL PROTECTED]> --- drivers/md/dm.c | 10 -- 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 141ff9f..aebb207 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -282,17 +282,16 @@ static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) return dm_get_geometry(md, geo); } -static int dm_blk_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static long dm_blk_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct mapped_device *md; struct dm_table *map; struct dm_target *tgt; + struct inode *inode; int r = -ENOTTY; - /* We don't really need this lock, but we do need 'inode'. */ - unlock_kernel(); + inode = file->f_path.dentry->d_inode; md = inode->i_bdev->bd_disk->private_data; map = dm_get_table(md); @@ -317,7 +316,6 @@ static int dm_blk_ioctl(struct inode *inode, struct file *file, out: dm_table_put(map); - lock_kernel(); return r; } @@ -1550,7 +1548,7 @@ EXPORT_SYMBOL_GPL(dm_noflush_suspending); static struct block_device_operations dm_blk_dops = { .open = dm_blk_open, .release = dm_blk_close, - .ioctl = dm_blk_ioctl, + .unlocked_ioctl = dm_blk_ioctl, .getgeo = dm_blk_getgeo, .owner = THIS_MODULE }; -- 1.5.2.4 - 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/
Re: [PATCH] Add KERN_* prefix to printks in bug.h
On Mon, Jul 16, 2007 at 08:45:47AM +0400, Alexey Dobriyan wrote: > On Sun, Jul 15, 2007 at 09:36:59PM -0300, Diego Woitasen wrote: > > --- > > include/asm-generic/bug.h | 25 + > > 1 files changed, 13 insertions(+), 12 deletions(-) > > > > diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h > > index 7f30cce..6e49266 100644 > > --- a/include/asm-generic/bug.h > > +++ b/include/asm-generic/bug.h > > @@ -8,22 +8,23 @@ > > #ifdef CONFIG_GENERIC_BUG > > #ifndef __ASSEMBLY__ > > struct bug_entry { > > - unsigned long bug_addr; > > + unsigned long bug_addr; > > Never include unrelated changes. > > > #ifdef CONFIG_DEBUG_BUGVERBOSE > > - const char *file; > > - unsigned short line; > > + const char *file; > > + unsigned short line; > > #endif > > - unsigned short flags; > > + unsigned short flags; > > }; > > -#endif /* __ASSEMBLY__ */ > > +#endif /* __ASSEMBLY__ */ > > > > #define BUGFLAG_WARNING(1<<0) > > -#endif /* CONFIG_GENERIC_BUG */ > > +#endif /* CONFIG_GENERIC_BUG */ > > > > #ifndef HAVE_ARCH_BUG > > -#define BUG() do { \ > > - printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, > > __FUNCTION__); \ > > - panic("BUG!"); \ > > +#define BUG() do { > > \ > > + printk(KERN_EMERG "BUG: failure at %s:%d/%s()!\n", \ > > + __FILE__, __LINE__, __FUNCTION__); \ > > + panic("BUG!"); \ > > } while (0) > > #endif > > > > @@ -35,15 +36,15 @@ struct bug_entry { > > #define WARN_ON(condition) ({ > > \ > > typeof(condition) __ret_warn_on = (condition); \ > > if (unlikely(__ret_warn_on)) { \ > > - printk("WARNING: at %s:%d %s()\n", __FILE__,\ > > - __LINE__, __FUNCTION__);\ > > + printk(KERN_WARNING "WARNING: at %s:%d %s()\n", \ > > + __FILE__, __LINE__, __FUNCTION__); \ > > dump_stack(); \ > > } \ > > unlikely(__ret_warn_on);\ > > }) > > #endif > > > > -#else /* !CONFIG_BUG */ > > +#else /* !CONFIG_BUG */ > > #ifndef HAVE_ARCH_BUG > > #define BUG() > > #endif yes, sorry... the "unrelated" changes are result of Lindent. May be I should include that in the git log. -- -- Diego Woitasen - 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/
Re: [PATCH] Use the tsk argument in init_new_context()
On Thu, Jul 19, 2007 at 05:42:38PM -0700, Andrew Morton wrote: > On Sun, 8 Jul 2007 22:55:08 -0300 > Diego Woitasen <[EMAIL PROTECTED]> wrote: > > > Signed-off-by: Diego Woitasen <[EMAIL PROTECTED]> > > --- > > arch/i386/kernel/ldt.c |2 +- > > arch/x86_64/kernel/ldt.c |2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c > > index e0b2d17..c2eb4fb 100644 > > --- a/arch/i386/kernel/ldt.c > > +++ b/arch/i386/kernel/ldt.c > > @@ -96,7 +96,7 @@ int init_new_context(struct task_struct *tsk, struct > > mm_struct *mm) > > > > init_MUTEX(&mm->context.sem); > > mm->context.size = 0; > > - old_mm = current->mm; > > + old_mm = tsk->mm; > > if (old_mm && old_mm->context.size > 0) { > > down(&old_mm->context.sem); > > retval = copy_ldt(&mm->context, &old_mm->context); > > diff --git a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c > > index bc9ffd5..99a92ed 100644 > > --- a/arch/x86_64/kernel/ldt.c > > +++ b/arch/x86_64/kernel/ldt.c > > @@ -100,7 +100,7 @@ int init_new_context(struct task_struct *tsk, struct > > mm_struct *mm) > > > > init_MUTEX(&mm->context.sem); > > mm->context.size = 0; > > - old_mm = current->mm; > > + old_mm = tsk->mm; > > if (old_mm && old_mm->context.size > 0) { > > down(&old_mm->context.sem); > > retval = copy_ldt(&mm->context, &old_mm->context); > > > When called from dup_mm(), `tsk' refers to the new task and `current' > refers to the old one. I'd have expected this to crash during your testing? > - > 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/ Yes, sorry... that patch is bad. Now my question is, why all architectures have the task argument and neither use it? I undertand now that init_new_context() work with current but what about the *tsk arg. -- -- Diego Woitasen - 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/
[PATCH] Add KERN_* prefix to printks in bug.h
--- include/asm-generic/bug.h | 25 + 1 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 7f30cce..6e49266 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -8,22 +8,23 @@ #ifdef CONFIG_GENERIC_BUG #ifndef __ASSEMBLY__ struct bug_entry { - unsigned long bug_addr; + unsigned long bug_addr; #ifdef CONFIG_DEBUG_BUGVERBOSE - const char *file; - unsigned short line; + const char *file; + unsigned short line; #endif - unsigned short flags; + unsigned short flags; }; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLY__ */ #define BUGFLAG_WARNING(1<<0) -#endif /* CONFIG_GENERIC_BUG */ +#endif /* CONFIG_GENERIC_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG() do { \ - printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ - panic("BUG!"); \ +#define BUG() do { \ + printk(KERN_EMERG "BUG: failure at %s:%d/%s()!\n", \ + __FILE__, __LINE__, __FUNCTION__); \ + panic("BUG!"); \ } while (0) #endif @@ -35,15 +36,15 @@ struct bug_entry { #define WARN_ON(condition) ({ \ typeof(condition) __ret_warn_on = (condition); \ if (unlikely(__ret_warn_on)) { \ - printk("WARNING: at %s:%d %s()\n", __FILE__,\ - __LINE__, __FUNCTION__);\ + printk(KERN_WARNING "WARNING: at %s:%d %s()\n", \ + __FILE__, __LINE__, __FUNCTION__); \ dump_stack(); \ } \ unlikely(__ret_warn_on);\ }) #endif -#else /* !CONFIG_BUG */ +#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG #define BUG() #endif -- 1.5.2.3 - 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/
[PATCH] Remove unneded lock_kernel() in driver/block/loop.c
Signed-off-by: Diego Woitasen <[EMAIL PROTECTED]> --- drivers/block/loop.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 0ed5470..1cc004e 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a struct loop_device *lo = inode->i_bdev->bd_disk->private_data; int err; - lock_kernel(); switch(cmd) { case LOOP_SET_STATUS: mutex_lock(&lo->lo_ctl_mutex); @@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a err = -ENOIOCTLCMD; break; } - unlock_kernel(); return err; } #endif -- 1.5.2.3 - 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/
[PATCH] Use the tsk argument in init_new_context()
Signed-off-by: Diego Woitasen <[EMAIL PROTECTED]> --- arch/i386/kernel/ldt.c |2 +- arch/x86_64/kernel/ldt.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c index e0b2d17..c2eb4fb 100644 --- a/arch/i386/kernel/ldt.c +++ b/arch/i386/kernel/ldt.c @@ -96,7 +96,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) init_MUTEX(&mm->context.sem); mm->context.size = 0; - old_mm = current->mm; + old_mm = tsk->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); diff --git a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c index bc9ffd5..99a92ed 100644 --- a/arch/x86_64/kernel/ldt.c +++ b/arch/x86_64/kernel/ldt.c @@ -100,7 +100,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) init_MUTEX(&mm->context.sem); mm->context.size = 0; - old_mm = current->mm; + old_mm = tsk->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); -- 1.5.2.3 - 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/
Remove unneded lock_kernel() in drivers/block/loop.c
This patch remove the unneeded lock_kernel() in drivers/block/loop.c. I read the code and this lock_kernel() doesn't protect anything. Loopback code use lo_ctl_mutex for syncronization. diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 0ed5470..1cc004e 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a struct loop_device *lo = inode->i_bdev->bd_disk->private_data; int err; - lock_kernel(); switch(cmd) { case LOOP_SET_STATUS: mutex_lock(&lo->lo_ctl_mutex); @@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a err = -ENOIOCTLCMD; break; } - unlock_kernel(); return err; } #endif -- -- Diego Woitasen - 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/
[PATCH] Remove unneeded lock_kernel() in drivers/block/loop.c
This patch remove the unneeded lock_kernel() in drivers/block/loop.c. I read the code as this lock_kernel() doesn't protect anything. Loopback code use lo_ctl_mutex for syncronization. diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 0ed5470..1cc004e 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a struct loop_device *lo = inode->i_bdev->bd_disk->private_data; int err; - lock_kernel(); switch(cmd) { case LOOP_SET_STATUS: mutex_lock(&lo->lo_ctl_mutex); @@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a err = -ENOIOCTLCMD; break; } - unlock_kernel(); return err; } #endif -- -- Diego Woitasen - 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/