All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Hal Murray <murray+fedora@ip-64-139-1-69.sjc.megapath.net>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-rt-users@vger.kernel.org,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Subject: Re: locking changes in tty broke low latency feature
Date: Wed, 19 Feb 2014 21:55:21 -0500	[thread overview]
Message-ID: <53056E99.9070900@hurleysoftware.com> (raw)
In-Reply-To: <20140219230623.736E8406062@ip-64-139-1-69.sjc.megapath.net>

On 02/19/2014 06:06 PM, Hal Murray wrote:
>> Can you give me an idea of your device's average and minimum required
>> latency (please be specific)?  Is your target arch x86 [so I can evaluate the
>> the impact of bus-locked instructions relative to your expected]?
>
> The code I'm familiar with is ntpd and gpsd.  They run on almost any hardware
> or OS and talk to a wide collection of devices.
>
> There is no hard requirement for latency.  They just work better with lower
> latency.  The lower the better.
>
> People gripe about the latency due to USB polling which is about a ms.

Have you tried 3.12+ without low_latency? I ripped out a lot of locks
from 3.12+ so it's possible it already meets your requirements.

> I can easily notice a few 10s of microseconds.  I probably wouldn't notice a
> few microseconds, but there are people who would.  The latency isn't
> critical, it's the jitter.  (ntpd has fudge factors to correct for a fixed
> offset.)  Yes, down at the microsecond level luck-of-the-cache is important.

Hopefully you meant "milliseconds" here; single-digit microsecond latency on
any kind of stable duty cycle is linux-rt territory, and simply not a reasonable
goal for mainline.

The jitter is all scheduler and since the user-space app is sleeping waiting
for input, there's nothing the tty core can do about that. Removing one
mandatory scheduling wakeup _may_ help latency, but will probably not make
much difference regarding jitter.

>> Also, how painful would it be if unsupported termios changes were rejected
>> if the port was in low_latency mode and/or if low_latency setting was
>> disallowed because of termios state?
>
> What does "unsupported termios changes" mean?

For example, once the port is in low_latency mode, setting L_ECHO (and its ilk)
would be rejected. And vice versa, if the L_ECHO is set in termios, low_latency
would be rejected.

So running a vt console is low_latency mode is not going to work.

> ntpd has only a few places where it opens a serial port.  I'll collect a list
> of the options that are used if that will help.  The common cases are either
> raw binary, or lines of text.  It doesn't need any fancy editing.
>
>
>> It would be pointless to throttle low_latency, yes?
>
> What does "throttle" mean?  If you mean what I call flow-control, then no,
> it's not interesting.

Yes, whatever the driver currently considers flow-control. The core is
agnostic about the mechanism; throttling is the generic requirement.

> There shouldn't be any problem with ntpd or gpsd grabbing all the data
> promptly.

Ok.

>> What would be an acceptable outcome of being unable to accept input?
>> Corrupted overrun? Dropped i/o? Queued for later? Please explain with
>> comparison to the outcome of missed minimum latency.
>
> Corruption would be evil.  Longer latency would be OK, especially if it
> didn't happen often.  (ntpd has code to discard outliers.)  3% of the time
> would probably not be a problem.  25% might cause problems.
>
> We can allocate a bigger buffer if that helps.

No need, I already solved this step.

> gpsd uses TIOCMIWAIT to get a wakeup from a PPS signal connected to a modem
> control line.  That path might have the same problem and/or some ideas on how
> to handle the data case.

What Alan said. low_latency has no impact on the handling of the PPS signal
through DCD.

Regards,
Peter Hurley


  parent reply	other threads:[~2014-02-20  2:55 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
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 [this message]
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=53056E99.9070900@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=murray+fedora@ip-64-139-1-69.sjc.megapath.net \
    --cc=sgruszka@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.