Bug 23012 (Kevin)

Summary: ftdi_sio /dev/ttyUSB error: "Resource Temporarily Unavailable"
Product: Drivers Reporter: Kevin Smith (thirdwiggin)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: CLOSED CODE_FIX    
Severity: normal CC: artfwo, error27, florian, gesimu, kernel-bug, maciej.rutecki, ozan, rjw, stern
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.37-rc1 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 21782    
Attachments: dmesg from v2.6.37-rc2
strace on minicom
Set the supports_autosuspend for all USB serial drivers

Description Kevin Smith 2010-11-16 06:25:28 UTC
I am using a ftdi USB-to-serial device, which has worked in previous kernels.  After a recent update to mainline 2.6.37, I am no longer able to access the device.  Upon plugging in the device, the ftdi_sio module loads and /dev/ttyUSB0 appears.  However, when I try to access the device, I get the error "Resource Temporarily Unavailable".  There is no other process trying to access the device.  After downgrading to 2.6.36, the problem is fixed.
Comment 1 Greg Kroah-Hartman 2010-11-16 14:48:06 UTC
On Tue, Nov 16, 2010 at 06:25:31AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> I am using a ftdi USB-to-serial device, which has worked in previous kernels. 
> After a recent update to mainline 2.6.37, I am no longer able to access the
> device.  Upon plugging in the device, the ftdi_sio module loads and
> /dev/ttyUSB0 appears.  However, when I try to access the device, I get the
> error "Resource Temporarily Unavailable".  There is no other process trying
> to
> access the device.  After downgrading to 2.6.36, the problem is fixed.

Can you run 'git bisect' to determine which patch caused the problem?

And there is no 2.6.37 yet, only 2.6.37-rc2.
Comment 2 Kevin Smith 2010-11-17 03:27:45 UTC
I am installing from the Ubuntu PPA, not source.  The hash of the non-working revision is e53beacd23d9cb47590da6a7a7f6d417b941a994 and the working version is tag v2.6.36.  I went to report the bug through my distribution, but since it's a build of mainline, the bug tool referred me to the kernel bugzilla.

Sorry to not be more help.  If this is not enough information, please feel free to close.
Comment 3 Florian Mickler 2010-11-17 06:39:41 UTC
Please attach the output of dmesg.
Comment 4 Simon Gerber 2010-11-20 22:19:32 UTC
Created attachment 37782 [details]
dmesg from v2.6.37-rc2

dmesg output from v2.6.37-rc2 when repeatedly attaching and detaching a ftdi_sio USB-to-Serial converter.
Comment 5 Simon Gerber 2010-11-20 22:35:02 UTC
Hi,

I'm encountering the same bug... Have attached dmesg for v2.6.37-rc2 from the tar-ball.

will do a git bisect now.

hth
-- Simon
Comment 6 Simon Gerber 2010-11-22 17:30:14 UTC
After bisecting I found this: the "Resource temporarily unavailable" message occurs first with commit 1bfee5bc86fdaecc912e06080583eddab7263df2, "PM / Runtime: Merge synchronous and async runtime routines".
Comment 7 Dan Carpenter 2010-11-27 11:30:44 UTC
Did you send Alan an email?

Could you run strace on the program which is accessing the ttyUSB0?

I don't think this can be coming from the open() call because that would have printed a error message if it returned -EAGAIN.
Comment 8 Alan Stern 2010-11-27 15:24:17 UTC
Simon, can you try a little debugging?  In drivers/usb/serial/usb-serial.c, in the serial_install() routine, make sure that usb_autopm_get_interface() is getting called and see what value it returns.
Comment 9 Simon Gerber 2010-11-27 16:24:08 UTC
Sure, will look into this tonight.

--Simon
Comment 10 Simon Gerber 2010-11-27 22:44:26 UTC
Ok, figured out how to enable debugging in usb-serial.c... This is what I got:

Nov 27 23:35:39 gryphon kernel: [  416.482926] drivers/usb/serial/usb-serial.c: serial_install
Nov 27 23:35:39 gryphon kernel: [  416.482935] drivers/usb/serial/usb-serial.c: serial_install: usb_autopm_get_interface returned -11

For good measure I also did a strace on minicom (which is what I use to access ttyUSB0 at the moment).

--Simon
Comment 11 Simon Gerber 2010-11-27 22:45:23 UTC
Created attachment 38352 [details]
strace on minicom
Comment 12 Alan Stern 2010-11-28 03:34:10 UTC
Created attachment 38372 [details]
Set the supports_autosuspend for all USB serial drivers

It looks like the autosuspend support for USB serial drivers wasn't done quite correctly.  This patch should fix the problem.  Let me know how it works out.
Comment 13 Simon Gerber 2010-11-28 17:17:54 UTC
The patch in #12 fixes the issue for me.
Comment 14 Rafael J. Wysocki 2010-11-28 22:36:59 UTC
Handled-By : Alan Stern <stern@rowland.harvard.edu>
Patch : https://bugzilla.kernel.org/attachment.cgi?id=38372
Comment 15 Rafael J. Wysocki 2010-12-03 21:30:40 UTC
On Friday, December 03, 2010, Alan Stern wrote:
> On Fri, 3 Dec 2010, Rafael J. Wysocki wrote:
> 
> > This message has been generated automatically as a part of a summary report
> > of recent regressions.
> > 
> > The following bug entry is on the current list of known regressions
> > from 2.6.36.  Please verify if it still should be listed and let the
> tracking team
> > know (either way).
> > 
> > 
> > Bug-Entry   : http://bugzilla.kernel.org/show_bug.cgi?id=23012
> > Subject             : ftdi_sio /dev/ttyUSB error:  "Resource Temporarily
> Unavailable"
> > Submitter   : Kevin Smith <thirdwiggin@gmail.com>
> > Date                : 2010-11-16 06:25 (17 days old)
> > Handled-By  : Alan Stern <stern@rowland.harvard.edu>
> > Patch               : https://bugzilla.kernel.org/attachment.cgi?id=38372
> 
> This has been fixed by commit bf03184a31a3286fc0ab30f838ddee8ba9f9b7b 
> (USB: fix autosuspend bug in usb-serial).
Comment 16 Ozan Caglayan 2011-01-27 07:48:25 UTC
This is still happening for at least Keyspan USA-19H and many 3G sticks using the option driver on stable 2.6.37.
Comment 17 Alan Stern 2011-01-27 15:29:06 UTC
It can't be the same thing, because 2.6.37 includes the bug fix above.  It must be a different problem.

An additional, related problem has shown up in the meantime.  It would affect some devices using the keyspan driver but not the option driver.  The fix is posted here:

   http://marc.info/?l=linux-usb&m=129477341409005&w=2
Comment 18 Ozan Caglayan 2011-01-27 16:49:35 UTC
Hm, will try that patch thanks. I'll google for the 3g sticks' problems.