Fwd: PROBLEM: serial port receive buffers not being flushed properly

2007-07-27 Thread Paul Fulghum
From: [EMAIL PROTECTED]
> [1.] PROBLEM: serial port receive buffers not being flushed properly
> [2.] After calling tcflush() or ioctl() with the TCFLSH argument,
> an ioctl() with the FIONREAD argument reports 0 bytes available
> for reading. However, a subsequent select() and read() of the port
> returns data. This problem is seen in 2.6.21.1 and 2.6.20,
> but is not seen in version 2.6.17.14. Other versions have
> not been tested.

There is receive buffering between the serial driver and
line discipline. The line discipline processes FIONREAD
and TCFLSH with regard to the line discipline receive
buffers but not the intermediate buffering.

In 2.6.17 the intermediate buffering pushed
receive data to the line discipline without
regard for tty->receive_room, so if the ldisc buffers
were full the data was lost.

In 2.6.18 the intermediate buffering was changed to
hold receive data until the line discipline could
accept it.

So in 2.6.17 all the extra data you sent was simply
discarded and flushing the ldisc buffers cleared all
of the receive data. Starting with 2.6.18, flushing the
ldisc buffers just allowed the intermediate buffering to
start feeding more data to the ldisc. This results in the
receive data you see after a TCFLSH.

Starting with 2.6.22 TCFLSH is processed by the intermediate
buffering as well as the ldisc to eliminate any remaining
receive data in the intermediate buffering.


--
Paul Fulghum
Microgate Systems, Ltd

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Fwd: PROBLEM: serial port receive buffers not being flushed properly

2007-07-27 Thread Russell King
Please reply to the original poster.

- Forwarded message from [EMAIL PROTECTED] -

From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: PROBLEM: serial port receive buffers not being flushed properly
Date: Fri, 27 Jul 2007 14:51:00 +

See attached .txt and .c files.
Use that information to fill in all fields of the bug report form, and
post it to the mailing list with a subject of "PROBLEM: " for easy identification by the developers.

[1.] PROBLEM: serial port receive buffers not being flushed properly
[2.] After calling tcflush() or ioctl() with the TCFLSH argument, an ioctl()
with the FIONREAD argument reports 0 bytes available for reading.
However, a subsequent select() and read() of the port returns data.
This problem is seen in 2.6.21.1 and 2.6.20, but is not seen in
version 2.6.17.14. Other versions have not been tested. 
[3.] keywords: serial buffer flush
[4.] Kernel version (from /proc/version): 2.6.21.1
[5.] Most recent kernel version which did not have the bug: 2.6.17.14 (others 
between 2.6.17.14 and 2.6.20 not checked)
[6.] No OOPs message applicable.
[7.] See attached source file com_buffer_test.c
[8.] Environment
[8.1.] Linux Pohaku 2.6.21.1 #1 PREEMPT Thu Jul 12 14:43:22 CDT 2007 i486 
GNU/Linux
 
Gnu C  3.3.5
Gnu make   3.80
binutils   2.15
util-linux 2.12p
mount  2.12p
module-init-tools  3.2-pre1
e2fsprogs  1.37
pcmcia-cs  3.2.5
Linux C Library2.3.2
Dynamic linker (ldd)   2.3.2
Procps 3.2.1
Net-tools  1.60
Console-tools  0.2.3
Sh-utils   5.2.1
udev   056
Modules Loaded ipv6 e100 mii genrtc ext3 jbd ide_disk ide_generic 
ns87415 piix siimage sc1200 generic cy82c693 cs5530 sis5513 via82cxxx rz1000 
slc90e66 cmd64x pdc202xx_old hpt34x opti621 trm290 amd74xx hpt366 serverworks 
atiixp aec62xx triflex alim15x3 pdc202xx_new cs5520 ide_core unix
[8.2.] Processor information (from /proc/cpuinfo):
processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 4
model   : 9
model name  : 486 DX/4-WB
stepping: 4
fdiv_bug: no
hlt_bug : no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 1
wp  : yes
flags   : fpu
bogomips: 49.40
clflush size: 32
[8.3.] Module information (from /proc/modules):
ipv6 234848 10 - Live 0xc4c44000
e100 31632 0 - Live 0xc4bbb000
mii 5152 1 e100, Live 0xc4b83000
genrtc 9420 0 - Live 0xc4b99000
ext3 120392 1 - Live 0xc4bdf000
jbd 55976 1 ext3, Live 0xc4bac000
ide_disk 15808 2 - Live 0xc4b94000
ide_generic 1152 0 [permanent], Live 0xc4b81000
ns87415 3956 0 [permanent], Live 0xc487d000
piix 9764 0 [permanent], Live 0xc4b8a000
siimage 10912 0 [permanent], Live 0xc4b86000
sc1200 5152 0 [permanent], Live 0xc487a000
generic 4744 0 [permanent], Live 0xc4872000
cy82c693 4292 0 [permanent], Live 0xc486f000
cs5530 5056 0 [permanent], Live 0xc4867000
sis5513 14568 0 [permanent], Live 0xc4875000
via82cxxx 8676 0 [permanent], Live 0xc486b000
rz1000 2560 0 [permanent], Live 0xc482b000
slc90e66 5344 0 [permanent], Live 0xc4864000
cmd64x 10012 0 [permanent], Live 0xc4837000
pdc202xx_old 9408 0 [permanent], Live 0xc486
hpt34x 4672 0 [permanent], Live 0xc4834000
opti621 4228 0 [permanent], Live 0xc4831000
trm290 3748 0 [permanent], Live 0xc4829000
amd74xx 13308 0 [permanent], Live 0xc485b000
hpt366 15808 0 [permanent], Live 0xc4856000
serverworks 8264 0 [permanent], Live 0xc482d000
atiixp 6064 0 [permanent], Live 0xc4826000
aec62xx 7200 0 [permanent], Live 0xc4812000
triflex 3584 0 [permanent], Live 0xc481d000
alim15x3 11276 0 [permanent], Live 0xc4822000
pdc202xx_new 7744 0 [permanent], Live 0xc480c000
cs5520 4448 0 [permanent], Live 0xc480f000
ide_core 103204 27 
ide_disk,ide_generic,ns87415,piix,siimage,sc1200,generic,cy82c693,cs5530,sis5513,via82cxxx,rz1000,slc90e66,cmd64x,pdc202xx_old,hpt34x,opti621,trm290,amd74xx,hpt366,serverworks,atiixp,aec62xx,triflex,alim15x3,pdc202xx_new,cs5520,
 Live 0xc483b000
