* illegal context for sleeping ... rmmod ide-cd + ide-scsi
@ 2003-05-05 8:39 Douglas Gilbert
2003-05-05 9:01 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Douglas Gilbert @ 2003-05-05 8:39 UTC (permalink / raw)
To: linux-kernel, linux-scsi
In lk 2.5.69 (and in 68) both the ide-cd and ide-scsi
modules generate a "sleeping function called from illegal
context" stack trace when removed.
After "rmmod ide-cd" this appears:
Debug: sleeping function called from illegal context
at include/asm/semaphore.h:119
Call Trace:
[<c011dcec>] __might_sleep+0x5c/0x70
[<c025b634>] auto_remove_settings+0x24/0x80
[<c025db8a>] ide_unregister_subdriver+0x15a/0x3d0
[<e10d48df>] ide_cdrom_cleanup+0x2f/0x110 [ide_cd]
[<c02346de>] driver_unregister+0x2e/0x42
[<e10d90e0>] ide_cdrom_driver+0x0/0xd8 [ide_cd]
[<e10d91a8>] ide_cdrom_driver+0xc8/0xd8 [ide_cd]
[<c025e270>] ide_unregister_driver+0x100/0x1df
[<c0155f1f>] unmap_vma_list+0x1f/0x30
[<e10d9200>] +0x0/0x140 [ide_cd]
[<e10d4df2>] +0x12/0x20 [ide_cd]
[<e10d90e0>] ide_cdrom_driver+0x0/0xd8 [ide_cd]
[<c013d336>] sys_delete_module+0x1d6/0x240
[<c0156457>] sys_munmap+0x57/0x80
[<c0109eaf>] syscall_call+0x7/0xb
After "rmmod ide-scsi" this appears:
Debug: sleeping function called from illegal context
at include/asm/semaphore.h:119
Call Trace:
[<e10c8068>] idescsi_driver+0xc8/0xd8 [ide_scsi]
[<c011dcec>] __might_sleep+0x5c/0x70
[<e10c8068>] idescsi_driver+0xc8/0xd8 [ide_scsi]
[<c025b634>] auto_remove_settings+0x24/0x80
[<c025db8a>] ide_unregister_subdriver+0x15a/0x3d0
[<e10c7ff8>] idescsi_driver+0x58/0xd8 [ide_scsi]
[<e10c7ff8>] idescsi_driver+0x58/0xd8 [ide_scsi]
[<e10c542d>] idescsi_cleanup+0x1d/0x60 [ide_scsi]
[<e10c7fa0>] idescsi_driver+0x0/0xd8 [ide_scsi]
[<c025e270>] ide_unregister_driver+0x100/0x1df
[<e10c6e87>] +0xfa/0x10f [ide_scsi]
[<e10c8300>] +0x0/0x140 [ide_scsi]
[<e10c663f>] +0x2f/0x50 [ide_scsi]
[<e10c7fa0>] idescsi_driver+0x0/0xd8 [ide_scsi]
[<c013d336>] sys_delete_module+0x1d6/0x240
[<c0156457>] sys_munmap+0x57/0x80
[<c0109eaf>] syscall_call+0x7/0xb
My .config has these kernel debugging options set:
#
# Kernel hacking
#
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_IOVIRT=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_KALLSYMS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
CONFIG_FRAME_POINTER=y
Doug Gilbert
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: illegal context for sleeping ... rmmod ide-cd + ide-scsi 2003-05-05 8:39 illegal context for sleeping ... rmmod ide-cd + ide-scsi Douglas Gilbert @ 2003-05-05 9:01 ` Andrew Morton 2003-05-05 11:51 ` Douglas Gilbert 0 siblings, 1 reply; 4+ messages in thread From: Andrew Morton @ 2003-05-05 9:01 UTC (permalink / raw) To: dougg; +Cc: linux-kernel, linux-scsi, Alan Cox Douglas Gilbert <dougg@torque.net> wrote: > > In lk 2.5.69 (and in 68) both the ide-cd and ide-scsi > modules generate a "sleeping function called from illegal > context" stack trace when removed. > > After "rmmod ide-cd" this appears: > Debug: sleeping function called from illegal context > at include/asm/semaphore.h:119 > Call Trace: > [<c011dcec>] __might_sleep+0x5c/0x70 ide_unregister_subdriver() does spin_lock_irqsave(&ide_lock), then calls auto_remove_settings(), which does down(&ide_setting_sem); A simple fix might be: diff -puN drivers/ide/ide.c~ide_setting_sem-fix drivers/ide/ide.c --- 25/drivers/ide/ide.c~ide_setting_sem-fix 2003-05-05 01:59:01.000000000 -0700 +++ 25-akpm/drivers/ide/ide.c 2003-05-05 02:00:21.000000000 -0700 @@ -1131,13 +1131,12 @@ ide_settings_t *ide_find_setting_by_name * * Automatically remove all the driver specific settings for this * drive. This function may sleep and must not be called from IRQ - * context. Takes the settings_lock + * context. The caller must hold ide_setting_sem. */ static void auto_remove_settings (ide_drive_t *drive) { ide_settings_t *setting; - down(&ide_setting_sem); repeat: setting = drive->settings; while (setting) { @@ -1147,7 +1146,6 @@ repeat: } setting = setting->next; } - up(&ide_setting_sem); } /** @@ -2350,9 +2348,11 @@ int ide_unregister_subdriver (ide_drive_ { unsigned long flags; + down(&ide_setting_sem); spin_lock_irqsave(&ide_lock, flags); if (drive->usage || drive->driver == &idedefault_driver || DRIVER(drive)->busy) { spin_unlock_irqrestore(&ide_lock, flags); + up(&ide_setting_sem); return 1; } #if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) && defined(MODULE) @@ -2363,6 +2363,7 @@ int ide_unregister_subdriver (ide_drive_ ide_remove_proc_entries(drive->proc, generic_subdriver_entries); #endif auto_remove_settings(drive); + up(&ide_setting_sem); drive->driver = &idedefault_driver; setup_driver_defaults(drive); spin_unlock_irqrestore(&ide_lock, flags); _ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: illegal context for sleeping ... rmmod ide-cd + ide-scsi 2003-05-05 9:01 ` Andrew Morton @ 2003-05-05 11:51 ` Douglas Gilbert 2003-05-05 11:23 ` Alan Cox 0 siblings, 1 reply; 4+ messages in thread From: Douglas Gilbert @ 2003-05-05 11:51 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-kernel, linux-scsi, Alan Cox Andrew Morton wrote: > Douglas Gilbert <dougg@torque.net> wrote: > >>In lk 2.5.69 (and in 68) both the ide-cd and ide-scsi >>modules generate a "sleeping function called from illegal >>context" stack trace when removed. >> >>After "rmmod ide-cd" this appears: >> Debug: sleeping function called from illegal context >> at include/asm/semaphore.h:119 >> Call Trace: >> [<c011dcec>] __might_sleep+0x5c/0x70 > > > ide_unregister_subdriver() does spin_lock_irqsave(&ide_lock), then > calls auto_remove_settings(), which does down(&ide_setting_sem); > > A simple fix might be: Andrew, Thanks. That patch clears the reported problem. Doug Gilbert ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: illegal context for sleeping ... rmmod ide-cd + ide-scsi 2003-05-05 11:51 ` Douglas Gilbert @ 2003-05-05 11:23 ` Alan Cox 0 siblings, 0 replies; 4+ messages in thread From: Alan Cox @ 2003-05-05 11:23 UTC (permalink / raw) To: dougg; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-scsi On Llu, 2003-05-05 at 12:51, Douglas Gilbert wrote: > > ide_unregister_subdriver() does spin_lock_irqsave(&ide_lock), then > > calls auto_remove_settings(), which does down(&ide_setting_sem); > > > > A simple fix might be: > > Andrew, > Thanks. That patch clears the reported problem. This is already fixed in 2.4.x btw. Just hadn't got pushed into 2.5 yet The 2.5.x code has another problem as well there is a basically unfixable deadlock in the proc and config stuff when flipping a device in and out of scsi mode ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-05-05 12:09 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-05-05 8:39 illegal context for sleeping ... rmmod ide-cd + ide-scsi Douglas Gilbert 2003-05-05 9:01 ` Andrew Morton 2003-05-05 11:51 ` Douglas Gilbert 2003-05-05 11:23 ` Alan Cox
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox