Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1188385

Re: [PATCH] Fix data loss in cdc-acm

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] Fix data loss in cdc-acm
Date 2015-07-20 19:30 +0200
Message-ID <pOn34-7R5-3@gated-at.bofh.it> (permalink)
References <pO4D8-6CW-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[ +CC: Alan, Oliver, Peter, Toby, linux-serial, linux-usb ]

On Sun, Jul 19, 2015 at 11:37:07PM +0200, Sven Brauch wrote:
> Since acm_process_read_urb does not check the return value
> of tty_insert_flip_string, it can happen that not all data
> is copied from the urb to the tty if the tty buffer
> is full and throttling does not set in quickly enough. This
> problem is very evident for devices with high data throughput;
> for a device with ~12 MB/s of data transfer, I get a few
> missing kB of data every few MB transferred randomly.

What kernel version are you using?

> To solve this problem, a check is introduced which verifies
> that indeed all data was copied from the urb to the tty buffer.
> If that is not the case, the urb is held in a queue instead
> of resubmitting it to the USB subsystem right away. When new
> data arrives or the tty is unthrottled, the queue is emptied
> again (as far as possible).
> 
> Effectively, this change will force the transmitting USB device
> to wait until the tty buffer can accept new data again, instead
> of discarding the data in this case.

The idea of adding another layer of buffering in the cdc-acm driver has
been suggested in the past but was rejected (or at least questioned).
See for example this thread:

	https://lkml.kernel.org/r/20110608164626.22bc893c@lxorguk.ukuu.org.uk

The tty buffers are quite large these days, but could possibly be bumped
further if needed to give the ldisc some more time to throttle the
device at very high speeds.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Fix data loss in cdc-acm Sven Brauch <mail@svenbrauch.de> - 2015-07-19 23:50 +0200
  Re: [PATCH] Fix data loss in cdc-acm Johan Hovold <johan@kernel.org> - 2015-07-20 19:30 +0200
    Re: [PATCH] Fix data loss in cdc-acm Sven Brauch <mail@svenbrauch.de> - 2015-07-20 20:10 +0200
      Re: [PATCH] Fix data loss in cdc-acm Oliver Neukum <oneukum@suse.com> - 2015-07-22 10:50 +0200

csiph-web