Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jul 2013 09:26:55 +0200
From:      =?utf-8?Q?Hans_Petter_Selasky?= <hans.petter.selasky@bitfrost.no>
To:        =?utf-8?Q?Peter_Jeremy?= <peter@rulingia.com>,  =?utf-8?Q?Hans_Petter_Selasky?= <hselasky@c2i.net>,  =?utf-8?Q?Oleksandr_Tymoshenko?= <gonzo@bluezbox.com>
Cc:        =?utf-8?Q?freebsd-arm=40freebsd=2Eorg?= <freebsd-arm@freebsd.org>
Subject:   RE: USB Performance on Raspberry Pi
Message-ID:  <zarafa.51d9183f.5b0b.0852dced62fdc5b9@mail.lockless.no>
In-Reply-To: <20130707031732.GS39302@server.rulingia.com>
References:  <20130707031732.GS39302@server.rulingia.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,=0D=0A=0D=0AThe DWC OTG hardware DMA API for doing USB transfers is si=
mply crap, custom made and non-standard compared to XHCI/UHCI/OHCI and EH=
CI. I`ve chosen stability over throughput. Be glad the driver in the tree=
 works reliably for BULK/CONTROL/INTERRUPT transfer types and all USB spe=
eds.=0D=0A=0D=0APing times are high because we use a 10ms timer to poll U=
SB transfers. This is due to some design decisions made by the Synopsys g=
uys, called a single shared fifo. Other chipset makers do this part compl=
etely different.=0D=0A=0D=0AIf you look at the linux USB mailing list you=
 will see a lot of error reports regarding the DWC OTG and raspberry PI, =
for example in-ability to use USB audio devices, which even under Linux's=
 DMA support require 8000 IRQ/s. The main reason we are getting low throu=
ghput is because the internal bus of the ARM core they use in the RPi is =
slow. Maybe there are some knobs to beef it up or adjust the clocks=3F=0D=
=0A=0D=0A--HPS=0D=0A=20=0D=0A-----Original message-----=0D=0A> From:Peter=
 Jeremy <peter@rulingia.com <mailto:peter@rulingia.com> >=0D=0A> Sent: Su=
nday 7th July 2013 5:18=0D=0A> To: Hans Petter Selasky <hselasky@c2i.net =
<mailto:hselasky@c2i.net> >=0D=0A> Cc: freebsd-arm@freebsd.org <mailto:fr=
eebsd-arm@freebsd.org>=20=0D=0A> Subject: USB Performance on Raspberry Pi=
=0D=0A>=20=0D=0A> Hi Hans,=0D=0A>=20=0D=0A> USB performance on the Raspbe=
rry Pi is rather lacking.  This is important=0D=0A> because pretty much e=
verything goes via USB.  Do you have any suggestions=0D=0A> on how to fix=
 the bottlenecks=3F  I suspect one is that FreeBSD is using=0D=0A> PIO, w=
hereas Linux is using DMA.=0D=0A>=20=0D=0A> I've previously commented abo=
ut the sawtooth pattern in ping times:=0D=0A> 64 bytes from 192.168.123.2=
31: icmp_seq=3D6 ttl=3D64 time=3D2.701 ms=0D=0A> 64 bytes from 192.168.12=
3.231: icmp_seq=3D7 ttl=3D64 time=3D1.465 ms=0D=0A> 64 bytes from 192.168=
=2E123.231: icmp_seq=3D8 ttl=3D64 time=3D10.589 ms=0D=0A> 64 bytes from 1=
92.168.123.231: icmp_seq=3D9 ttl=3D64 time=3D9.688 ms=0D=0A> 64 bytes fro=
m 192.168.123.231: icmp_seq=3D10 ttl=3D64 time=3D8.673 ms=0D=0A> 64 bytes=
 from 192.168.123.231: icmp_seq=3D11 ttl=3D64 time=3D7.330 ms=0D=0A> 64 b=
ytes from 192.168.123.231: icmp_seq=3D12 ttl=3D64 time=3D6.857 ms=0D=0A> =
64 bytes from 192.168.123.231: icmp_seq=3D13 ttl=3D64 time=3D5.946 ms=0D=0A=
> 64 bytes from 192.168.123.231: icmp_seq=3D14 ttl=3D64 time=3D3.955 ms=0D=
=0A> 64 bytes from 192.168.123.231: icmp_seq=3D15 ttl=3D64 time=3D2.079 m=
s=0D=0A> 64 bytes from 192.168.123.231: icmp_seq=3D16 ttl=3D64 time=3D1.0=
72 ms=0D=0A>=20=0D=0A> Whereas pinging a Linux RPi gives:=0D=0A> round-tr=
ip min/avg/max/stddev =3D 0.276/0.373/0.455/0.049 ms=0D=0A>=20=0D=0A> yon=
gari@ gave me same patches for the SMSC NIC but they didn't have=0D=0A> a=
ny noticable effect.=0D=0A>=20=0D=0A> And the network throughput is also =
well below what Linux can achieve.=0D=0A>=20=0D=0A> If I connect an exter=
nal USB disk to a Linux RPi, I get 20.6 MBps=0D=0A> read.  The same disk =
on FreeBSD RPi gives 6.3 MBps - with =CB=9C50%=0D=0A> interrupt time.=0D=0A=
>=20=0D=0A> --=20=0D=0A> Peter Jeremy=0D=0A>=20=0D=0A=0D=0A
From owner-freebsd-arm@FreeBSD.ORG  Mon Jul  8 05:20:57 2013
Return-Path: <owner-freebsd-arm@FreeBSD.ORG>
Delivered-To: freebsd-arm@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by hub.freebsd.org (Postfix) with ESMTP id 47C3E2FB
 for <freebsd-arm@freebsd.org>; Mon,  8 Jul 2013 05:20:57 +0000 (UTC)
 (envelope-from beattidp@ieee.org)
Received: from mail28c40.carrierzone.com (mail92c40.carrierzone.com
 [209.235.156.232])
 by mx1.freebsd.org (Postfix) with ESMTP id 0AFD51886
 for <freebsd-arm@freebsd.org>; Mon,  8 Jul 2013 05:20:55 +0000 (UTC)
X-Authenticated-User: douglas.hytherion.com
Received: from [192.168.0.114] (75-169-17-71.slkc.qwest.net [75.169.17.71])
 (authenticated bits=0)
 by mail28c40.carrierzone.com (8.13.6/8.13.1) with ESMTP id r6856Qa5014826;
 Mon, 8 Jul 2013 05:06:28 +0000
From: Douglas Beattie <beattidp@ieee.org>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Date: Sun, 7 Jul 2013 23:06:26 -0600
Subject: NFS root on BeagleBone Black
To: freebsd-arm@freebsd.org
Message-Id: <0D94186F-F592-44C4-9F76-9E4B4B487468@ieee.org>
Mime-Version: 1.0 (Apple Message framework v1283)
X-Mailer: Apple Mail (2.1283)
X-CSC: 0
X-CHA: v=2.0 cv=G5ir5aY5 c=1 sm=1 a=QH74cCGCLv9v+F+JjM4yLg==:17
 a=ONEJXaA8-E4A:10 a=kj9zAlcOel0A:10 a=o83nqyVRAAAA:8 a=39upzztlqLgA:10
 a=zn2f7dn1AAAA:8 a=DlOy9Xx6AAAA:8 a=uhlOL7uRojv0FxRHpEcA:9
 a=CjuIK1q_8ugA:10 a=A4rZ4fTmhmQHnvC-:21 a=uR7PaQ0dK_Pw1Q7p:21
 a=QH74cCGCLv9v+F+JjM4yLg==:117
X-CTCH-RefID: str=0001.0A020209.51DA48D4.004C, ss=1, re=0.000, recu=0.000,
 reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: 0.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-BeenThere: freebsd-arm@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Porting FreeBSD to the StrongARM Processor <freebsd-arm.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-arm>,
 <mailto:freebsd-arm-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-arm>;
List-Post: <mailto:freebsd-arm@freebsd.org>
List-Help: <mailto:freebsd-arm-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-arm>,
 <mailto:freebsd-arm-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 08 Jul 2013 05:20:57 -0000

Working with the BeagleBone Black, I'm hoping to achieve boot to NFS =
root.
Thinking I'm fairly far along, I'm stuck with an 'error 19' at the final =
steps of
booting the kernel. Here's a little background -- any hints would be =
appreciated.

On FreeBSD 9.1, I have a TFTP server, plus an NFS export on the same =
folder;
here are a few snippets from the console, which confirm this.

[bsd03: /root/oss/crochet-freebsd]# tail -n2 /etc/inetd.conf=20
tftp    dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l =
-s /opt/tftpboot
tftp    dgram   udp6    wait    root    /usr/libexec/tftpd      tftpd -l =
-s /opt/tftpboot
[bsd03: /root/oss/crochet-freebsd]# cat /etc/exports
/opt/tftpboot -maproot=3D0 -alldirs -network 192.168.0.0 -mask =
255.255.255.0
[bsd03: /root/oss/crochet-freebsd]# showmount -e
Exports list on localhost:
/opt/tftpboot                      192.168.0.0=20

I have built (using the excellent crochet facility) and can boot FreeBSD =
from
the microSD card, and I have verified that I can NFS mount the exported =
folder.

Then, I created a custom kernel configuration, BEAGLEBONENFSROOT, with
just a couple changes, as follows:

options         NFS_ROOT                #NFS usable as /, requires NFSCL
options         =
ROOTDEVNAME=3D\"nfs:192.168.0.198:/opt/tftpboot/beaglebone\"

And, then I built the kernel from the command line, with DESTDIR into my =
target
folder for NFS root, doing all the make targets in turn; buildworld, =
buildkernel,
installkernel, installworld, distrib-dirs, distribution ...

So, since I already have U-Boot available, starting from there, I booted =
and entered
a few commands as shown below, such that:

U-Boot# setenv serverip 192.168.0.198
U-Boot# setenv bootfile beaglebone/boot/kernel/kernel
U-Boot# dhcp
U-Boot# bootelf

And it does boot my kernel via TFTP, and make it all the way to the =
point where it tries to
mount the NFS root, but dies and drops to 'mountroot>' prompt (where I =
try the same mount,
but to no avail). For reference, here's the console output of the =
results ...


U-Boot SPL 2013.04 (Jul 04 2013 - 21:33:25)
OMAP SD/MMC: 0
reading bb-uboot.img
reading bb-uboot.img

U-Boot 2013.04 (Jul 04 2013 - 21:33:25)

I2C:   ready
DRAM:  512 MiB
WARNING: Caches not enabled
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Using default environment

musb-hdrc: ConfigData=3D0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, =
SoftConn)
musb-hdrc: MHDRC RTL version 2.0=20
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Peripheral mode controller at 47401000 using PIO, IRQ 0
musb-hdrc: ConfigData=3D0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, =
SoftConn)
musb-hdrc: MHDRC RTL version 2.0=20
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Host mode controller at 47401800 using PIO, IRQ 0
Net:   <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot:  0
U-Boot# =20
U-Boot# setenv serverip 192.168.0.198
U-Boot# setenv bootfile beaglebone/boot/kernel/kernel
U-Boot# dhcp
link up on port 0, speed 100, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.0.123
Using cpsw device
TFTP from server 192.168.0.198; our IP address is 192.168.0.123
Filename 'beaglebone/boot/kernel/kernel'.
Load address: 0x88000000
Loading: =
#################################################################
         =
#################################################################
         =
#################################################################
         =
#################################################################
         =
#################################################################
         ########################
         824.2 KiB/s
done
Bytes transferred =3D 5119286 (4e1d36 hex)
U-Boot# bootelf
## Starting application at 0xc0200100 ...
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2013 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights =
reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-CURRENT #1 r252709: Sun Jul  7 19:02:13 UTC 2013
    =
root@fbsd91-vm03.midnight-engineer.org:/usr/src/_head/obj/arm.armv6/usr/sr=
c/_head/sys/BEAGLEBONENFSROOT arm
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
WARNING: WITNESS option enabled, expect reduced performance.
CPU: Cortex A8-r3 rev 2 (Cortex-A core)
 Supported features: ARM_ISA THUMB2 JAZELLE THUMBEE ARMv4 Security_Ext
 WB disabled EABT branch prediction enabled
LoUU:2 LoC:2 LoUIS:1=20
Cache level 1:=20
 32KB/64B 4-way data cache WT WB Read-Alloc
 32KB/64B 4-way instruction cache Read-Alloc
Cache level 2:=20
 256KB/64B 8-way unified cache WT WB Read-Alloc Write-Alloc
real memory  =3D 268435456 (256 MB)
avail memory =3D 252329984 (240 MB)
Texas Instruments AM3358 Processor, Revision ES1.1
random device not loaded; using insecure entropy
simplebus0: <Flattened device tree simple bus> on fdtbus0
aintc0: <TI AINTC Interrupt Controller> mem 0x48200000-0x48200fff on =
simplebus0
aintc0: Revision 5.0
ti_scm0: <TI Control Module> mem 0x44e10000-0x44e11fff on simplebus0
am335x_prcm0: <AM335x Power and Clock Management> mem =
0x44e00000-0x44e012ff on simplebus0
am335x_prcm0: Clocks: System 24.0 MHz, CPU 550 MHz
am335x_dmtimer0: <AM335x DMTimer> mem =
0x44e05000-0x44e05fff,0x44e31000-0x44e31fff,0x48040000-0x48040fff,0x480420=
00-0x48042fff,0x48044000-0x48044fff,0x48046000-0x48046fff,0x48048000-0x480=
48fff,0x4804a000-0x4804afff irq 66,67,68,69,92,93,94,95 on simplebus0
Timecounter "AM335x Timecounter" frequency 24000000 Hz quality 1000
Event timer "AM335x Eventtimer0" frequency 24000000 Hz quality 1000
gpio0: <TI General Purpose I/O (GPIO)> mem =
0x44e07000-0x44e07fff,0x4804c000-0x4804cfff,0x481ac000-0x481acfff,0x481ae0=
00-0x481aefff irq 96,97,98,99,32,33,62,63 on simplebus0
gpioc0: <GPIO controller> on gpio0
gpiobus0: <GPIO bus> on gpio0
uart0: <16750 or compatible> mem 0x44e09000-0x44e09fff irq 72 on =
simplebus0
uart0: console (115384,n,8,1)
ti_edma30: <TI EDMA Controller> mem =
0x49000000-0x490fffff,0x49800000-0x498fffff,0x49900000-0x499fffff,0x49a000=
00-0x49afffff irq 12,13,14 on simplebus0
ti_edma30: EDMA revision 40014c00
ti_mmchs0: <TI MMC/SD/SDIO High Speed Interface> mem =
0x48060000-0x48060fff irq 64 on simplebus0
mmc0: <MMC/SD bus> on ti_mmchs0
cpsw0: <3-port Switch Ethernet Subsystem> mem 0x4a100000-0x4a103fff irq =
40,41,42,43 on simplebus0
cpsw0: CPSW SS Version 1.12 (0)
cpsw0: Initial queue size TX=3D128 RX=3D384
cpsw0: Ethernet address: c8:a0:30:c4:2c:6f
miibus0: <MII bus> on cpsw0
smscphy0: <SMC LAN8710A 10/100 interface> PHY 0 on miibus0
smscphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
iichb0: <TI I2C Controller> mem 0x44e0b000-0x44e0bfff irq 70 on =
simplebus0
iichb0: I2C revision 4.0
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
am335x_pmic0: <TI TPS65217 Power Management IC> at addr 0x24 on iicbus0
am335x_pwm0: <AM335x PWM> mem =
0x48300000-0x483000ff,0x48300100-0x4830017f,0x48300180-0x483001ff,0x483002=
00-0x4830025f irq 86,58 on simplebus0
Timecounters tick every 10.000 msec
ti_mmchs_update_ios: TWL unimplemented
mmcsd0: 4GB <SDHC SA04G 1.1 SN 885094389 MFG 01/2013 by 2 TM> at mmc0 =
25.0MHz/4bit/1-block
am335x_pmic0: Unknown PMIC powered by AC
WARNING: WITNESS option enabled, expect reduced performance.
Trying to mount root from nfs:192.168.0.198:/opt/tftpboot/beaglebone =
[]...
mountroot: waiting for device 192.168.0.198:/opt/tftpboot/beaglebone ...
Mounting from nfs:192.168.0.198:/opt/tftpboot/beaglebone failed with =
error 19.

Loader variables:

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        zfs:tank
        cd9660:/dev/acd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)

  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input

mountroot> nfs:192.168.0.198:/opt/tftpboot/beaglebone
Trying to mount root from nfs:192.168.0.198:/opt/tftpboot/beaglebone =
[]...
mountroot: waiting for device 192.168.0.198:/opt/tftpboot/beaglebone ...
Mounting from nfs:192.168.0.198:/opt/tftpboot/beaglebone failed with =
error 19.


That's it -- I'm excited that it made it this far, but not sure what =
that 'error 19'
means, or if there's a simple fix or workaround. I've done builds and =
boot into
NFS root for Android (at a past employer) but haven't yet achieved it on =
FreeBSD.

--
Douglas Beattie
http://www.hytherion.com/beattidp/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?zarafa.51d9183f.5b0b.0852dced62fdc5b9>