mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ttyS0 stuck in tty_wait_until_sent when sending break (opened with O_NONBLOCK)
@ 2011-11-06 10:27 Domen Puncer
  2011-11-15 19:02 ` Domen Puncer
  0 siblings, 1 reply; 2+ messages in thread
From: Domen Puncer @ 2011-11-06 10:27 UTC (permalink / raw)
  To: linux-kernel

Hello!

I'm not able to create a simple program, that would reproduce this
problem, but calling OW_init()
from libowcapi and with nothing plugged into serial seems to always do
the trick.

$ cat /proc/`pidof test`/wchan; echo
tty_wait_until_sent

$ uname -a
Linux river 3.0-ARCH #1 SMP PREEMPT Wed Oct 19 10:27:51 CEST 2011
x86_64 Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz GenuineIntel
GNU/Linux
But I've also seen this on an older mips kernel.

Is there any way I can assist hunting this down?
I'll try harder to make a simple test program, if the strace output
doesn't produce any ideas.


strace output:

open("/dev/ttyS0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
ioctl(3, TCSBRK, 0)                     = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999995})
write(3, "\301", 1)                     = 1
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 4000000}, 0x7fff2d209ba0) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "q", 1)                        = 1
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\17", 1)                      = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\305", 1)                     = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 400000000}, 0x7fff2d209ba0) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999997})
write(3, "q", 1)                        = 1
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\17", 1)                      = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\305", 1)                     = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 4000000}, 0x7fff2d209ba0) = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999997})
write(3, "E", 1)                        = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
close(3)                                = 0
open("/dev/ttyS0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
ioctl(3, TCSBRK, 0)                     = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999996})
write(3, "\301", 1)                     = 1
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 4000000}, 0x7fff2d209ba0) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "q", 1)                        = 1
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\17", 1)                      = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\305", 1)                     = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 400000000}, 0x7fff2d209ba0) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999997})
write(3, "q", 1)                        = 1
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
nanosleep({0, 5000000}, 0x7fff2d209b20) = 0
select(4, [3], NULL, NULL, {0, 1000})   = 0 (Timeout)
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999998})
write(3, "\17", 1)                      = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
ioctl(3, TCFLSH, 0x2)                   = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999997})
write(3, "\305", 1)                     = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
nanosleep({0, 4000000}, 0x7fff2d209ba0) = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999995})
write(3, "E", 1)                        = 1
ioctl(3, TCSBRK, 0x1)                   = 0
select(4, [3], NULL, NULL, {5, 0})      = 0 (Timeout)
ioctl(3, TCSBRK, 0x1)                   = 0
close(3)                                = 0
open("/dev/ttyS0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF,
{B9600 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
ioctl(3, TCSBRK, 0)                     = 0
select(4, NULL, [3], NULL, {5, 0})      = 1 (out [3], left {4, 999997})
write(3, "\301", 1)                     = 1
ioctl(3, TCSBRK <unfinished ...>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ttyS0 stuck in tty_wait_until_sent when sending break (opened with O_NONBLOCK)
  2011-11-06 10:27 ttyS0 stuck in tty_wait_until_sent when sending break (opened with O_NONBLOCK) Domen Puncer
@ 2011-11-15 19:02 ` Domen Puncer
  0 siblings, 0 replies; 2+ messages in thread
From: Domen Puncer @ 2011-11-15 19:02 UTC (permalink / raw)
  To: linux-kernel

On Sun, Nov 6, 2011 at 11:27, Domen Puncer <domen@cba.si> wrote:
> write(3, "\301", 1)                     = 1
> ioctl(3, TCSBRK <unfinished ...>
>

Traced this down to flow control. And ioctl(fd, TCSBRK, 1) is tcdrain,
so it waited.

Sorry for the noise.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-15 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-06 10:27 ttyS0 stuck in tty_wait_until_sent when sending break (opened with O_NONBLOCK) Domen Puncer
2011-11-15 19:02 ` Domen Puncer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®