Low perfomance when read from usb flash drive

Hans Petter Selasky hselasky at c2i.net
Tue Mar 3 13:41:08 PST 2009


On Tuesday 03 March 2009, Artyom Mirgorodsky wrote:
> On Tuesday 03 March 2009 16:16:02 Hans Petter Selasky wrote:
> >         if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
> >                 qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) |
> >                     EHCI_QH_DTC);
> >                 if (methods != &ehci_device_intr_methods)
> >                         qh_endp |= EHCI_QH_SET_NRL(8);
> >         } else {
> >
> > And tune to NRL value to 15. Recompile kernel and modules.
>

Hi,

Here is some more testing you can do:

dd if=/dev/da0 of=/dev/null bs=1024 &

And then:

vmstat -i ; sleep 1 ; vmstat -i

Now compute the number of interrupts that appear on the EHCI.

Repeat the same test using FreeBSD -current.

a) On the machine where it is slow.
b) On the machine where it is fast.

I think the reduced performance can be explained by a clamp on the interrupt 
rate around 1000 interrupts per second instead of 8000. Maybe someone has an 
explanation for this?

The EHCI is being programmed to interrupt at 125us intervals, but there seems 
to be limits other places.

It is possible to workaround this in the umass driver by doing the cmd + read 
in one operation.

--HPS


More information about the freebsd-usb mailing list