linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Grant Edwards <grant.b.edwards@gmail.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org
Subject: Re: locking changes in tty broke low latency feature
Date: Fri, 21 Feb 2014 10:58:17 -0500	[thread overview]
Message-ID: <53077799.6030700@hurleysoftware.com> (raw)
In-Reply-To: <20140221153946.2bda2ef0@alan.etchedpixels.co.uk>

Hi Alan,

On 02/21/2014 10:39 AM, One Thousand Gnomes wrote:
>> Ok, so this is still only about "best effort", and really bad
>> worst case behavior (that the tty core has no control over) is ok.
>>
>> Going to great lengths to trim one wakeup when nouveau disables interrupts
>> for 2ms seemed like a waste of time.
>
> If it used to work and it doesn't now it's a regression. It's also a
> nasty one if you've removed the facility for it.

I think the consensus is to leave the low_latency facility in, but
remove it's connection to the tty buffers.

If the known-to-be-already-in-non-interrupt-context drivers want,
I can add a different function for executing flush_to_ldisc()
directly. But I don't want to do that without a use-case and test
subject.

>> This change makes flush_to_ldisc() itself safely callable from
>> interrupt context, and:
>> 1. doesn't lose data (ie., buffers if the ldisc is filling up)
>> 2. automatically picks the optimum handling whether the input worker
>>      is running or not
>> 3. doesn't require more locks to exclude flushing or the input worker
>
> Yep
>
>> Putting aside for a moment the issue of termios safety inside
>> the throttle and unthrottle driver methods, the exclusion locks here could
>> be spinlocks if the drivers can be audited/fixed to not sleep here.
>
> That was basically insoluble when the lock first went in. We tried with a
> spinlock but a lot of USB widgets need to go and chatter with the device
> when you do flow control. Flow control is fundamentally ordered but
> asynchronous however so if the right fix was to make the USB dongles
> queue the work then no harm is done (and the queued flow control
> assertion would worst case be no different to a non queued one from a
> queued flush_to_ldisc)

Oh. That's not something I want to take on.

>> Then that just leaves the termios lock, which is a non-trivial problem, and
>> I'm not convinced RCU will magically fix it.
>
> If you pass a snapshot of the termios state down then I think it does,
> but it's still not remotely trivial.

That was my thought too -- that only dependency injection would work.
Which would require adding that to most, if not all, driver methods, which
seems way too painful.

> First question though comes before all of this - and that is do we need
> low_latency at all any more or is the current scheduling logic now good
> enough to do the job anyway.

Right.

Based on my recent test, I think low_latency doesn't need to be a knob for
the tty core. Drivers can continue to use it to mess with their rx fifo
settings and such like.

I plan on sending Greg a patch to do just that, probably this weekend.

Regards,
Peter Hurley

  reply	other threads:[~2014-02-21 15:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18  9:38 locking changes in tty broke low latency feature Stanislaw Gruszka
2014-02-18  9:57 ` One Thousand Gnomes
2014-02-18 22:12 ` Peter Hurley
2014-02-19 13:03   ` Stanislaw Gruszka
2014-02-19 16:55     ` Grant Edwards
2014-02-19 17:38       ` Peter Hurley
2014-02-19 18:12         ` Grant Edwards
2014-02-19 18:42           ` Peter Hurley
2014-02-19 19:17         ` One Thousand Gnomes
2014-02-19 20:22           ` Peter Hurley
2014-02-19 21:42             ` One Thousand Gnomes
2014-02-20  2:19               ` Peter Hurley
2014-02-21 15:39                 ` One Thousand Gnomes
2014-02-21 15:58                   ` Peter Hurley [this message]
2014-02-21 16:31                     ` Grant Edwards
2014-02-19 23:06     ` Hal Murray
2014-02-19 23:35       ` One Thousand Gnomes
2014-02-20  2:55       ` Peter Hurley
2014-02-20  4:16         ` Greg KH
2014-02-20 18:16         ` Peter Hurley
2014-02-20 19:33           ` Grant Edwards
2014-02-20 22:06             ` Peter Hurley
2014-02-23 22:33           ` Thomas Gleixner
2014-02-24  0:23             ` Peter Hurley
2014-02-24 13:23             ` One Thousand Gnomes
2014-02-24 15:44             ` Grant Edwards
2014-02-20 21:55         ` Hal Murray
2014-02-20 22:14           ` Grant Edwards
2014-02-21 15:43             ` One Thousand Gnomes

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=53077799.6030700@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=grant.b.edwards@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=linux-serial@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).