Bug 90442 - Using a USB FTDI device hangs system
Summary: Using a USB FTDI device hangs system
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel   
(Show other bugs)
Version: 9
Hardware: i686 Linux
Target Milestone: ---
Assignee: Pete Zaitcev
QA Contact: Brian Brock
: 91272 101905 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2003-05-08 12:35 UTC by Trevor Spiteri
Modified: 2007-04-18 16:53 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-01-07 19:18:28 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to make Falcom Twist USB work with ftdi_sio driver (3.81 KB, patch)
2003-05-08 12:36 UTC, Trevor Spiteri
no flags Details | Diff
Trace shown on console when the kernel panics (2.32 KB, text/plain)
2003-05-08 12:37 UTC, Trevor Spiteri
no flags Details
Patch which removes low latency (358 bytes, text/plain)
2003-05-08 12:38 UTC, 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 08:26 UTC, 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 08:28 UTC, Trevor Spiteri
no flags Details
Remove low latency (2.4.20-18.9) (476 bytes, patch)
2003-06-05 08:29 UTC, Trevor Spiteri
no flags Details | Diff
Something to think about - helper process (us1) (8.38 KB, patch)
2003-11-16 02:26 UTC, Pete Zaitcev
no flags Details | Diff

Description Trevor Spiteri 2003-05-08 12:35:01 UTC
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):

How reproducible:

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 12:36:21 UTC
Created attachment 91557 [details]
Patch to make Falcom Twist USB work with ftdi_sio driver

Comment 2 Trevor Spiteri 2003-05-08 12:37:56 UTC
Created attachment 91558 [details]
Trace shown on console when the kernel panics

Comment 3 Trevor Spiteri 2003-05-08 12:38:58 UTC
Created attachment 91559 [details]
Patch which removes low latency

Comment 4 Pete Zaitcev 2003-05-08 20:37:30 UTC
This is interesting, grabbing and leaving Arjan on cc:.

Comment 5 Greg Kroah-Hartman 2003-05-08 21:03:00 UTC
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 06:17:11 UTC
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 16:37:03 UTC
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 21:01:55 UTC
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 08:24:37 UTC
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 08:26:43 UTC
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 08:28:19 UTC
Created attachment 92155 [details]
Trace shown on console when the kernel panics (2.4.20-18.9)

Comment 12 Trevor Spiteri 2003-06-05 08:29:56 UTC
Created attachment 92156 [details]
Remove low latency (2.4.20-18.9)

Comment 13 Pete Zaitcev 2003-06-06 01:01:44 UTC
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-06 01:04:06 UTC
*** Bug 91272 has been marked as a duplicate of this bug. ***

Comment 15 Trevor Spiteri 2003-06-06 06:05:52 UTC
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 16:59:21 UTC
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-16 02:26:07 UTC
Created attachment 96004 [details]
Something to think about - helper process (us1)

Comment 18 Pete Zaitcev 2003-11-16 02:32:29 UTC
*** Bug 101905 has been marked as a duplicate of this bug. ***

Comment 19 Pete Zaitcev 2003-11-24 22:53:13 UTC
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-25 00:41:31 UTC
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 10:53:20 UTC
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-27 03:13:39 UTC
Seems to work ok for me.  Thanks!

Comment 23 Pete Zaitcev 2003-12-23 21:05:36 UTC
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 19:18:28 UTC
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.