unix 25808 2 - Live 0xc4815000

[8.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
01f0-01f7 : ide0
02e8-02ef : serial
02f8-02ff : serial
03c0-03df : vesafb
03e8-03ef : serial
03f6-03f6 : ide0
03f8-03ff : serial
0cf8-0cff : PCI conf1
f900-f9ff : :00:11.0
fd00-fd3f : :00:10.0
  fd00-fd3f : e100

-0009e3ff : System RAM
0009e400-0009 : reserved
000a-000b : Video RAM area
000c-000c : Video ROM
000f-000f : System ROM
0010-03ff : System RAM
  0010-0026df65 : Kernel code
  

Fwd: PROBLEM: serial port receive buffers not being flushed properly

2007-07-27 Thread Paul Fulghum
From: [EMAIL PROTECTED]
 [1.] PROBLEM: serial port receive buffers not being flushed properly
 [2.] After calling tcflush() or ioctl() with the TCFLSH argument,
 an ioctl() with the FIONREAD argument reports 0 bytes available
 for reading. However, a subsequent select() and read() of the port
 returns data. This problem is seen in 2.6.21.1 and 2.6.20,
 but is not seen in version 2.6.17.14. Other versions have
 not been tested.

There is receive buffering between the serial driver and
line discipline. The line discipline processes FIONREAD
and TCFLSH with regard to the line discipline receive
buffers but not the intermediate buffering.

In 2.6.17 the intermediate buffering pushed
receive data to the line discipline without
regard for tty-receive_room, so if the ldisc buffers
were full the data was lost.

In 2.6.18 the intermediate buffering was changed to
hold receive data until the line discipline could
accept it.

So in 2.6.17 all the extra data you sent was simply
discarded and flushing the ldisc buffers cleared all
of the receive data. Starting with 2.6.18, flushing the
ldisc buffers just allowed the intermediate buffering to
start feeding more data to the ldisc. This results in the
receive data you see after a TCFLSH.

Starting with 2.6.22 TCFLSH is processed by the intermediate
buffering as well as the ldisc to eliminate any remaining
receive data in the intermediate buffering.


--
Paul Fulghum
Microgate Systems, Ltd

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Fwd: PROBLEM: serial port receive buffers not being flushed properly

2007-07-27 Thread Russell King
Please reply to the original poster.

- Forwarded message from [EMAIL PROTECTED] -

From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: PROBLEM: serial port receive buffers not being flushed properly
Date: Fri, 27 Jul 2007 14:51:00 +

See attached .txt and .c files.
Use that information to fill in all fields of the bug report form, and
post it to the mailing list with a subject of PROBLEM: one line
summary from [1.] for easy identification by the developers.

[1.] PROBLEM: serial port receive buffers not being flushed properly
[2.] After calling tcflush() or ioctl() with the TCFLSH argument, an ioctl()
with the FIONREAD argument reports 0 bytes available for reading.
However, a subsequent select() and read() of the port returns data.
This problem is seen in 2.6.21.1 and 2.6.20, but is not seen in
version 2.6.17.14. Other versions have not been tested. 
[3.] keywords: serial buffer flush
[4.] Kernel version (from /proc/version): 2.6.21.1
[5.] Most recent kernel version which did not have the bug: 2.6.17.14 (others 
between 2.6.17.14 and 2.6.20 not checked)
[6.] No OOPs message applicable.
[7.] See attached source file com_buffer_test.c
[8.] Environment
[8.1.] Linux Pohaku 2.6.21.1 #1 PREEMPT Thu Jul 12 14:43:22 CDT 2007 i486 
GNU/Linux
 
Gnu C  3.3.5
Gnu make   3.80
binutils   2.15
util-linux 2.12p
mount  2.12p
module-init-tools  3.2-pre1
e2fsprogs  1.37
pcmcia-cs  3.2.5
Linux C Library2.3.2
Dynamic linker (ldd)   2.3.2
Procps 3.2.1
Net-tools  1.60
Console-tools  0.2.3
Sh-utils   5.2.1
udev   056
Modules Loaded ipv6 e100 mii genrtc ext3 jbd ide_disk ide_generic 
ns87415 piix siimage sc1200 generic cy82c693 cs5530 sis5513 via82cxxx rz1000 
slc90e66 cmd64x pdc202xx_old hpt34x opti621 trm290 amd74xx hpt366 serverworks 
atiixp aec62xx triflex alim15x3 pdc202xx_new cs5520 ide_core unix
[8.2.] Processor information (from /proc/cpuinfo):
processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 4
model   : 9
model name  : 486 DX/4-WB
stepping: 4
fdiv_bug: no
hlt_bug : no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 1
wp  : yes
flags   : fpu
bogomips: 49.40
clflush size: 32
[8.3.] Module information (from /proc/modules):
ipv6 234848 10 - Live 0xc4c44000
e100 31632 0 - Live 0xc4bbb000
mii 5152 1 e100, Live 0xc4b83000
genrtc 9420 0 - Live 0xc4b99000
ext3 120392 1 - Live 0xc4bdf000
jbd 55976 1 ext3, Live 0xc4bac000
ide_disk 15808 2 - Live 0xc4b94000
ide_generic 1152 0 [permanent], Live 0xc4b81000
ns87415 3956 0 [permanent], Live 0xc487d000
piix 9764 0 [permanent], Live 0xc4b8a000
siimage 10912 0 [permanent], Live 0xc4b86000
sc1200 5152 0 [permanent], Live 0xc487a000
generic 4744 0 [permanent], Live 0xc4872000
cy82c693 4292 0 [permanent], Live 0xc486f000
cs5530 5056 0 [permanent], Live 0xc4867000
sis5513 14568 0 [permanent], Live 0xc4875000
via82cxxx 8676 0 [permanent], Live 0xc486b000
rz1000 2560 0 [permanent], Live 0xc482b000
slc90e66 5344 0 [permanent], Live 0xc4864000
cmd64x 10012 0 [permanent], Live 0xc4837000
pdc202xx_old 9408 0 [permanent], Live 0xc486
hpt34x 4672 0 [permanent], Live 0xc4834000
opti621 4228 0 [permanent], Live 0xc4831000
trm290 3748 0 [permanent], Live 0xc4829000
amd74xx 13308 0 [permanent], Live 0xc485b000
hpt366 15808 0 [permanent], Live 0xc4856000
serverworks 8264 0 [permanent], Live 0xc482d000
atiixp 6064 0 [permanent], Live 0xc4826000
aec62xx 7200 0 [permanent], Live 0xc4812000
triflex 3584 0 [permanent], Live 0xc481d000
alim15x3 11276 0 [permanent], Live 0xc4822000
pdc202xx_new 7744 0 [permanent], Live 0xc480c000
cs5520 4448 0 [permanent], Live 0xc480f000
ide_core 103204 27 
ide_disk,ide_generic,ns87415,piix,siimage,sc1200,generic,cy82c693,cs5530,sis5513,via82cxxx,rz1000,slc90e66,cmd64x,pdc202xx_old,hpt34x,opti621,trm290,amd74xx,hpt366,serverworks,atiixp,aec62xx,triflex,alim15x3,pdc202xx_new,cs5520,
 Live 0xc483b000
unix 25808 2 - Live 0xc4815000

[8.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
01f0-01f7 : ide0
02e8-02ef : serial
02f8-02ff : serial
03c0-03df : vesafb
03e8-03ef : serial
03f6-03f6 : ide0
03f8-03ff : serial
0cf8-0cff : PCI conf1
f900-f9ff : :00:11.0
fd00-fd3f : :00:10.0
  fd00-fd3f : e100

-0009e3ff : System RAM
0009e400-0009 : reserved
000a-000b : Video RAM area
000c-000c : Video ROM
000f-000f : System ROM
0010-03ff : System RAM