Re: n_tty_write() going into schedule but NOT coming out

2013-04-02 Thread Ilya Zykov
Please, try this patch maybe it can help localize your problem. drivers/tty/n_tty.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 05e72be..28f15d0 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -230,6 +230,7 @@ static void reset

Re: [PATCH 03/18] tty: Simplify tty buffer/ldisc interface with helper function

2013-03-20 Thread Ilya Zykov
On 20.03.2013 21:49, Peter Hurley wrote: > The motivation for changing the workqueue api to allow parallel work > items on SMP was to fix a class of deadlocks where forward progress > could not be made due to subtle dependencies between work items > (actually that potential still exists with self-m

Re: [PATCH] tty: Fix race condition if flushing tty flip buffers

2013-03-20 Thread Ilya Zykov
On 20.03.2013 21:20, Peter Hurley wrote: > As Ilya Zykov identified in his patch 'PROBLEM: Race condition in > tty buffer's function flush_to_ldisc()', a race condition exists > which allows a parallel flush_to_ldisc() to flush and free the tty > flip buffers while th

Re: [PATCH 03/18] tty: Simplify tty buffer/ldisc interface with helper function

2013-03-20 Thread Ilya Zykov
>> I have little question about flush_to_ldisc(). >> Does can it be multithreaded? >> >> I think yes, because on SMP schedule_work() can work on different CPU >> paralleled. > > Yes, the same work item can now run in parallel on SMP since Tejun Heo > re-did the workqueue implementation on 2.6.36

Re: [PATCH 03/18] tty: Simplify tty buffer/ldisc interface with helper function

2013-03-19 Thread Ilya Zykov
). I have little question about flush_to_ldisc(). Does can it be multithreaded? I think yes, because on SMP schedule_work() can work on different CPU paralleled. What do you think about this race condition? https://lkml.org/lkml/2011/11/7/98 Thank you. Ilya Zykov -- To unsubscribe from this l

Re: [PATCH 6/7] n_tty: Fix unsafe update of available buffer space

2013-03-19 Thread Ilya Zykov
| tty->receive_room = left > > receive_room is now updated with a stale calculation of the > available buffer space, and the subsequent work loop will likely > overwrite unread data in the input buffer. > Sounds reasonable to me. Thank you. Ilya Zykov

Re: [PATCH 7/7] n_tty: Buffer work should not reschedule itself

2013-03-19 Thread Ilya Zykov
o me. Thank you. Ilya Zykov -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH] tty: Correct tty buffer flush.

