linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Zykov <ilya@ilyx.ru>
To: andrew mcgregor <andrew.mcgregor@alliedtelesis.co.nz>
Cc: Alan Cox <alan@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).
Date: Thu, 22 Nov 2012 10:16:39 +0400	[thread overview]
Message-ID: <50ADC347.6020600@ilyx.ru> (raw)
In-Reply-To: <50ADC015.7080503@ilyx.ru>

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.7060500@ilyx.ru>,
>>>>>> Ilya Zykov
>>> <ilya@ilyx.ru> 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 buffers
>>>>>> and throttled driver too. If we don't unthrottle driver, we can get
>>>>>> forever throttled driver, because after request, we will have
>>>>>> empty buffers and throttled driver and there is no place to
>>>>>> unthrottle
>>>> driver.
>>>>>> It simple reproduce with "pty" pair then one side sleep on
>>>>>> tty->write_wait,
>>>>>> and other side do ioctl(...,TCFLSH,..). Then there is no place to do
>>>> writers wake up.
>>>>>
>>>>>
>>>>> So instead of revertng it why not just fix it ? Just add an
>>>>> argument to
>>>>> the reset_buffer_flags function to indicate if unthrottling is
>>>>> permitted.
>>>>>
>>>>> Alan
>>>>>
>>>> Because in my opinion, unthrottling permitted always, except release
>>>> last filp (tty->count == 0)
>>>
>>> Maybe so, but the patch was there in the first place to resolve an
>>> actual observed bug, where a driver would lock up.  So the behaviour
>>> needs preserved.
>>>
>>> Andrew
>>>
>>
>> Maybe it was wrong driver, unfortunately, I didn't find full information
>> about this bug. As an example, if driver indirectly call
>> reset_buffer_flags() in driver's close() function it will be before
>> decrement last (tty->count).
>>
>>
>
> Particularly, many drivers and 'serial_core.c' use tty_ldisc_flush() in
> own close() function. tty_ldisc_flush() call reset_buffer_flags()
> indirectly.
> I think is wrong way use tty_ldisc_flush() in driver's close() function,
> because tty layer 'tty_release()' call  tty_ldisc_release() after
> decremented (tty->count), and clear all buffers.
> We don't care about this in driver. And call ldisc's function.
>
>
Sorry, last phrase not correct.
We don't NEED care about this in driver. And call ldisc's function.


  reply	other threads:[~2012-11-22 18:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 21:12 [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..) Ilya Zykov
2012-11-21 21:30 ` Alan Cox
2012-11-21 21:39   ` Ilya Zykov
2012-11-22  0:47     ` andrew mcgregor
2012-11-22  4:29       ` Ilya Zykov
2012-11-22  5:25         ` andrew mcgregor
2012-11-22  6:35           ` Ilya Zykov
2012-11-22  6:03         ` Ilya Zykov
2012-11-22  6:16           ` Ilya Zykov [this message]
2012-11-21 21:55   ` Ilya Zykov
2012-11-27  6:14 [PATCH v4] " Ilya Zykov
2012-11-27 17:24 ` Greg Kroah-Hartman
2012-11-27 18:46   ` Ilya Zykov
2012-11-27 19:32     ` Alan Cox
2013-01-16  9:07       ` [PATCH] " Ilya Zykov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50ADC347.6020600@ilyx.ru \
    --to=ilya@ilyx.ru \
    --cc=alan@linux.intel.com \
    --cc=andrew.mcgregor@alliedtelesis.co.nz \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).