public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* xterm loses data (pty regression)
@ 2009-08-10 15:29 Artur Skawina
  2009-08-10 17:07 ` Ray Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Artur Skawina @ 2009-08-10 15:29 UTC (permalink / raw)
  To: LKML

[I have now gone back to 2.6.30.3 and the writes to the ptys do block there,
 so it's a recent regression.]

First noticed it after upgrading to v2.6.31-rc5-246-g90bc1a6, still happens
in rc5-381-g7b2aa03.
If i press ^S in an xterm the output stops as expected, but after a ^Q i see
only the newly written data, everything in between is lost. Like:

> for i in `seq 1 111`; do echo $i; sleep 1; done
1
2
3
4
9
10
11
12
13
^C

[typed ^S after '4', then ^Q after a few seconds]

If the command doing the printing exits before the ^Q is sent, i don't get
any reaction to the ^Q at all, which is why i initially thought it to be an
xserver bug.
Text consoles are unaffected, output resumes as it should.

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


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

* Re: xterm loses data (pty regression)
  2009-08-10 15:29 xterm loses data (pty regression) Artur Skawina
@ 2009-08-10 17:07 ` Ray Lee
  2009-08-10 17:18   ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Ray Lee @ 2009-08-10 17:07 UTC (permalink / raw)
  To: Artur Skawina, Linus Torvalds, Alan Cox, Rafael J. Wysocki; +Cc: LKML

[ adding CC:s ]

