Bug 90442 - Using a USB FTDI device hangs system
Using a USB FTDI device hangs system
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
9
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Pete Zaitcev
Brian Brock
:
: 91272 101905 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-05-08 08:35 EDT by Trevor Spiteri
Modified: 2007-04-18 12:53 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-07 14:18:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch to make Falcom Twist USB work with ftdi_sio driver (3.81 KB, patch)
2003-05-08 08:36 EDT, Trevor Spiteri
no flags Details | Diff
Trace shown on console when the kernel panics (2.32 KB, text/plain)
2003-05-08 08:37 EDT, Trevor Spiteri
no flags Details
Patch which removes low latency (358 bytes, text/plain)
2003-05-08 08:38 EDT, Trevor Spiteri
no flags Details
Make Falcom Twist USB work with ftdi_sio driver (2.4.20-18.9) (7.39 KB, patch)
2003-06-05 04:26 EDT, Trevor Spiteri
no flags Details | Diff
Trace shown on console when the kernel panics (2.4.20-18.9) (2.50 KB, text/plain)
2003-06-05 04:28 EDT, Trevor Spiteri
no flags Details
Remove low latency (2.4.20-18.9) (476 bytes, patch)
2003-06-05 04:29 EDT, Trevor Spiteri
no flags Details | Diff
Something to think about - helper process (us1) (8.38 KB, patch)
2003-11-15 21:26 EST, Pete Zaitcev
no flags Details | Diff

  None (edit)
Description Trevor Spiteri 2003-05-08 08:35:01 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
I have a Falcom Twist USB modem (vid=0x0f94, pid=0x0001) which uses the FTDI
chip. Its id is not in the ftdi_sio.o module, so I copied ftdi_sio.c to
ftdi_twist.c and patched it a little (patch attached). After I install the
module, I plug the device and try to open /dev/ttyUSB0 with minicom. The sytem
hangs (trace attached).

I found that the ftdi_sio driver calls tty_flip_buffer_push() in the function
ftdi_read_bulk_callback(). ftdi_read_bulk_callback() is called in an interrupt
(testing in_interrupt() returns 1). The FTDI SIO driver sets low latency, so
tty_flip_buffer_push() calls flush_to_ldisc() immediately. I think that this
should not be called in an interrupt.

I modified the driver a bit further with a second patch (patch2 attached) to
remove its low latency and now the modem seems to work.

Note: To compile, I use:
cc -c -D__KERNEL__ -DMODULE -I/lib/modules/2.4.20-9/build/drivers/usb/serial -I
/lib/modules/2.4.20-9/build/include -Wall -O2 ftdi_twist.c -o ftdi_twist.o

Version-Release number of selected component (if applicable):
kernel-2.4.20-9

How reproducible:
Always

Steps to Reproduce:
1. Put ftdi_twist.o into /lib/modules/2.4.20-9/kernel/drivers/misc/
2. Run depmod -a
3. Plug in Falcom Twist USB device
4. Run minicom on /dev/ttyUSB0


Additional info:
Comment 1 Trevor Spiteri 2003-05-08 08:36:21 EDT
Created attachment 91557 [details]
Patch to make Falcom Twist USB work with ftdi_sio driver
Comment 2 Trevor Spiteri 2003-05-08 08:37:56 EDT
Created attachment 91558 [details]
Trace shown on console when the kernel panics
Comment 3 Trevor Spiteri 2003-05-08 08:38:58 EDT
Created attachment 91559 [details]
Patch which removes low latency
Comment 4 Pete Zaitcev 2003-05-08 16:37:30 EDT
This is interesting, grabbing and leaving Arjan on cc:.
Comment 5 Greg Kroah-Hartman 2003-05-08 17:03:00 EDT
Why do you not think it is ok to call flush_to_ldisc() from interrupt context?

