linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Edwards <grant.b.edwards@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-serial@vger.kernel.org, linux-rt-users@vger.kernel.org
Subject: Re: locking changes in tty broke low latency feature
Date: Thu, 20 Feb 2014 22:14:53 +0000 (UTC)	[thread overview]
Message-ID: <le5uot$si0$1@ger.gmane.org> (raw)
In-Reply-To: 20140220215541.7D694406062@ip-64-139-1-69.sjc.megapath.net

On 2014-02-20, Hal Murray <murray+fedora@ip-64-139-1-69.sjc.megapath.net> wrote:

> Let's go back to the big picture.  In the old old days, time sharing
> systems had lots of serial ports.  It was common for the hardware to
> buffer up several characters before requesting an interrupt in order
> to reduce the CPU load.

There were even serial boards that had a cooked "line mode" which
buffered up a whole line of input: they handled limited line-editing
and didn't interrupt the CPU until they saw 'enter' or 'ctrl-C'.

> There was usually a bit in the hardware to bypass this if you thought
> that response time was more important than CPU load.  I was expecting
> low_latency to set that bit.

It might.  That depends on whether the driver paid any attention to
the low_latency flag.  IIRC, some did, some didn't.

> Is that option even present in modern serial chips?

Sure.  In pretty much all of the UARTs I know of, you can configure
the rx FIFO threshold or disable the rx FIFO altogether [though
setting the threshold to 1 is usually a better idea than disabling the
rx FIFO].  At least one of my serial_core drivers looks at the
low_latency flag and configure a lower rx FIFO threshold if it's set.

> Do the various chips claiming to be 8250/16550 and friends correctly
> implement all the details of the specs?

What specs?

> Many gigabit ethernet controllers have the same issue.  It's often
> called interrupt coalescing.
>
> What/why is the serial/scheduler doing differently in the low_latency
> case?  What case does that help?

Back in the old days, when a serial driver pushed characters up to the
tty layer it didn't immediately wake up a process that was blocking on
a read().  AFAICT, that didn't happen until the next system tick. I'm
not sure if that was just because the scheduler wasn't called until a
tick happened, or if there was some intermediate tty-layer
worker-thread that had to run.

Setting the low_latency flag avoided that.

When the driver pushed characters to the tty layer with the
low_latency flag set, the user-space process that was blocking on
read() would wake up "immediately". This potentially used up a lot
more CPU time, since a user process that is reading a large block of
data _might_ be woken up and then block again for every rx byte --
assuming no rx FIFO.  Without the low_latency flag, the user process
would wake up every 10ms and be handed 10ms worth of data.  (Back then
HZ was always 100.)

At least that's how I remember it...

-- 
Grant Edwards               grant.b.edwards        Yow! My EARS are GONE!!
                                  at               
                              gmail.com            

  reply	other threads:[~2014-02-20 22:14 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
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 [this message]
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='le5uot$si0$1@ger.gmane.org' \
    --to=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).