On Mon, Aug 10, 2009 at 8:29 AM, Artur Skawina <art.08.09@gmail.com> wrote:
>
> [I have now gone back to 2.6.30.3 and the writes to the ptys do block there,
>  so it's a recent regression.]
>
> First noticed it after upgrading to v2.6.31-rc5-246-g90bc1a6, still happens
> in rc5-381-g7b2aa03.
> If i press ^S in an xterm the output stops as expected, but after a ^Q i see
> only the newly written data, everything in between is lost. Like:
>
> > for i in `seq 1 111`; do echo $i; sleep 1; done
> 1
> 2
> 3
> 4
> 9
> 10
> 11
> 12
> 13
> ^C
>
> [typed ^S after '4', then ^Q after a few seconds]
>
> If the command doing the printing exits before the ^Q is sent, i don't get
> any reaction to the ^Q at all, which is why i initially thought it to be an
> xserver bug.
> Text consoles are unaffected, output resumes as it should.
>
> artur

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

* Re: xterm loses data (pty regression)
  2009-08-10 17:07 ` Ray Lee
@ 2009-08-10 17:18   ` Linus Torvalds
  2009-08-10 17:27     ` Alan Cox
  2009-08-10 18:07     ` Linus Torvalds
  0 siblings, 2 replies; 7+ messages in thread
From: Linus Torvalds @ 2009-08-10 17:18 UTC (permalink / raw)
  To: Ray Lee; +Cc: Artur Skawina, Alan Cox, Rafael J. Wysocki, LKML



On Mon, 10 Aug 2009, Ray Lee wrote:
> On Mon, Aug 10, 2009 at 8:29 AM, Artur Skawina <art.08.09@gmail.com> wrote:
> >
> > First noticed it after upgrading to v2.6.31-rc5-246-g90bc1a6, still happens
> > in rc5-381-g7b2aa03.
> > If i press ^S in an xterm the output stops as expected, but after a ^Q i see
> > only the newly written data, everything in between is lost. 

Yup, I can confirm that. 

> > > for i in `seq 1 111`; do echo $i; sleep 1; done

(Do ^S/^Q, see data loss)

Will take a look asap, thanks. Although I bet it's the same old commit 
(d945cb9cc: "pty: Rework the pty layer to use the normal buffering logic") 
again.

			Linus

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

* Re: xterm loses data (pty regression)
  2009-08-10 17:18   ` Linus Torvalds
@ 2009-08-10 17:27     ` Alan Cox
  2009-08-10 18:07     ` Linus Torvalds
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Cox @ 2009-08-10 17:27 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ray Lee, Artur Skawina, Rafael J. Wysocki, LKML

On Mon, 10 Aug 2009 10:18:41 -0700 (PDT)
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> 
> 
> On Mon, 10 Aug 2009, Ray Lee wrote:
> > On Mon, Aug 10, 2009 at 8:29 AM, Artur Skawina <art.08.09@gmail.com> wrote:
> > >
> > > First noticed it after upgrading to v2.6.31-rc5-246-g90bc1a6, still happens
> > > in rc5-381-g7b2aa03.
> > > If i press ^S in an xterm the output stops as expected, but after a ^Q i see
> > > only the newly written data, everything in between is lost. 
> 
> Yup, I can confirm that. 
> 
> > > > for i in `seq 1 111`; do echo $i; sleep 1; done
> 
> (Do ^S/^Q, see data loss)
> 
> Will take a look asap, thanks. Although I bet it's the same old commit 
> (d945cb9cc: "pty: Rework the pty layer to use the normal buffering logic") 
> again.

My guess too. The old pty code abuses throttle/unthrottle in odd ways.

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

* Re: xterm loses data (pty regression)
  2009-08-10 17:18   ` Linus Torvalds
  2009-08-10 17:27     ` Alan Cox
@ 2009-08-10 18:07     ` Linus Torvalds
  2009-08-10 19:08       ` Artur Skawina
  1 sibling, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2009-08-10 18:07 UTC (permalink / raw)
  To: Ray Lee; +Cc: Artur Skawina, Alan Cox, Rafael J. Wysocki, LKML



On Mon, 10 Aug 2009, Linus Torvalds wrote:
> 
> On Mon, 10 Aug 2009, Ray Lee wrote:
> > On Mon, Aug 10, 2009 at 8:29 AM, Artur Skawina <art.08.09@gmail.com> wrote:
> > >
> > > First noticed it after upgrading to v2.6.31-rc5-246-g90bc1a6, still happens
> > > in rc5-381-g7b2aa03.
> > > If i press ^S in an xterm the output stops as expected, but after a ^Q i see
> > > only the newly written data, everything in between is lost. 
> 
> Yup, I can confirm that. 
> 
> > > > for i in `seq 1 111`; do echo $i; sleep 1; done
> 
> (Do ^S/^Q, see data loss)
> 
> Will take a look asap, thanks. Although I bet it's the same old commit 
> (d945cb9cc: "pty: Rework the pty layer to use the normal buffering logic") 
> again.

I think it's really this trivial.

That pty commit removed the checking for tty->stopped in 
pty_write_buffer() for no clear reason. And when it did that, it broke all 
the pausing logic in drivers/char/n_tty.c.

Can you confirm?

		Linus

---
 drivers/char/pty.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 6e6942c..d083c73 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -144,6 +144,8 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf,
 
 static int pty_write_room(struct tty_struct *tty)
 {
+	if (tty->stopped)
+		return 0;
 	return pty_space(tty->link);
 }
 

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

* Re: xterm loses data (pty regression)
  2009-08-10 18:07     ` Linus Torvalds
@ 2009-08-10 19:08       ` Artur Skawina
  2009-08-10 23:12         ` Artur Skawina
  0 siblings, 1 reply; 7+ messages in thread
From: Artur Skawina @ 2009-08-10 19:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ray Lee, Alan Cox, Rafael J. Wysocki, LKML

Linus Torvalds wrote:
> 
>> (Do ^S/^Q, see data loss)

> I think it's really this trivial.
> 
> That pty commit removed the checking for tty->stopped in 
> pty_write_buffer() for no clear reason. And when it did that, it broke all 
> the pausing logic in drivers/char/n_tty.c.
> 
> Can you confirm?

>  static int pty_write_room(struct tty_struct *tty)
>  {
> +	if (tty->stopped)
> +		return 0;
>  	return pty_space(tty->link);
>  }

w/ this, the pty writes now block again after ^Q, and the data loss is gone.

Thanks,

artur

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

* Re: xterm loses data (pty regression)
  2009-08-10 19:08       ` Artur Skawina
@ 2009-08-10 23:12         ` Artur Skawina
  0 siblings, 0 replies; 7+ messages in thread
From: Artur Skawina @ 2009-08-10 23:12 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ray Lee, Alan Cox, Rafael J. Wysocki, LKML

Artur Skawina wrote:
>Linus Torvalds wrote:
>> 
>>  static int pty_write_room(struct tty_struct *tty)
>>  {
>> +	if (tty->stopped)
>> +		return 0;
>>  	return pty_space(tty->link);
>>  }
> 
> w/ this, the pty writes now block again after ^Q, and the data loss is gone.

What i meant was "...pty writes now block again after ^S...", sorry.

artur

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

end of thread, other threads:[~2009-08-10 23:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10 15:29 xterm loses data (pty regression) Artur Skawina
2009-08-10 17:07 ` Ray Lee
2009-08-10 17:18   ` Linus Torvalds
2009-08-10 17:27     ` Alan Cox
2009-08-10 18:07     ` Linus Torvalds
2009-08-10 19:08       ` Artur Skawina
2009-08-10 23:12         ` Artur Skawina

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