linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Austin Schuh <austin.linux@gmail.com>
To: Michel Macena Oliveira <michel@austral-dynamics.com>
Cc: Itai Handler <itai.handler@gmail.com>, linux-rt-users@vger.kernel.org
Subject: Re: Serial port driver usage and status
Date: Thu, 16 Jul 2020 13:40:39 -0700	[thread overview]
Message-ID: <CABsbf=E9D_NvXHZ5z1aLFN4Jcg+s+ADVFZVJi=jkpPOknTN7cA@mail.gmail.com> (raw)
In-Reply-To: <CAKkbJ-wDsGO+ZHKZFkPfUL113ONc=NNNeShQkLf+ZH82iaBTEQ@mail.gmail.com>

On Thu, Jul 16, 2020 at 1:21 PM Michel Macena Oliveira
<michel@austral-dynamics.com> wrote:
>
> Em qui., 16 de jul. de 2020 às 16:26, Itai Handler
> <itai.handler@gmail.com> escreveu:
> >
> > Hi Michel,
> >
> > On 7/16/20, Michel Macena Oliveira <michel@austral-dynamics.com> wrote:
> > > Hi, sorry for my newbie question,
> > > What is the status of the serial port driver?
> > > I've written some code to use serial ports  for the generic kernel linux,
> > > And now I want to write something similar for the real time kernel, do
> > > I have to use some specific library, flags or something or is it just
> > > the same settings?
> > >
> > > I'm asking because now I need to take into account the serial access
> > > in the scheduler to ensure a real time behavior .
> > >
> > > Any help, advice, hint or tips would be appreciated.
> > >
> >
> > Do you mean that you wrote some code that works with a /dev/tty* serial port?
> >
> > In some kernel versions (e.g 4.19) we saw high latencies in the rx
> > path of serial drivers.
> > I think that this is due to rx handled in the context of a workqueue
> > which also handles other system activities.
> > We found a workaround to this problem. If I remember correctly we
> > create a dedicated thread for the port and assign it a high priority.
> >
> > Itai Handler
>
> Thanks for the answer,
> Yes I wrote a code that works with  /dev/tty* serial using termios.h.
> I thought exactly what you suggested, to use a dedicated thread, but
> how to properly implement it?
> I mean in a simple way, just need to put open and write calls inside
> the high priority (RT) thread?
>
> Current kernel: 4.4.208-rt198 #1 SMP PREEMPT RT

Itai is talking about the kernel work to handle the serial data, not
the userspace work.  We found the same thing, that the work goes
through a work queue in the kernel, which adds unbounded latency.

https://www.spinics.net/lists/linux-serial/msg07341.html looks
relevant and matches my memory of what we did to solve this.  There's
either a flag in userspace or patch to apply to the kernel (and then a
flag) to skip the work queue.

Austin

  parent reply	other threads:[~2020-07-16 20:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 17:29 Serial port driver usage and status Michel Macena Oliveira
2020-07-16 19:26 ` Itai Handler
2020-07-16 20:20   ` Michel Macena Oliveira
2020-07-16 20:40     ` Itai Handler
2020-07-16 20:40     ` Austin Schuh [this message]
2020-08-05 18:29       ` Michel Macena Oliveira
2020-08-05 19:21         ` Itai Handler
2020-08-05 19:52           ` Michel Macena Oliveira
2020-08-06 19:56             ` Itai Handler
2020-08-11 14:43               ` Michel Macena Oliveira
2020-08-11 19:07                 ` Austin Schuh

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='CABsbf=E9D_NvXHZ5z1aLFN4Jcg+s+ADVFZVJi=jkpPOknTN7cA@mail.gmail.com' \
    --to=austin.linux@gmail.com \
    --cc=itai.handler@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=michel@austral-dynamics.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 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).