It looks legal to me, and is required for usb-serial devices to handle high data
rates (the visor driver will drop bytes unless it is used.)
Comment 6 Trevor Spiteri 2003-05-09 02:17:11 EDT
I am not that familiar with flush_to_ldisc() and other such functions. I only
made that comment because if I remove low latency from the driver the kernel
does not crash. It can be that there is a bug somewhere else which is trigerred
by some legal behaviour here.
Comment 7 Pete Zaitcev 2003-06-04 12:37:03 EDT
Is 2.4.20-18 any better? Please try it. It may even have your IDs,
and another user reports that it works for him now.
Comment 8 Joseph Shraibman 2003-06-04 17:01:55 EDT
I have a FTDI usb to serial cable, not a USB modem.  I haven't even used it
much, just tried to get it to work with my palm sync cradle.
Comment 9 Trevor Spiteri 2003-06-05 04:24:37 EDT
Neither 2.4.20-13.9 nor 2.4.20-18.9 solve the problem.

As a note, on another PC I do not see this problem. But on this PC, it still
crashes invariably.

I am attaching new patches and trace for new kernel (2.4.20-18.9).
Comment 10 Trevor Spiteri 2003-06-05 04:26:43 EDT
Created attachment 92154 [details]
Make Falcom Twist USB work with ftdi_sio driver (2.4.20-18.9)
Comment 11 Trevor Spiteri 2003-06-05 04:28:19 EDT
Created attachment 92155 [details]
Trace shown on console when the kernel panics (2.4.20-18.9)
Comment 12 Trevor Spiteri 2003-06-05 04:29:56 EDT
Created attachment 92156 [details]
Remove low latency (2.4.20-18.9)
Comment 13 Pete Zaitcev 2003-06-05 21:01:44 EDT
Trevor, does that last patch work? I think the usbserial.c
sets the tty->low_latency upon open no matter what.
Anyway, I think this needs a major surgery in usbserial.c
and possibly all subcomponent drivers.
Comment 14 Pete Zaitcev 2003-06-05 21:04:06 EDT
*** Bug 91272 has been marked as a duplicate of this bug. ***
Comment 15 Trevor Spiteri 2003-06-06 02:05:52 EDT
Yes, the last patch works for me for this device.

In usbserial.c, low latency is set in generic_open(). In ftdi_sio.c (or
ftdi_twist.c in my case), ftdi_open() and set_serial_info() both contain the line:
	port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
So I guess it resets the low latency flag.
Comment 16 Pete Zaitcev 2003-06-06 12:59:21 EDT
Date: Fri, 06 Jun 2003 10:03:44 -0500
From: Gregory Gulik <greg@gulik.org>

Just to let you know but I rebooted into the 2.4.20-18.9.athlon kernel
and it's working just fine.
                                                                                
dmesg output attached.  You'll see that the usbserial code for the
attached Palm device is configured but I unload it in my rc.local
because all my syncing is done in a Windows/VMware session.
Comment 17 Pete Zaitcev 2003-11-15 21:26:07 EST
Created attachment 96004 [details]
Something to think about - helper process (us1)
Comment 18 Pete Zaitcev 2003-11-15 21:32:29 EST
*** Bug 101905 has been marked as a duplicate of this bug. ***
Comment 19 Pete Zaitcev 2003-11-24 17:53:13 EST
I sent a reference to a test RPM to everyone involved,
got only one reply from Colin.

OK, people, here's the deal. I don't have the hardware, so
I cannot test. If you don't test, I'm not commiting anything
anywhere, and don't forget - Greg is not taking anything for 2.4.
I'll let this pile to fester for a week, and if no interest
surfaces, ->WONTFIX.
Comment 20 Greg Kroah-Hartman 2003-11-24 19:41:31 EST
Greg is taking 2.4 patches, just not sending them off during the -rc
series.  When 2.4.23 comes back, I'll send more patches off that fix
bugs, and backport 2.6 changes.
Comment 21 Trevor Spiteri 2003-11-26 05:53:20 EST
I tried the test rpm and it seems to solve the problem for me. The
steps that crash the other kernels do not crash the test kernel.
Comment 22 Gregory Gulik 2003-11-26 22:13:39 EST
Seems to work ok for me.  Thanks!
Comment 23 Pete Zaitcev 2003-12-23 16:05:36 EST
Halleluya, modified in 2.4.22-1.2136.
Just use Fedora kernels for now, they should be compatible with RHL 9.
Comment 24 Pete Zaitcev 2004-01-07 14:18:28 EST
DaveJ included the fix in 2.4.22-1.2138, posted 2004/01/05.
Self-closing (too many requestors - nobody is closing).

Note You need to log in before you can comment on or make changes to this bug.