USB performance vs governor

I’m been trying to track down why the USB performance on my BBB’s has been abysmal. I’ve discovered that the default on-demand governor is definitely a major contributor to the slowdown.

Basically, with the ondemand governor, I’m seeing read performance off of a USB3 thumb drive of well under 2MB/sec. In other words, really slow. For example:

`

root@FPP:/home/fpp# uname -a
Linux FPP 4.14.60-ti-r67 #1 SMP PREEMPT Sat Aug 4 19:54:06 UTC 2018 armv7l GNU/Linux
root@FPP:/home/fpp# cpufreq-set -g ondemand
root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 24.9291 s, 1.3 MB/s
root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 22.283 s, 1.5 MB/s

`

(yes… “dd” isn’t a great benchmark, but it’s trivial to show the issue). Once I switch to the performance governor, things improve quite a bit:

root@FPP:/home/fpp# cpufreq-set -g performance root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=64 64+0 records in 64+0 records out 67108864 bytes (67 MB, 64 MiB) copied, 6.96759 s, 9.6 MB/s root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=64 64+0 records in 64+0 records out 67108864 bytes (67 MB, 64 MiB) copied, 6.98015 s, 9.6 MB/s

It’s still not anywhere near what a Raspberry Pi is able to do with the same thumb drive (30MB/s), but it’s a huge improvement.

Is there any setting or anything that can be used to improve the read performance of the USB besides locking the CPU at 1Ghz?

PERFORMANCE should be the default governor, for a long time it was on-demand..

If you know what USB devices you'll be plugging in, switch the MUSB
DMA mode from the cpu to cppi4.1 via:

diff --git a/patches/defconfig b/patches/defconfig
index 661d1a5..31a8caf 100644
--- a/patches/defconfig
+++ b/patches/defconfig
@@ -4601,7 +4601,8 @@ CONFIG_USB_MUSB_AM335X_CHILD=y

This was with the latest debian stretch image from beaglebone.org with an updated kernel. It seems to be using ondemand by default.

I need wifi support as well. :frowning:

Dan

I'm been trying to track down why the USB performance on my BBB's has been abysmal. I've discovered that the default on-demand governor is definitely a major contributor to the slowdown.

Basically, with the ondemand governor, I'm seeing read performance off of a USB3 thumb drive of well under 2MB/sec. In other words, really slow. For example:

root@FPP:/home/fpp# uname -a
Linux FPP 4.14.60-ti-r67 #1 SMP PREEMPT Sat Aug 4 19:54:06 UTC 2018 armv7l GNU/Linux
root@FPP:/home/fpp# cpufreq-set -g ondemand
root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 24.9291 s, 1.3 MB/s
root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 22.283 s, 1.5 MB/s

(yes.. "dd" isn't a great benchmark, but it's trivial to show the issue). Once I switch to the performance governor, things improve quite a bit:

root@FPP:/home/fpp# cpufreq-set -g performance
root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=64
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 6.96759 s, 9.6 MB/s
root@FPP:/home/fpp# dd if=/dev/sda1 of=/dev/null bs=1048576 count=64
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 6.98015 s, 9.6 MB/s

It's still not anywhere near what a Raspberry Pi is able to do with the same thumb drive (30MB/s), but it's a huge improvement.

Is there any setting or anything that can be used to improve the read performance of the USB besides locking the CPU at 1Ghz?

PERFORMANCE should be the default governor, for a long time it was on-demand..

If you know what USB devices you'll be plugging in, switch the MUSB
DMA mode from the cpu to cppi4.1 via:

diff --git a/patches/defconfig b/patches/defconfig
index 661d1a5..31a8caf 100644
--- a/patches/defconfig
+++ b/patches/defconfig
@@ -4601,7 +4601,8 @@ CONFIG_USB_MUSB_AM335X_CHILD=y
#
# MUSB DMA mode
#
-CONFIG_MUSB_PIO_ONLY=y
+# CONFIG_MUSB_PIO_ONLY is not set
+CONFIG_USB_TI_CPPI41_DMA=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_HOST is not set
# CONFIG_USB_DWC3_GADGET is not set

You "will" lose compatibly with some usb devices. (most the wifi
ones..).. But for mass storage it should be fine..

Are there e2e bug reports for dongles that fail when DMA mode is used?