Re: [PATCH 2/2] hso: fix deadlock when receiving bursts of data
From: Olivier Sobrie <hidden>
Date: 2014-07-11 12:05:55
Also in:
lkml
On Fri, Jul 11, 2014 at 09:28:47AM +0000, David Laight wrote:
From: Olivier Sobrie Olivier Sobriequoted
Hi Alan and Davids, On Thu, Jul 10, 2014 at 04:50:03PM +0100, One Thousand Gnomes wrote:quoted
On Thu, 10 Jul 2014 14:37:37 +0000 David Laight [off-list ref] wrote:quoted
From: Olivier Sobrie ...quoted
The function put_rxbuf_data() is called from the urb completion handler. It puts the data of the urb transfer in the tty buffer with tty_insert_flip_string_flags() and schedules a work queue in order to push the data to the ldisc. Problem is that we are in a urb completion handler so we can't wait until there is room in the tty buffer.The tty provides the input queue, if the queue is full then just chuck the data in the bitbucket. hso is trying to be far too clever. If hso is fast enough that the buffering isn't sufficient on the tty side then we need to fix the tty buffer size.Ok I'll adapt the patch to drop the data that can't be put in the tty buffer. I test this and resend a new patch.If you are going to drop data, then ideally you want to discard entire ppp packets. Depending on exactly how the interface works it might be that urb are likely to contain complete packets.
Indeed, urbs contains complete ppp packets. I see that the first and last byte are equal to 0x7e.
So discarding entire urb might work better than discarding a few bytes. (But don't even think of scanning the data stream in the usb driver - except for experiments.)
I will check with tty_buffer_request_room() that there is enough room to receive the frame before inserting the data in the tty buffer with tty_insert_flip_string(). -- Olivier