linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: Sven Brauch <mail@svenbrauch.de>, Johan Hovold <johan@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Toby Gray <toby.gray@realvnc.com>,
	linux-usb@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] Fix data loss in cdc-acm
Date: Wed, 22 Jul 2015 10:30:24 -0400	[thread overview]
Message-ID: <55AFA900.6040605@hurleysoftware.com> (raw)
In-Reply-To: <1437554428.5445.0.camel@suse.com>

On 07/22/2015 04:40 AM, Oliver Neukum wrote:
> On Tue, 2015-07-21 at 12:45 -0400, Peter Hurley wrote:
>> Let me know if you need help instrumenting the tty buffers/throttling
>> to help figure out what the actual problem is.
>>
>> Regarding the patch itself, I have no opinion on the suitability of
>> simply not resubmitting urbs. However, that is exactly how the
>> throttle
>> mechanism works, and the tty buffer API is specifically designed to
>> allow drivers to manage flow via that interface as well (especially
>> for high-throughput drivers).
> 
> Could you please expand on how this is supposed to work?
> For once how does one learn that room is available again?

There are basically 3 mechanisms for managing rx data:
1. Allocate space when the data arrives; drop data if no space is avail
   and indicate buf_overrun. This is what most drivers do.
2. Allocate space when the data arrives; try to buffer uncopied data
   and resubmit the data later. Some high-throughput drivers (in the wild)
   do this (but less so now that the tty buffer space is configurable).
3. Pre-allocate space _before_ the data arrives (with tty_buffer_request_room());
   this is applicable to subsystems which know how much data can be in-flight
   at any one time. This guarantees that when rx data arrives buffer space is
   available (since it has already been allocated).

Drivers that use method 2 typically attempt to recopy the buffered data
when either new data arrives or @ unthrottle. I've seen others use deferred
work as well.

AFAIK no driver/subsystem is using method 3 for guaranteed delivery
of in-flight data, but it seems ideally suited to usb serial.

Regards,
Peter Hurley

  reply	other threads:[~2015-07-22 14:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <55AC1883.4050605@svenbrauch.de>
2015-07-20 17:25 ` [PATCH] Fix data loss in cdc-acm Johan Hovold
2015-07-20 18:07   ` Sven Brauch
2015-07-21  9:18     ` Johan Hovold
2015-07-21 16:45       ` Peter Hurley
2015-07-22  8:40         ` Oliver Neukum
2015-07-22 14:30           ` Peter Hurley [this message]
2015-07-22 15:01             ` Oliver Neukum
     [not found]               ` <1437577303.5445.7.camel-IBi9RG/b67k@public.gmane.org>
2015-08-05  0:26                 ` Peter Hurley
2015-07-21 13:43     ` Oliver Neukum
     [not found]       ` <1437486195.3823.13.camel-IBi9RG/b67k@public.gmane.org>
2015-07-21 21:43         ` Sven Brauch
2015-07-21 23:34           ` Peter Hurley
2015-07-22  0:47             ` Sven Brauch
2015-07-22 22:12               ` Peter Hurley
2015-07-22 22:53                 ` Sven Brauch
2015-07-27 10:00                   ` Peter Stuge
     [not found]                   ` <55B01EDE.3050503-ITmcY+a7/CDoK6nBLMlh1Q@public.gmane.org>
2015-08-05 17:36                     ` Peter Hurley
     [not found]                       ` <55C249A3.6030809-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2015-10-20 18:16                         ` Peter Hurley
2015-10-21 10:12                           ` Oliver Neukum
2015-10-21 12:09                             ` Peter Hurley
2015-10-21 14:58                               ` Peter Hurley

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=55AFA900.6040605@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@svenbrauch.de \
    --cc=oneukum@suse.com \
    --cc=toby.gray@realvnc.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).