On Thu, 31 Dec 2009, Borislav Petkov wrote: > Here's what I got with a new version of the dbg patch (both it and new > dmesg attached): > > [ 427.681810] Restarting tasks ... > [ 427.681995] hub 1-0:1.0: state 7 ports 6 chg 0004 evt 0000 > [ 427.682019] usb usb3: usb resume > [ 427.682030] ohci_hcd 0000:00:12.0: wakeup root hub > [ 427.682191] hub 1-0:1.0: port 2, status 0501, change 0000, 480 Mb/s > [ 427.682205] usb 1-2: usb wakeup-resume > [ 427.682226] usb 1-2: finish reset-resume > [ 427.682886] done. > [ 427.734658] ehci_hcd 0000:00:12.2: port 2 high speed > [ 427.734663] ehci_hcd 0000:00:12.2: GetStatus port 2 status 001005 POWER sig=se0 PE CONNECT > [ 427.746682] hub 3-0:1.0: hub_reset_resume > [ 427.746693] hub 3-0:1.0: trying to enable port power on non-switchable hub > [ 427.786715] usb 1-2: reset high speed USB device using ehci_hcd and address 2 > [ 427.839653] ehci_hcd 0000:00:12.2: port 2 high speed > [ 427.839666] ehci_hcd 0000:00:12.2: GetStatus port 2 status 001005 POWER sig=se0 PE CONNECT > [ 427.847717] ohci_hcd 0000:00:12.0: GetStatus roothub.portstatus [1] = 0x00010100 CSC PPS > [ 427.915497] hub 1-2:1.0: remove_intf_ep_devs: if: ffff88022f9e8800 ->ep_devs_created: 1 > [ 427.915774] hub 1-2:1.0: remove_intf_ep_devs: bNumEndpoints: 1 > [ 427.915934] hub 1-2:1.0: if: ffff88022f9e8800: endpoint devs removed. > [ 427.916158] hub 1-2:1.0: create_intf_ep_devs: if: ffff88022f9e8800 ->ep_devs_created: 0, ->unregistering: 0 > [ 427.916434] hub 1-2:1.0: create_intf_ep_devs: bNumEndpoints: 1 > [ 427.916609] ep_81: create, parent hub > [ 427.916632] ------------[ cut here ]------------ > [ 427.916644] WARNING: at fs/sysfs/dir.c:477 sysfs_add_one+0x82/0x96() > [ 427.916649] Hardware name: System Product Name > [ 427.916653] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2:1.0/ep_81' > [ 427.916658] Modules linked in: binfmt_misc kvm_amd kvm powernow_k8 cpufreq_ondemand cpufreq_powersave cpufreq_userspace freq_table cpufreq_conservative ipv6 vfat fat 8250_pnp 8250 pcspkr ohci_hcd serial_core k10temp edac_core > [ 427.916694] Pid: 278, comm: khubd Not tainted 2.6.33-rc2-00187-g08d869a-dirty #13 > [ 427.916699] Call Trace: > > > So, it looks like this ep_81 is already there when create_intf_ep_devs() > is being called. I've added debug calls to usb_create_ep_devs() and > usb_remove_ep_devs() but the ep_81 thing is never being removed after > being created 2 secs into the boot: Right. I have figured out the cause of the problem; it is Sarah Sharp's commit 3f0479e00a3fca9590ae8d9edc4e9c47b7fa0610 (USB: Check bandwidth when switching alt settings). > [ 2.177389] hub 1-2:1.0: remove_intf_ep_devs: if: ffff88022f9e8800 ->ep_devs_created: 0 > [ 2.177633] hub 1-2:1.0: create_intf_ep_devs: if: ffff88022f9e8800 ->ep_devs_created: 0, ->unregistering: 0 > [ 2.177877] hub 1-2:1.0: create_intf_ep_devs: bNumEndpoints: 1 > [ 2.178019] ep_81: create, parent hub > [ 2.178171] hub 1-2:1.0: if: ffff88022f9e8800: endpoint devs created. > > And it seems the idea is to recreate this sysfs entry upon resume but > why isn't it destroyed during suspend? That's not right; resume and suspend aren't directly connected with this. The real trigger is the device reset at timestamp 427.786715; you saw it occur after hibernation because the hibernation caused a reset. For now you should be able to eliminate the problem by getting rid of these lines from usb_reset_and_verify_device() in drivers/usb/core/hub.c: intf->cur_altsetting = usb_find_alt_setting(config, i, 0); if (!intf->cur_altsetting) intf->cur_altsetting = &config->intf_cache[i]->altsetting[0]; But we'll need to find a real solution. The problem is that we mustn't change intf->cur_altsetting here, because usb_set_interface() needs to know exactly what endpoint devices already exist for this interface. Sarah, any ideas? Add an extra flag to struct usb_interface to indicate that the hardware thinks the interface is in altsetting 0 because of a reset? (There's a related problem. In the call to usb_find_alt_setting() above, the second argument is not the interface number. Instead of i, it should be desc->bInterfaceNumber. In fact, that entire call should be replaced with a call to usb_altnum_to_altsetting().) Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html