2013-03-04 Thread Ilya Zykov
On 03.12.2012 13:54, Ilya Zykov wrote: > The root of problem is carelessly zeroing pointer(in function > __tty_buffer_flush()), > when another thread can use it. It can be cause of "NULL pointer dereference". > Main idea of the patch, this is never release last (struct

Re: [PATCH] n_tty: Unthrottle tty when flushing read buffer

2013-01-28 Thread Ilya Zykov
On 24.01.2013 2:36, Karthik Manamcheri wrote: > When the tty input buffer is full and thereby throttled, > flushing/resetting the read buffer should unthrottle to allow more > data to be received. > > Signed-off-by: Karthik Manamcheri > --- > drivers/tty/n_tty.c | 2 ++ > 1 file changed, 2 inser

Re: [next-20130118] Analyzing a call-trace reproducible with pm_test/freezer [ X86|RCU|TTY|EXT4FS|JBD2|PM related? ]

2013-01-19 Thread Ilya Zykov
On 20.01.2013 2:51, Sedat Dilek wrote: > On Sat, Jan 19, 2013 at 11:43 PM, Ilya Zykov wrote: >> Hello! >> I don't expert, but >> maybe it can help. >> >> I test with: >> while echo mem > /sys/power/state; do sleep 2; done >> in on

Re: [next-20130118] Analyzing a call-trace reproducible with pm_test/freezer [ X86|RCU|TTY|EXT4FS|JBD2|PM related? ]

2013-01-19 Thread Ilya Zykov
Hello! I don't expert, but maybe it can help. I test with: while echo mem > /sys/power/state; do sleep 2; done in one X-terminal, in other I trying playing with keyboard. (Without playing all right I use ext3.) And sometimes: WARNING: at drivers/tty/tty_buffer.c:427 flush_to_ldisc+0x52/0x192()

[PATCH] tty: Correct tty buffer flush.

2013-01-19 Thread Ilya Zykov
fer finding and buffer filling In order to delete the unneeded locks any more. Signed-off-by: Ilya Zykov --- drivers/tty/tty_buffer.c | 92 +++--- 1 files changed, 22 insertions(+), 70 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/

[PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2013-01-16 Thread Ilya Zykov
. Then there is no place to do writers wake up. Signed-off-by: Ilya Zykov --- drivers/tty/tty_ioctl.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 8481b29..cc0fc52 100644 --- a/drivers/tty/tty_ioctl.c +++

[PATCH] tty: Correct tty buffer flush.

2013-01-16 Thread Ilya Zykov
fer finding and buffer filling In order to delete the unneeded locks any more. Signed-off-by: Ilya Zykov --- drivers/tty/tty_buffer.c | 105 +- 1 files changed, 29 insertions(+), 76 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_

Re: [PATCH] tty: Fix ptmx open without closed slave.

2013-01-15 Thread Ilya Zykov
> > Ok, I have a ton of patches from you, lots of different threads, patches > with the same subject, and I don't know what one Alan agreed to. > > So, can you please resend what Alan and you agree should be applied to > the tree? > I think only two important: [PATCH v4] tty: Add driver unthr

Re: [PATCH] tty: Fix unreasonable write toward closed pty.

2012-12-19 Thread Ilya Zykov
On 19.12.2012 23:10, Alan Cox wrote: >> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c >> index a82b399..1ce1362 100644 >> --- a/drivers/tty/pty.c >> +++ b/drivers/tty/pty.c >> @@ -116,6 +116,8 @@ static int pty_space(struct tty_struct *to) >> >> static int pty_write(struct tty_struct *tty,

[PATCH] tty: Fix ptmx open without closed slave.

2012-12-19 Thread Ilya Zykov
When we are opening ptmx, we have closed pts, by description. Now only if we open and after close all pts' descriptions, pty_close() sets this bit correctly Signed-off-by: Ilya Zykov --- drivers/tty/pty.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/tty/

[PATCH] tty: Fix unreasonable write toward closed pty.

2012-12-19 Thread Ilya Zykov
We should not write toward the closed pty. Now it happens, if one side close last file descriptor, and other side in this moment write to it. It also prevents scheduling unnecessary work. Signed-off-by: Ilya Zykov --- drivers/tty/pty.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions

Re: [PATCH v2 00/11] tty: Fix buffer work access-after-free

2012-12-18 Thread Ilya Zykov
int_signal+0x12/0x17 --- /* * stress_test_tty.c * * Created on: Dec, 2012 * Copyright (C) 2012 Ilya Zykov * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the Lic

Re: [PATCH -next 0/9] tty: Fix buffer work access-after-free

2012-12-10 Thread Ilya Zykov
On 04.12.2012 11:07, Peter Hurley wrote: > > The most common cause stems from the n_tty_close() path spuriously > scheduling buffer work, when the ldisc has already been halted. > This is fixed in 'tty: Don't reschedule buffer work while closing' Thank you, very useful. Fix this: WARNING: at dr

Re: [BUG -next] cpufreq: cpufreq_governor.

2012-12-09 Thread Ilya Zykov
On 10.12.2012 3:08, Rafael J. Wysocki wrote: > On Sunday, December 09, 2012 09:17:04 PM Ilya Zykov wrote: >> On 05.12.2012 22:53, Ilya Zykov wrote: >>> What do I do wrong? >>> >>> After: modprobe cpufreq_ondemand >>> I have: >>> >>> W

Re: [BUG -next] cpufreq: cpufreq_governor.

2012-12-09 Thread Ilya Zykov
On 10.12.2012 3:08, Rafael J. Wysocki wrote: > On Sunday, December 09, 2012 09:17:04 PM Ilya Zykov wrote: >> On 05.12.2012 22:53, Ilya Zykov wrote: >>> What do I do wrong? >>> >>> After: modprobe cpufreq_ondemand >>> I have: >>> >>> W

Re: [BUG -next] cpufreq: cpufreq_governor.

2012-12-09 Thread Ilya Zykov
On 05.12.2012 22:53, Ilya Zykov wrote: > What do I do wrong? > > After: modprobe cpufreq_ondemand > I have: > > WARNING: Error inserting freq_table > (/lib/modules/3.7.0-rc8-next-20121205-ttybuf.1+/kernel/drivers/cpufreq/freq_table.ko): > Unknown symbol in module, o

Re: [BUG -next] cpufreq: cpufreq_governor.

2012-12-05 Thread Ilya Zykov
What do I do wrong? After: modprobe cpufreq_ondemand I have: WARNING: Error inserting freq_table (/lib/modules/3.7.0-rc8-next-20121205-ttybuf.1+/kernel/drivers/cpufreq/freq_table.ko): Unknown symbol in module, or unknown parameter (see dmesg) FATAL: Error inserting cpufreq_ondemand (/lib/modul

[BUG -next] cpufreq: cpufreq_governor.

2012-12-05 Thread Ilya Zykov
What do I do wrong? After: modprobe cpufreq_ondemand I have: WARNING: Error inserting freq_table (/lib/modules/3.7.0-rc8-next-20121205-ttybuf.1+/kernel/drivers/cpufreq/freq_table.ko): Unknown symbol in module, or unknown parameter (see dmesg) FATAL: Error inserting cpufreq_ondemand (/lib/modul

[PATCH -next 2/2] tty: Correct tty buffer flush.

2012-12-05 Thread Ilya Zykov
ldisc(tty->buf.head->read = tty->buf.head->commit). At that moment driver can collect(write) data in buffer without conflict. It is repeat behavior of flush_to_ldisc(), only without feeding data to ldisc. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_buffer.c b/drivers/

[PATCH -next 2/2] tty: Correct tty buffer flush.

2012-12-05 Thread Ilya Zykov
tty: Correct tty buffer flush. Signed-off-by: Ilya Zykov --- drivers/tty/tty_buffer.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 7602df8..8ad 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers

[PATCH -next 1/2] tty: Correct tty buffer flush.

2012-12-05 Thread Ilya Zykov
Revert: tty: hold lock across tty buffer finding and buffer filling Signed-off-by: Ilya Zykov --- drivers/tty/tty_buffer.c | 94 +++--- 1 files changed, 22 insertions(+), 72 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c

[PATCH -next 0/2] tty: Correct tty buffer flush.

2012-12-05 Thread Ilya Zykov
oss tty buffer finding and buffer filling In order to delete the unneeded locks any more. Signed-off-by: Ilya Zykov -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: flush_to_ldisc accesses tty after free (was: [PATCH 21/21] TTY: move tty buffers to tty_port)

2012-12-04 Thread Ilya Zykov
On 01.12.2012 18:59, Peter Hurley wrote: > (cc'ing Ilya Zykov because the test jig below is based on > his test program from https://lkml.org/lkml/2012/11/29/368 -- just want > to give credit where credit is due) > > On Fri, 2012-11-30 at 18:52 -0500, Sasha Levin wrote: >

[PATCH] tty: Correct tty buffer flush.

2012-12-04 Thread Ilya Zykov
oss tty buffer finding and buffer filling In order to delete the unneeded locks any more. Signed-off-by: Ilya Zykov --- drivers/tty/tty_buffer.c | 96 +- 1 files changed, 27 insertions(+), 69 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/

Re: [PATCH] tty: Correct tty buffer flushing.

2012-12-04 Thread Ilya Zykov
On 04.12.2012 12:53, Alan Cox wrote: >> Main idea here - we never flash last (struct tty_buffer) in the >> active buffer. Only data for ldisc. (tty->buf.head->read = >> tty->buf.head->commit). At that moment driver can collect(write) data >> in buffer without conflict. > > This one I agree with (

Re: [PATCH -next 0/9] tty: Fix buffer work access-after-free

2012-12-03 Thread Ilya Zykov
On 04.12.2012 11:07, Peter Hurley wrote: > This patch series addresses the causes of flush_to_ldisc accessing > the tty after freeing. > I think, it is have sense only if you can take effect, with this patch or something like. I can't. :) Signed-off-by: Ilya Zykov --- diff --git

[PATCH] tty: Correct tty buffer flush.

2012-12-03 Thread Ilya Zykov
sta...@vger.kernel.org Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 6c9b7cd..4f02f9c 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tty_struct *tty) { st

Re: [PATCH] tty: Correct tty buffer flushing.

2012-11-29 Thread Ilya Zykov
On 29.11.2012 17:54, Alan Cox wrote: >> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c >> index 6c9b7cd..4f02f9c 100644 >> --- a/drivers/tty/tty_buffer.c >> +++ b/drivers/tty/tty_buffer.c >> @@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tty_struct *tty) >> { >>

Re: [PATCH] tty: Correct tty buffer flushing.

2012-11-29 Thread Ilya Zykov
On 29.11.2012 17:54, Alan Cox wrote: >> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c >> index 6c9b7cd..4f02f9c 100644 >> --- a/drivers/tty/tty_buffer.c >> +++ b/drivers/tty/tty_buffer.c >> @@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tty_struct *tty) >> { >>

Re: [PATCH] tty: Correct tty buffer flushing.

2012-11-29 Thread Ilya Zykov
On 29.11.2012 17:54, Alan Cox wrote: >> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c >> index 6c9b7cd..4f02f9c 100644 >> --- a/drivers/tty/tty_buffer.c >> +++ b/drivers/tty/tty_buffer.c >> @@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tty_struct *tty) >> { >>

Fwd: [PATCH] tty: Correct tty buffer flushing.

2012-11-28 Thread Ilya Zykov
Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 6c9b7cd..4f02f9c 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tty_struct *tty) { struct tt

[PATCH] tty: Correct tty buffer flushing.

2012-11-27 Thread Ilya Zykov
66813. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 6c9b7cd..4f02f9c 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tty_struct *tty) { struct tty_buffer *

Re: [PATCH v4] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-27 Thread Ilya Zykov
On 27.11.2012 21:24, Greg Kroah-Hartman wrote: > On Tue, Nov 27, 2012 at 10:14:33AM +0400, Ilya Zykov wrote: >> Sorry. More correct. > > In what way? Should I wait for the 6th version? :) > > thanks, > > greg k-h > No, if only you will accept: [PATCH]tty: Inco

[PATCH v4] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-26 Thread Ilya Zykov
ioctl(...,TCFLSH,..). Then there is no place to do writers wake up. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 12b1fa0..4071a8f 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -1096,12 +1096,16 @@ int tty_perform_flush(

[PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers.

2012-11-26 Thread Ilya Zykov
e adjustment for other drivers? Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 0fcfd98..d87f353 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1304,7 +1304,7 @@ static void uart_close(st

[PATCH v3] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-26 Thread Ilya Zykov
her side do ioctl(...,TCFLSH,..). Then there is no place to do writers wake up. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 12b1fa0..a038be1 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -1098,10 +1098,12 @@ int tt

[PATCH v3] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-26 Thread Ilya Zykov
. Then there is no place to do writers wake up. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 12b1fa0..a038be1 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -1098,10 +1098,12 @@ int tty_perform_flush(struct tty_struct

[PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers.

2012-11-23 Thread Ilya Zykov
ic of work ldisc's layer. 2. It is simple overhead because we call ldisc's flush_buffer() at least two times. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index a21dc8e..c4a0a6d 100644 --- a/drivers/tty/serial/serial_core

[PATCH v2] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
efore TTY LAYER decremented (tty->count). This Patch help us catch bugs in tty's drivers and invoke tty_unthrottle() in right moment only. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 26f0d0e..f20b44a 100644 --- a/drivers/tty/n_tty.c

[PATCH v2] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
efore TTY LAYER decremented (tty->count). This Patch help us catch bugs in tty's drivers and invoke tty_unthrottle() in right moment only. Signed-off-by: Ilya Zykov --- diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 26f0d0e..f20b44a 100644 --- a/drivers/tty/n_tty.c

Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
On 22.11.2012 10:03, Ilya Zykov wrote: On 22.11.2012 8:29, Ilya Zykov wrote: On 22.11.2012 4:47, andrew mcgregor wrote: On 11/22/2012 at 10:39 AM, in message <50ad4a01.7060...@ilyx.ru>, Ilya Zykov wrote: On 22.11.2012 1:30, Alan Cox wrote: Function reset_buffer_flags() also i

Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
On 22.11.2012 4:47, andrew mcgregor wrote: On 11/22/2012 at 10:39 AM, in message <50ad4a01.7060...@ilyx.ru>, Ilya Zykov wrote: On 22.11.2012 1:30, Alan Cox wrote: Function reset_buffer_flags() also invoked during the ioctl(...,TCFLSH,..). At the time of request we can have full b

Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
On 22.11.2012 1:30, Alan Cox wrote: Function reset_buffer_flags() also invoked during the ioctl(...,TCFLSH,..). At the time of request we can have full buffers and throttled driver too. If we don't unthrottle driver, we can get forever throttled driver, because after request, we will have empty b

Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
On 22.11.2012 8:29, Ilya Zykov wrote: On 22.11.2012 4:47, andrew mcgregor wrote: On 11/22/2012 at 10:39 AM, in message <50ad4a01.7060...@ilyx.ru>, Ilya Zykov wrote: On 22.11.2012 1:30, Alan Cox wrote: Function reset_buffer_flags() also invoked during the ioctl(...,TCFLSH,..). At th

Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
On 22.11.2012 9:25, andrew mcgregor wrote: On 11/22/2012 at 05:29 PM, in message <50adaa26.7080...@ilyx.ru>, Ilya Zykov wrote: On 22.11.2012 4:47, andrew mcgregor wrote: On 11/22/2012 at 10:39 AM, in message <50ad4a01.7060...@ilyx.ru>, Ilya Zykov wrote: On 22.11.2012 1:

Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-22 Thread Ilya Zykov
On 22.11.2012 1:30, Alan Cox wrote: Function reset_buffer_flags() also invoked during the ioctl(...,TCFLSH,..). At the time of request we can have full buffers and throttled driver too. If we don't unthrottle driver, we can get forever throttled driver, because after request, we will have empty b

[PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).

2012-11-21 Thread Ilya Zykov
ere is no place to do writers wake up. About 'tty: fix "IRQ45: nobody cared"': We don't call tty_unthrottle() if release last filp - ('tty->count == 0') In other case it must be safely. Maybe we have bug in other place. Signed-off-by: Ilya Zykov --- diff --g