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

2015-10-21 Thread Peter Hurley
On 10/21/2015 08:09 AM, Peter Hurley wrote: > Be aware that while the N_TTY line discipline ensures that put_char() > and write() usage will not be interleaved without flush_chars(), other > line disciplines might not, so at least be sure that driver won't > crash if that happens. Sorry, I take th

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

2015-10-21 Thread Peter Hurley
On 10/21/2015 06:12 AM, Oliver Neukum wrote: > On Tue, 2015-10-20 at 14:16 -0400, Peter Hurley wrote: >> ECHO is on by default and the cdc-acm driver does not implement the >> put_char() and flush_chars() tty driver methods, which made the >> problem >> _way worse_, since every echoed char is sent

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

2015-10-21 Thread Oliver Neukum
On Tue, 2015-10-20 at 14:16 -0400, Peter Hurley wrote: > ECHO is on by default and the cdc-acm driver does not implement the > put_char() and flush_chars() tty driver methods, which made the > problem > _way worse_, since every echoed char is sent as it's own URB. That can be fixed. How can I test

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

2015-10-20 Thread Peter Hurley
On 08/05/2015 01:36 PM, Peter Hurley wrote: > On 07/22/2015 06:53 PM, Sven Brauch wrote: >> On 23/07/15 00:12, Peter Hurley wrote: >>> The premature unthrottle actually leads to the data loss but the throttling >>> with a mere 2K left is _way too late_. >> Ok, yes, I think so too. >> >>> 10ms is a

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

2015-08-05 Thread Peter Hurley
On 07/22/2015 06:53 PM, Sven Brauch wrote: > Hi, > > On 23/07/15 00:12, Peter Hurley wrote: >> The premature unthrottle actually leads to the data loss but the throttling >> with a mere 2K left is _way too late_. > Ok, yes, I think so too. > >> 10ms is a _really_ long time for a cpu not to attend

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

2015-08-04 Thread Peter Hurley
On 07/22/2015 11:01 AM, Oliver Neukum wrote: > On Wed, 2015-07-22 at 10:30 -0400, Peter Hurley wrote: >> 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. Th

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

2015-07-27 Thread Peter Stuge
Sven Brauch wrote: > I don't make any other changes to the default settings. To be honest, > I'm not sure in which mode it is operating then (I was assuming raw, but > I might be wrong?). You should explicitly set a mode if you need a particular mode, otherwise the port might be in another mode. T

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

2015-07-22 Thread Sven Brauch
Hi, On 23/07/15 00:12, Peter Hurley wrote: > The premature unthrottle actually leads to the data loss but the throttling > with a mere 2K left is _way too late_. Ok, yes, I think so too. > 10ms is a _really_ long time for a cpu not to attend to a kworker. > Which raises 2 questions: > 1. What are

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

2015-07-22 Thread Peter Hurley
Hi Sven, On 07/21/2015 08:47 PM, Sven Brauch wrote: > On 22/07/15 01:34, Peter Hurley wrote: >> I'd like to see that data, if you can, which will help me understand >> at least the timing. > Sure, please see below for the code which produced the output > and the actual output. Let me know if you n

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

2015-07-22 Thread Oliver Neukum
On Wed, 2015-07-22 at 10:30 -0400, Peter Hurley wrote: > 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 > spa

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

2015-07-22 Thread Peter Hurley
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

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

2015-07-22 Thread Oliver Neukum
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 e

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

2015-07-21 Thread Sven Brauch
Hey, On 22/07/15 01:34, Peter Hurley wrote: > I'd like to see that data, if you can, which will help me understand > at least the timing. Sure, please see below for the code which produced the output and the actual output. Let me know if you need anything else. This was run with the unmodified ver

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

2015-07-21 Thread Peter Hurley
On 07/21/2015 05:43 PM, Sven Brauch wrote: > Hi, > > Thank you for your comments. > > On 21/07/15 15:43, Oliver Neukum wrote: >> But others won't and we'd preserve stale data in preference over fresh >> data. > If that is important for your device, you should be using an isochronous > endpoint, n

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

2015-07-21 Thread Sven Brauch
Hi, Thank you for your comments. On 21/07/15 15:43, Oliver Neukum wrote: > But others won't and we'd preserve stale data in preference over fresh > data. If that is important for your device, you should be using an isochronous endpoint, not bulk, no? Also note that the driver currently does this

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

2015-07-21 Thread Peter Hurley
Hi Sven, On 07/21/2015 05:18 AM, Johan Hovold wrote: > On Mon, Jul 20, 2015 at 08:07:33PM +0200, Sven Brauch wrote: >> On 20/07/15 19:25, Johan Hovold wrote: > >>> 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

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

2015-07-21 Thread Oliver Neukum
On Mon, 2015-07-20 at 20:07 +0200, Sven Brauch wrote: > On 20/07/15 19:25, Johan Hovold wrote: > > What kernel version are you using? > I'm using linux 4.1.2. > > > 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

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

2015-07-21 Thread Johan Hovold
On Mon, Jul 20, 2015 at 08:07:33PM +0200, Sven Brauch wrote: > On 20/07/15 19:25, Johan Hovold wrote: > > 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: > > > >

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

2015-07-20 Thread Sven Brauch
On 20/07/15 19:25, Johan Hovold wrote: > What kernel version are you using? I'm using linux 4.1.2. > 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://lkm

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

2015-07-20 Thread Johan Hovold
[ +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 >