Bug 13496
Summary: | usb-storage driver is crashing on E220 HSDPA Modem / E270 HSDPA/HSUPA Modem | ||
---|---|---|---|
Product: | Drivers | Reporter: | Rick (ozstriker78) |
Component: | USB | Assignee: | Greg Kroah-Hartman (greg) |
Status: | RESOLVED INVALID | ||
Severity: | high | ||
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 2.6.28 and 2.6.29 | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
Rick
2009-06-10 10:05:55 UTC
When I rmmod usb_storge, then modprobe usb_storage with the device still attached, I get this in dmesg.... [ 2099.854043] usbcore: deregistering interface driver usb-storage [ 2109.966060] Initializing USB Mass Storage driver... [ 2109.971298] ------------[ cut here ]------------ [ 2109.971307] WARNING: at /home/kernel-ppa/mainline/build/fs/proc/generic.c:547 proc_register+0xa0/0x130() [ 2109.971316] Hardware name: 23736YU [ 2109.971321] proc_dir_entry 'scsi/usb-storage' already registered [ 2109.971327] Modules linked in: usb_storage(+) xt_conntrack binfmt_misc radeon drm ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp lp pcmcia joydev snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device thinkpad_acpi iTCO_wdt iTCO_vendor_support nsc_ircc ipw2100 libipw led_class yenta_socket rsrc_nonstatic pcmcia_core lib80211 intel_agp snd soundcore ppdev psmouse serio_raw nvram irda pcspkr video agpgart snd_page_alloc shpchp parport_pc parport crc_ccitt output reiserfs sha256_generic aes_i586 aes_generic cbc usbhid e1000 dm_crypt [last unloaded: usb_storage] [ 2109.971488] Pid: 4991, comm: modprobe Not tainted 2.6.29-02062904-generic #02062904 [ 2109.971496] Call Trace: [ 2109.971511] [<c013a636>] warn_slowpath+0x86/0xa0 [ 2109.971525] [<c02c1841>] ? sub_alloc+0x61/0x150 [ 2109.971537] [<c01220f8>] ? default_spin_lock_flags+0x8/0x10 [ 2109.971549] [<c04f7d42>] ? _spin_lock_irqsave+0x32/0x50 [ 2109.971560] [<c02c1b80>] ? ida_get_new_above+0x110/0x180 [ 2109.971571] [<c02c1b80>] ? ida_get_new_above+0x110/0x180 [ 2109.971582] [<c02c1ce0>] ? idr_pre_get+0x20/0x50 [ 2109.971592] [<c02c1bfc>] ? ida_get_new+0xc/0x10 [ 2109.971602] [<c01fffd7>] ? get_inode_number+0x47/0xa0 [ 2109.971612] [<c02000d0>] proc_register+0xa0/0x130 [ 2109.971622] [<c0200333>] proc_mkdir_mode+0x33/0x50 [ 2109.971640] [<c020035f>] proc_mkdir+0xf/0x20 [ 2109.971651] [<c036e5f6>] scsi_proc_hostdir_add+0x46/0x80 [ 2109.971662] [<c0362c80>] scsi_host_alloc+0x240/0x2b0 [ 2109.971672] [<c0366580>] ? scsi_error_handler+0x0/0x120 [ 2109.971710] [<f8107aae>] storage_probe+0x1e/0x1b0 [usb_storage] [ 2109.971722] [<c03b7c89>] ? usb_autopm_do_device+0x79/0xf0 [ 2109.971732] [<c03b6cc7>] ? usb_match_one_id+0x27/0xa0 [ 2109.971755] [<c03b82db>] usb_probe_interface+0x9b/0x140 [ 2109.971766] [<c020d482>] ? sysfs_create_link+0x12/0x20 [ 2109.971782] [<c034d256>] really_probe+0x56/0x150 [ 2109.971791] [<c03b6d7b>] ? usb_match_id+0x3b/0x50 [ 2109.971810] [<c034d38b>] driver_probe_device+0x3b/0x50 [ 2109.971820] [<c034d421>] __driver_attach+0x81/0x90 [ 2109.971833] [<c034c909>] bus_for_each_dev+0x49/0x70 [ 2109.971847] [<c034d109>] driver_attach+0x19/0x20 [ 2109.971857] [<c034d3a0>] ? __driver_attach+0x0/0x90 [ 2109.971867] [<c034cf47>] bus_add_driver+0x107/0x1a0 [ 2109.971884] [<c034d702>] driver_register+0x42/0xc0 [ 2109.971896] [<c01baf6e>] ? percpu_free+0x1e/0x30 [ 2109.971909] [<c03b7575>] usb_register_driver+0x75/0xd0 [ 2109.971937] [<f7ffd000>] ? usb_stor_init+0x0/0x41 [usb_storage] [ 2109.971967] [<f7ffd000>] ? usb_stor_init+0x0/0x41 [usb_storage] [ 2109.971991] [<f7ffd027>] usb_stor_init+0x27/0x41 [usb_storage] [ 2109.972032] [<c010111b>] _stext+0x2b/0x160 [ 2109.972045] [<c0186bb8>] ? tracepoint_module_notify+0x28/0x30 [ 2109.972057] [<c04fa69d>] ? notifier_call_chain+0x2d/0x60 [ 2109.972073] [<c01538ad>] ? __blocking_notifier_call_chain+0x4d/0x60 [ 2109.972092] [<c01646c3>] sys_init_module+0x83/0x1b0 [ 2109.972103] [<c010346b>] sysenter_do_call+0x12/0x2f [ 2109.972114] [<c04f0000>] ? get_model_name+0x10/0x100 [ 2109.972121] ---[ end trace 4470547f96b38b4c ]--- [ 2110.005327] usb-storage: probe of 1-3:1.0 failed with error -5 [ 2110.006956] usb-storage: probe of 1-3:1.1 failed with error -5 [ 2110.007782] usb-storage: probe of 1-3:1.2 failed with error -1 [ 2110.008972] usb-storage: probe of 1-3:1.3 failed with error -1 [ 2110.008998] usbcore: registered new interface driver usb-storage [ 2110.009002] USB Mass Storage support registered. It seems that there is some sort of race condition. I was able to get the usb-storage driver to work, but it still seems to crash. I wrote a basic script to rmmod all the related device drivers, then load them up in a specific order, with a sleep statement. Here is the script: ===== cut ======== rmmod usb_storage rmmod option rmmod usbserial echo "sleeping for 2 seconds to let the drivers unload...." && sleep 2 modprobe option echo "sleeping for 2 seconds to make usb_storage detect the storage device..." && sleep 2 && echo "done sleeping" modprobe usb_storage ===== cut ======== If I set the sleep time to 10 seconds, the usb_storage device isn't detected. If I take out the "sleep 2", then the usb_storage device isn't detected either. So it seems there needs to be a delay after the "option" module is loaded in order for usb_storage to see the storage device. What doesn't make sense is that if you wait more than 10 seconds after the "option" driver is loaded, then usb_storage can't see the storage device. Here is dmesg (something is still crashing): root@rgarcia-desktop:/# dmesg [ 5023.686339] usbcore: deregistering interface driver usb-storage [ 5023.743112] usbcore: deregistering interface driver option [ 5023.743346] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1 [ 5023.743393] option 1-3:1.1: device disconnected [ 5023.743622] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0 [ 5023.743667] option 1-3:1.0: device disconnected [ 5023.743703] USB Serial deregistering driver GSM modem (1-port) [ 5023.751374] usbcore: deregistering interface driver usbserial_generic [ 5023.751434] USB Serial deregistering driver generic [ 5023.751474] usbcore: deregistering interface driver usbserial [ 5025.783499] usbcore: registered new interface driver usbserial [ 5025.783541] USB Serial support registered for generic [ 5025.783643] usbcore: registered new interface driver usbserial_generic [ 5025.783650] usbserial: USB Serial Driver core [ 5025.794128] USB Serial support registered for GSM modem (1-port) [ 5025.794228] option 1-3:1.0: GSM modem (1-port) converter detected [ 5025.794466] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB0 [ 5025.794494] option 1-3:1.1: GSM modem (1-port) converter detected [ 5025.794620] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB1 [ 5025.794674] usbcore: registered new interface driver option [ 5025.794680] option: v0.7.2:USB Driver for GSM modems [ 5027.847140] Initializing USB Mass Storage driver... [ 5027.856108] ------------[ cut here ]------------ [ 5027.856117] WARNING: at /home/kernel-ppa/mainline/build/fs/proc/generic.c:547 proc_register+0xa0/0x130() [ 5027.856126] Hardware name: 23736YU [ 5027.856131] proc_dir_entry 'scsi/usb-storage' already registered [ 5027.856137] Modules linked in: usb_storage(+) option usbserial nls_cp437 isofs ppp_deflate zlib_deflate bsd_comp ppp_async xt_conntrack binfmt_misc radeon drm ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp lp pcmcia joydev snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device thinkpad_acpi iTCO_wdt iTCO_vendor_support nsc_ircc ipw2100 libipw led_class yenta_socket rsrc_nonstatic pcmcia_core lib80211 intel_agp snd soundcore ppdev psmouse serio_raw nvram irda pcspkr video agpgart snd_page_alloc shpchp parport_pc parport crc_ccitt output reiserfs sha256_generic aes_i586 aes_generic cbc usbhid e1000 dm_crypt [last unloaded: usbserial] [ 5027.856315] Pid: 8795, comm: modprobe Tainted: G W 2.6.29-02062904-generic #02062904 [ 5027.856323] Call Trace: [ 5027.856340] [<c013a636>] warn_slowpath+0x86/0xa0 [ 5027.856354] [<c02c1841>] ? sub_alloc+0x61/0x150 [ 5027.856367] [<c01220f8>] ? default_spin_lock_flags+0x8/0x10 [ 5027.856379] [<c04f7d42>] ? _spin_lock_irqsave+0x32/0x50 [ 5027.856390] [<c02c1b80>] ? ida_get_new_above+0x110/0x180 [ 5027.856401] [<c02c1b80>] ? ida_get_new_above+0x110/0x180 [ 5027.856412] [<c02c1ce0>] ? idr_pre_get+0x20/0x50 [ 5027.856422] [<c02c1bfc>] ? ida_get_new+0xc/0x10 [ 5027.856432] [<c01fffd7>] ? get_inode_number+0x47/0xa0 [ 5027.856442] [<c02000d0>] proc_register+0xa0/0x130 [ 5027.856452] [<c0200333>] proc_mkdir_mode+0x33/0x50 [ 5027.856472] [<c020035f>] proc_mkdir+0xf/0x20 [ 5027.856483] [<c036e5f6>] scsi_proc_hostdir_add+0x46/0x80 [ 5027.856494] [<c0362c80>] scsi_host_alloc+0x240/0x2b0 [ 5027.856504] [<c0366580>] ? scsi_error_handler+0x0/0x120 [ 5027.856542] [<f9b0aaae>] storage_probe+0x1e/0x1b0 [usb_storage] [ 5027.856554] [<c03b7c89>] ? usb_autopm_do_device+0x79/0xf0 [ 5027.856564] [<c03b6cc7>] ? usb_match_one_id+0x27/0xa0 [ 5027.856587] [<c03b82db>] usb_probe_interface+0x9b/0x140 [ 5027.856598] [<c020d482>] ? sysfs_create_link+0x12/0x20 [ 5027.856615] [<c034d256>] really_probe+0x56/0x150 [ 5027.856624] [<c03b6d7b>] ? usb_match_id+0x3b/0x50 [ 5027.856643] [<c034d38b>] driver_probe_device+0x3b/0x50 [ 5027.856654] [<c034d421>] __driver_attach+0x81/0x90 [ 5027.856668] [<c034c909>] bus_for_each_dev+0x49/0x70 [ 5027.856682] [<c034d109>] driver_attach+0x19/0x20 [ 5027.856692] [<c034d3a0>] ? __driver_attach+0x0/0x90 [ 5027.856702] [<c034cf47>] bus_add_driver+0x107/0x1a0 [ 5027.856719] [<c034d702>] driver_register+0x42/0xc0 [ 5027.856732] [<c01baf6e>] ? percpu_free+0x1e/0x30 [ 5027.856746] [<c03b7575>] usb_register_driver+0x75/0xd0 [ 5027.856776] [<f9b21000>] ? usb_stor_init+0x0/0x41 [usb_storage] [ 5027.856808] [<f9b21000>] ? usb_stor_init+0x0/0x41 [usb_storage] [ 5027.856834] [<f9b21027>] usb_stor_init+0x27/0x41 [usb_storage] [ 5027.856849] [<c010111b>] _stext+0x2b/0x160 [ 5027.856863] [<c0186bb8>] ? tracepoint_module_notify+0x28/0x30 [ 5027.856874] [<c04fa69d>] ? notifier_call_chain+0x2d/0x60 [ 5027.856891] [<c01538ad>] ? __blocking_notifier_call_chain+0x4d/0x60 [ 5027.856910] [<c01646c3>] sys_init_module+0x83/0x1b0 [ 5027.856921] [<c010346b>] sysenter_do_call+0x12/0x2f [ 5027.856932] [<c04f0000>] ? get_model_name+0x10/0x100 [ 5027.856939] ---[ end trace 4470547f96b38b69 ]--- [ 5030.865579] usb-storage: probe of 1-3:1.2 failed with error -1 [ 5034.864310] scsi81 : SCSI emulation for USB Mass Storage devices [ 5034.866598] usbcore: registered new interface driver usb-storage [ 5034.866610] USB Mass Storage support registered. [ 5034.869852] usb-storage: device found at 10 [ 5034.869860] usb-storage: waiting for device to settle before scanning [ 5040.876527] usb-storage: device scan complete [ 5040.878642] scsi 81:0:0:0: Direct-Access HUAWEI MMC Storage 2.31 PQ: 0 ANSI: 2 [ 5040.909212] sd 81:0:0:0: [sdb] 246016 512-byte hardware sectors: (125 MB/120 MiB) [ 5040.936611] sd 81:0:0:0: [sdb] Write Protect is off [ 5040.936623] sd 81:0:0:0: [sdb] Mode Sense: 0f 0e 00 00 [ 5040.936630] sd 81:0:0:0: [sdb] Assuming drive cache: write through [ 5040.944956] sd 81:0:0:0: [sdb] 246016 512-byte hardware sectors: (125 MB/120 MiB) [ 5040.947949] sd 81:0:0:0: [sdb] Write Protect is off [ 5040.947959] sd 81:0:0:0: [sdb] Mode Sense: 0f 0e 00 00 [ 5040.947966] sd 81:0:0:0: [sdb] Assuming drive cache: write through [ 5040.947978] sdb: sdb4 [ 5040.954044] sd 81:0:0:0: [sdb] Attached SCSI removable disk [ 5040.954216] sd 81:0:0:0: Attached scsi generic sg2 type 0 (switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface). On Wed, 10 Jun 2009 10:05:56 GMT bugzilla-daemon@bugzilla.kernel.org wrote: > http://bugzilla.kernel.org/show_bug.cgi?id=13496 > > Summary: usb-storage driver is crashing on E220 HSDPA Modem / > E270 HSDPA/HSUPA Modem > Product: Drivers > Version: 2.5 > Kernel Version: 2.6.28 and 2.6.29 > Platform: All > OS/Version: Linux > Tree: Mainline > Status: NEW > Severity: high > Priority: P1 > Component: USB > AssignedTo: greg@kroah.com > ReportedBy: ozstriker78@gmail.com > Regression: No > > > ... > > [ 200.691615] option 1-3:1.1: GSM modem (1-port) converter detected > [ 200.691665] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB1 > [ 200.691685] usbcore: registered new interface driver option > [ 200.691687] option: v0.7.2:USB Driver for GSM modems > [ 204.467771] BUG: scheduling while atomic: swapper/0/0x10010000 > [ 204.467781] Modules linked in: option usbserial usb_storage xt_conntrack > binfmt_misc radeon drm ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 > nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter > ip_tables x_tables bridge stp lp pcmcia joydev snd_intel8x0 snd_ac97_codec > ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss > snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device > thinkpad_acpi iTCO_wdt iTCO_vendor_support nsc_ircc ipw2100 libipw led_class > yenta_socket rsrc_nonstatic pcmcia_core lib80211 intel_agp snd soundcore > ppdev > psmouse serio_raw nvram irda pcspkr video agpgart snd_page_alloc shpchp > parport_pc parport crc_ccitt output reiserfs sha256_generic aes_i586 > aes_generic cbc usbhid e1000 dm_crypt > [ 204.467941] > [ 204.467949] Pid: 0, comm: swapper Not tainted (2.6.29-02062904-generic > #02062904) 23736YU > [ 204.467958] EIP: 0060:[<c0315dec>] EFLAGS: 00000202 CPU: 0 > [ 204.467973] EIP is at acpi_idle_enter_simple+0xfd/0x138 > [ 204.467981] EAX: c07c2cd8 EBX: 00000d2f ECX: 0000002f EDX: 01183000 > [ 204.467988] ESI: 00000000 EDI: f6ec6450 EBP: c0739f7c ESP: c0739f64 > [ 204.467996] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 > [ 204.468003] CR0: 8005003b CR2: b7f34000 CR3: 34fc0000 CR4: 00000690 > [ 204.468011] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 > [ 204.468018] DR6: ffff0ff0 DR7: 00000400 > [ 204.468023] Call Trace: > [ 204.468036] [<c0315e8a>] acpi_idle_enter_bm+0x63/0x1fd > [ 204.468049] [<c04068cf>] cpuidle_idle_call+0x6f/0xc0 > [ 204.468059] [<c0101eb0>] cpu_idle+0x60/0xa0 > [ 204.468071] [<c04e5785>] rest_init+0x55/0x60 This looks like a lock imbalance - a spinlock or an rwlock. Could also be a preempt_disable() imbalance. On Mon, 15 Jun 2009, Andrew Morton wrote: > > http://bugzilla.kernel.org/show_bug.cgi?id=13496 > > > > Summary: usb-storage driver is crashing on E220 HSDPA Modem / > > E270 HSDPA/HSUPA Modem This bug report contains two separate problems. This is the first one: > > [ 204.467771] BUG: scheduling while atomic: swapper/0/0x10010000 .... > > [ 204.467973] EIP is at acpi_idle_enter_simple+0xfd/0x138 ... > > [ 204.468023] Call Trace: > > [ 204.468036] [<c0315e8a>] acpi_idle_enter_bm+0x63/0x1fd > > [ 204.468049] [<c04068cf>] cpuidle_idle_call+0x6f/0xc0 > > [ 204.468059] [<c0101eb0>] cpu_idle+0x60/0xa0 > > [ 204.468071] [<c04e5785>] rest_init+0x55/0x60 > > This looks like a lock imbalance - a spinlock or an rwlock. Could also > be a preempt_disable() imbalance. Whatever it is, it is unlikely to be related to usb-storage. The second problem is this: [ 2109.971307] WARNING: at /home/kernel-ppa/mainline/build/fs/proc/generic.c:547 proc_register+0xa0/0x130() [ 2109.971316] Hardware name: 23736YU [ 2109.971321] proc_dir_entry 'scsi/usb-storage' already registered This was caused by a bug, not in usb-storage, but in the SCSI core. The bug was in a patch I wrote. In fact, it was in the second version of the patch; the first version probably was correct. Here is a combined patch (it reverts the second and adds the first). Does it fix the "proc_dir_entry already registered" problem? Alan Stern Index: usb-2.6/drivers/scsi/hosts.c =================================================================== --- usb-2.6.orig/drivers/scsi/hosts.c +++ usb-2.6/drivers/scsi/hosts.c @@ -176,6 +176,7 @@ void scsi_remove_host(struct Scsi_Host * transport_unregister_device(&shost->shost_gendev); device_unregister(&shost->shost_dev); device_del(&shost->shost_gendev); + scsi_proc_hostdir_rm(shost->hostt); } EXPORT_SYMBOL(scsi_remove_host); @@ -205,9 +206,10 @@ int scsi_add_host(struct Scsi_Host *shos if (error) goto fail; + scsi_proc_hostdir_add(shost->hostt); + if (!shost->shost_gendev.parent) shost->shost_gendev.parent = dev ? dev : &platform_bus; - error = device_add(&shost->shost_gendev); if (error) goto out; @@ -258,6 +260,7 @@ int scsi_add_host(struct Scsi_Host *shos out_del_gendev: device_del(&shost->shost_gendev); out: + scsi_proc_hostdir_rm(shost->hostt); scsi_destroy_command_freelist(shost); fail: return error; @@ -269,8 +272,6 @@ static void scsi_host_dev_release(struct struct Scsi_Host *shost = dev_to_shost(dev); struct device *parent = dev->parent; - scsi_proc_hostdir_rm(shost->hostt); - if (shost->ehandler) kthread_stop(shost->ehandler); if (shost->work_q) @@ -408,7 +409,6 @@ struct Scsi_Host *scsi_host_alloc(struct goto fail_kfree; } - scsi_proc_hostdir_add(shost->hostt); return shost; fail_kfree: All USB bugs should be sent to the linux-usb@vger.kernel.org mailing list, and not entered into bugzilla. Please bring this issue up there, if it is still a problem in the latest kernel release. |