public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Greg KH <greg@kroah.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes
Date: Wed, 06 May 2009 10:59:32 -0500	[thread overview]
Message-ID: <4A01B3E4.6020408@windriver.com> (raw)
In-Reply-To: <20090506152521.GA4603@kroah.com>

Greg KH wrote:
>>> This patch takes the route of forcibly polling the hcd device to drain
>>> the urb queue and initiate the bulk write call backs.
>>>
>>> NOTE this patch is not signed off, it is a question of what is the
>>> right way to do this?
>>>       
>> This patch is highly questionable.
>>     
>
> I agree.
>
>   

That is why there is no signed-off on this patch.  It is an
RFC/EXPERIMENTAL because it is not clear how to fix the problem.  See
below for more discussion.

>> Is the idea to force the HCD to search for completed URBs before the
>> host controller has issued a completion interrupt?  Wouldn't it be
>> better instead to use more URBs?
>>
>> Besides, why should there be too many outstanding transmit URBs?  A
>> normal serial debugging port running at 115200 baud can transmit no
>> more than 12 bytes per ms.  You should be able to surpass that using
>> only three URBs!  In fact, if you buffer up to 8 bytes per URB then
>> with only two URBs you could send 64 bytes per ms, which is equivalent
>> to 640000 baud.  Do you really need to go more than (say) ten times
>> faster than that?
>>     
>
> Yeah, something seems wrong here.
>
> Jason, why is this really needed?  With your ring buffer, you shouldn't
> need this at all anymore.
>
> Or if you do, just bump up the number outstanding urbs that are
> possible.  Or the urb buffer size.
>
>   

The URB queue has to be unacceptably large to make it work correctly
(>4000)   The issue here stems from the register_console() function.  
As a part of the registration with register_console, the usb_debug
device driver gets a huge flood of printk backlog.  Because the urb
queue is not that deep we loose valuable printk logs.  I would very much
like a way to force it to work correctly.

To answer Alan's question, the rs232 uart drivers don't process the
printk back log asynchronously.  It is a direct write to the hardware
(see serial8250_console_putchar - drivers/serial/8250.c).   That is why
there is no problem with lost printk data in the case of the uart drivers.

I could find no obvious safe way do to this synchronously with the USB
api, which is why I put together some way to "force it to work" with the
poll hook until we can figure out the right way to do this.  The
mechanism for a console write is not the same as the standard tty
service, or at least that is the way it is today in the kernel.

Essentially I am seeking a synchronous write and wait for the usb serial
drivers when used as a system console.  Right now in the usb serial API
there is no distinction between a console write and a tty write. 
Perhaps that is what needs to change, to allow for some synchronous
behavior in usb_console_write()?

The usb_debug driver is not the only usb serial device that loses data
from the printk backlog, the ftdi_sio driver suffers the same problem.

Jason.

  parent reply	other threads:[~2009-05-06 15:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  2:00 [PATCH 0/5] usb_debug driver improvements Jason Wessel
2009-05-06  2:00 ` [PATCH 1/5] usb_debug: implement multi urb write Jason Wessel
2009-05-06  2:00   ` [PATCH 2/5] usb_debug,usb_generic_serial: implement sysrq and serial break Jason Wessel
2009-05-06  2:00     ` [PATCH 3/5] usb,early_printk: insert cr prior to nl as needed Jason Wessel
2009-05-06  2:00       ` [PATCH 4/5] usb,early_printk: unregister early usb before rest_init() Jason Wessel
2009-05-06  2:00         ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes Jason Wessel
2009-05-06 15:18           ` Alan Stern
2009-05-06 15:25             ` Greg KH
2009-05-06 15:42               ` Alan Cox
2009-05-06 15:59               ` Jason Wessel [this message]
2009-05-06 15:41             ` Alan Cox
2009-05-06 15:45               ` Greg KH
2009-05-06 17:17               ` Oliver Neukum
2009-05-06 19:24                 ` Alan Stern
2009-05-06 20:01                   ` Oliver Neukum
2009-05-06 20:24                     ` Alan Stern
2009-05-06 22:24                       ` Oliver Neukum
2009-05-07 14:35                         ` Alan Stern
2009-05-07 15:01                           ` Oliver Neukum
2009-05-07 16:32                             ` Alan Stern
2009-05-06 20:24                     ` Jason Wessel
2009-05-06 20:28                       ` Greg KH
2009-05-06 20:51                         ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to forcewrites Jason Wessel
2009-05-06 21:32                           ` Greg KH
2009-05-07 14:00                             ` Alan Stern
2009-05-07  0:06                   ` [PATCH 5/5] usb_debug: EXPERIMENTAL - poll hcd device to force writes Alan Cox
2009-05-07 14:27                     ` Alan Stern
2009-05-07 14:49                       ` Oliver Neukum
2009-05-06  7:34         ` [PATCH 4/5] usb,early_printk: unregister early usb before rest_init() Ingo Molnar
2009-05-06 13:02           ` Jason Wessel
2009-05-07 15:09             ` Ingo Molnar
2009-05-06  7:30       ` [PATCH 3/5] usb,early_printk: insert cr prior to nl as needed Ingo Molnar
2009-05-06 15:25         ` Greg KH
2009-05-07 15:04           ` Ingo Molnar
2009-05-06  7:16   ` [PATCH 1/5] usb_debug: implement multi urb write Oliver Neukum
2009-05-06 11:57     ` Jason Wessel
2009-05-06 12:31       ` Oliver Neukum
2009-05-06 15:26   ` Greg KH

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=4A01B3E4.6020408@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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