All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Grant Edwards <grant.b.edwards@gmail.com>, linux-serial@vger.kernel.org
Subject: Re: Is tty->receive_room no longer usable w/ SMP?
Date: Wed, 12 Feb 2014 20:04:20 -0500	[thread overview]
Message-ID: <52FC1A14.5080004@hurleysoftware.com> (raw)
In-Reply-To: <ldgte5$kp1$1@ger.gmane.org>

On 02/12/2014 05:43 PM, Grant Edwards wrote:
> A couple serial drivers I maintain check the value of tty->receive_room
> to decide the max number of bytes to pull out of the UART's receive
> FIFO and shove into a flip buffer.

tty->receive_room is not part of the driver<->tty core interface.

> After checking tty->receive room to decide how many bytes to read, one
> of the drivers uses this sequence:
>
>   tty_prepare_flip_string_flags(...)
       ^^^^^^^^^^^^
This was removed for 3.14.

>   <fill up char buffer and flag buffer>
>   tty_flip_buffer_push(...)
>
> The other uses
>
>   for (i=0; i<count; ++i)
>     uart_insert_char(...);
>   tty_flip_buffer_push(...);
>
> But, starting with kernel 3.12.0, whenSMP is enabled, tty->receive_room
> is always 0 and never changes.  With SMP disabled, it seems to work the
> way it always has.

Starting with 3.12, receive_room is only used for line disciplines that
don't use flow control between the tty core and the line discipline
receive_buf (only N_TTY uses flow control).

This is because the N_TTY flow-controlled interface is lockless and
tty->receive_room is not supportable locklessly.

> Is use of tty->receive room no longer supported for SMP kernels?

The use of tty->receive_room by drivers is not supported on any kernel.

> How _should_ a serial driver decide how many rx characters there are
> room for?

All of the flip buffer functions that reserve/use buffer space return
the space reserved/consumed. Is rx overflowing the flip buffers before
you can throttle the sender?

Regards,
Peter Hurley


  reply	other threads:[~2014-02-13  1:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 22:43 Is tty->receive_room no longer usable w/ SMP? Grant Edwards
2014-02-13  1:04 ` Peter Hurley [this message]
2014-02-13  2:27   ` Grant Edwards
2014-02-13  3:56     ` Peter Hurley
2014-02-13  5:38       ` Grant Edwards
2014-02-13 15:30         ` Peter Hurley
2014-02-13 17:52           ` Grant Edwards
2014-02-13 18:20             ` Peter Hurley
2014-02-13 18:50               ` Grant Edwards
2014-02-13 19:09                 ` Peter Hurley
2014-02-13 19:46                   ` Grant Edwards
2014-02-14 22:31             ` Grant Edwards

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=52FC1A14.5080004@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=grant.b.edwards@gmail.com \
    --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 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.