Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any xhci speed limits on NanoPI? #17

Open
dmikushin opened this issue Jan 6, 2020 · 40 comments
Open

Any xhci speed limits on NanoPI? #17

dmikushin opened this issue Jan 6, 2020 · 40 comments

Comments

@dmikushin
Copy link

What seem strange is a USB 3.0 camera won't work on its full FPS, as it does on the desktop, even with the newest EOAN kernel. I have to admit, 5.4 kernel so far shows the best FPS rate of all options, which is a pretty nice job!

FriendlyArm's 4.4 had ugly bugs on xhci, making USB 3.0 mostly not working at all. This was fixed only very recently.

Still, 5.4 kernel is yet far beyond the expected frame rate of desktop. I see CPU load is only about 30%. USB3 device is shown 5000M SuperSpeed, which is correct. The FPS rate seems to get down, if sdcard is intensively in use. Do you know of any measures to improve the xhci performance?

@dmikushin
Copy link
Author

To be more specific, a camera app deploys glib for event/callback handling. So the slowdown could be either due to less frequent event timer clocking on NanoPi, or due to slower xhci "bus" clock itself.

As I said, your kernels give a nice advantage of approx 20%: 500fps instead of 400fps. But it actually should be 800fps.

@avafinger
Copy link
Owner

FriendlyArm's 4.4 had ugly bugs on xhci, making USB 3.0 mostly not working at all. This was fixed only very recently.

For instance, can you point to related fixes on their code?

Could be the way the hardware is implemented?

@dmikushin
Copy link
Author

Sorry, I don't digg into kernel development due to the lack of time. To my experience, FriendlyArm 4.4 was affected at least by this bug, which flooded the syslog, ruining the performance.

Could be the way the hardware is implemented?

Yes, I guess it could be. On desktops SATA disks and USB controllers usually do not share the same bus. While here, sdcard and usbs are on the same hci. And the eMMC port is hci as well, correct? So they could easily flood each other. One hope might be PCIe To USB 3.0 X4 HAT for M4, which wires USB3 directly to PCIe. Yet, not clear how PCIe 2x (two lanes!) can do 5Gbs for USB3.0... Yeah, so unfortunately, this board is full of fake sh*t. Do you think other Rockships can do any better?

@avafinger
Copy link
Owner

I am not a hardware guy, so not much to add about that. I think for the price Rockchip is the best you can get. I am not sure there is support for the HAT on mainline 5.4 , but 5.5 is almost there, so there could be an improvement with the HAT, but i read you get a higher board temp. anyway, rc5 is out and it is time to give it a try soon...

@dmikushin
Copy link
Author

Do you accept sponsorship to improve certain software problems?

@avafinger
Copy link
Owner

I don't think i have the skills and time to improve the kernel. it is just amateur's work. But i can try to help if i can.

@dmikushin
Copy link
Author

Oh, not really the kernel development that much. I do have a lot of housekeeping requests related to our product. Currently your kernel ships a lot of modules, which are definitely no-use. For example, nouveau. I'd be happy to support filtering modules folder to the bare minimum required by this platform.

@dmikushin
Copy link
Author

Another significant usability problem is: nobody could ever understand what's going wrong during early boot without any logging option! I've spend days trying to get uboot or UART to print something without any luck. There must be a clear instruction how to get UART to work. There must be a uboot build to start posting boot status over HDMI as early as possible. I'd support these items right away.

@avafinger
Copy link
Owner

I've spend days trying to get uboot or UART to print something without any luck

USB-TTL Boot log you get with these parameters:

# Machine-generated file - use setup menu in minicom to change parameters.
baudrate         1500000
bits             8
parity           N
stopbits         1

The kernel then sets to 115K.

@avafinger
Copy link
Owner

I use minicom, configure the port and then fire with:

sudo minicom -D /dev/ttyUSB0

@dmikushin
Copy link
Author

Currently your kernel ships a lot of modules, which are definitely no-use.

I've measured, looks like the base system is ~300MB, but kernel modules bring additional 800MB, which is crazy :)

@avafinger
Copy link
Owner

I used RK binaries to embed in u-boot. You might have a look at Armbian which builds atf and u-boot from source, but you need to use their build system.

Here is the script to build from source: https://github.com/armbian/build/blob/master/config/sources/families/rockchip.conf

@dmikushin
Copy link
Author

I use minicom, configure the port and then fire with:

sudo minicom -D /dev/ttyUSB0

I really try hard to make it work. My UART dongle is this one. All is set, but no signal (see screenshot). I'm thinking that I need to re-program the CP2102 to add 1500000 baudrate support as mentioned here, but the procedure is not clear enough.

Screenshot from 2020-01-06 21-32-34

@dmikushin
Copy link
Author

I've checked with ESP32 this UART dongle works well. What chip your UART dongle is based on?

@avafinger
Copy link
Owner

Be careful with some UART dongle, i have learned the hard way, some have 3.41v on TX/RX that does not work on NanoPi boards. A long time ago I told FE about the problem while trying to find out why my USB-TTL never worked, and for some other board, it worked. I ended up buying https://www.friendlyarm.com/index.php?route=product/product&product_id=178 , problem fixed.

Don't know if it is your case, measure the TX and RX and see what you get.

@dmikushin
Copy link
Author

OK, I got UART for NanoPI M4 to work with this dongle. It's actually an MSP430 programmator, based on a different chip I guess. Not FE's, but works. Thank you very much for your confidence! Is there a way to do shell login through UART?

Screenshot from 2020-01-06 22-31-01

@avafinger
Copy link
Owner

At the end, it will prompt for the login (UART). You type ubuntu / ubuntu.
You are in command.

@avafinger
Copy link
Owner

alex@svn:~$ sudo minicom -D /dev/ttyUSB0
[sudo] password for alex: 
Sorry, try again.
[sudo] password for alex: 


Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB0, 20:04:51

Press CTRL-A Z for help on special keys

DDR Version 1.17 20190115
In
Channel 0: DDR3, 800MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
Channel 1: DDR3, 800MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
256B stride
ch 0 ddrconfig = 0x101, ddrsize = 0x20
ch 1 ddrconfig = 0x101, ddrsize = 0x20
pmugrf_os_reg[2]817281, stride = 0x9
OUT
Boot1: 2018-08-06, version: 1.15
CPUId = 0x0
ChipType = 0x10, mmc: ERROR: SDHCI ERR:cmd:0x102,stat:0x18000
mmc: ERROR: Card did not respond to voltage select!                             
emmc reinit                                                                     
mmc: ERROR: SDHCI ERR:cmd:0x102,stat:0x18000                                    
mmc: ERROR: Card did not respond to voltage select!                             
emmc reinit                                                                     
mmc: ERROR: SDHCI ERR:cmd:0x102,stat:0x18000                                    
mmc: ERROR: Card did not respond to voltage select!                             
SdmmcInit=2 1                                                                   
mmc0:cmd5,20                                                                    
SdmmcInit=0 0                                                                   
BootCapSize=0                                                                   
UserCapSize=30436MB                                                             
FwPartOffset=2000 , 0                                                           
StorageInit ok = 67887                                                          
SecureMode = 0                                                                  
SecureInit read PBA: 0x4                                                        
SecureInit read PBA: 0x404                                                      
SecureInit read PBA: 0x804                                                      
SecureInit read PBA: 0xc04                                                      
SecureInit read PBA: 0x1004                                                     
SecureInit read PBA: 0x1404                                                     
SecureInit read PBA: 0x1804                                                     
SecureInit read PBA: 0x1c04                                                     
SecureInit ret = 0, SecureMode = 0                                              
GPT 0x3190d20 signature is wrong                                                
LoadTrust Addr:0x4000                                                           
No find bl30.bin                                                                
No find bl32.bin                                                                
Load uboot, ReadLba = 2000                                                      
Load OK, addr=0x200000, size=0xa0bf4                                            
RunBL31 0x10000                                                                 
�NOTICE:  BL31: v1.3(debug):4f4079b                                             
NOTICE:  BL31: Built : 17:40:23, Oct 11 2018                                    
NOTICE:  BL31: Rockchip release version: v1.1                                   
INFO:    GICv3 with legacy support detected. ARM GICV3 driver initialized in EL3
INFO:    Using opteed sec cpu_context!                                          
INFO:    boot cpu mask: 0                                                       
INFO:    plat_rockchip_pmu_in31: Initializing runtime services                  
WARNING: No OPTEE provided byation. SMC`s destined for OPTEE will return SMC_UNK
ERROR:   Er Preparing for EL3 exit to normal world                              
INFO:    Entry point ad                                                         
                                                                                
U-Boot 2019.10-rc3-00141-g877294b-dirty (Sep 03 2019 - 12:47riendlyElec NanoPi 4
DRAM:  2 GiB                                                                    
MMC:   dwmmc@fe310000: 2, dwmmc@fe320000: 1, sdhci@fe330000: 0                  
Loading Environment from MMC... Card did not respond to voltage select!         
*** Warning - No block device, using default environment                        
                                                                                
In:    serial@ff1a0000                                                          
Out:   serial@ff1a0000                                                          
Err:   serial@ff1a0000                                                          
Model: FriendlyElec NanoPi M4                                                   
rockchip_dnl_key_pressed: adc_channel_single_shot fail!                         
Net:                                                                            
Error: ethernet@fe300000 address not set.                                       
eth-1: ethernet@fe3Hit any key to stop autoboot:  0                             
Card did not respond to voltage select!                                         
switch to partitions #0, OK                                                     
mmc1 is current device                                                          
Scanning mmc 1:1...                                                             
Found U-Boot script /boot.scr                                                   
1269 bytes read in 6 ms (206.1 KiB/s)                                           
## Executing script at 00500000                                                 
26055168 bytes read in 1648 ms (15.1 MiB/s)                                     
1157052 bytes read in 78 ms (14.1 MiB/s)                                        
55973 bytes read in 12 ms (4.4 MiB/s)                                           
## Flattened Device Tree blob at 01f00000                                       
   Booting using the fdt blob at 0x1f00000                                      
   Loading Ramdisk to 7de0c000, end 7df267bc ... OK                             
   Loading Device Tree to 000000007ddfb000, end 000000007de0baa4 ... OK         
                                                                                
Starting kernel ...                                                             
                                                                                
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410@svn) (gcc vers:
[    0.000000] efi: UEFI not found.00000                                        
[    0.000000] NUMA: No NUMA configuration found                                
[    0.07fffffff]                                                               
[    0.000000] NUMA: NODE_DATA [mem 0x7fbae800-0x7fb2    [mem 0x000000000020000]
[    0.000000]de                                                                
[    0.000000] Early memory node ranges                                         
[    0.000000]   no[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-.
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.                           
[    0.00: Embedded 22 pages/cpu s52952 r8192 d28968 u90112                     
[    0.0000000] CPU features: detected: ARM erratum 845719                      
[    0.000000] C0.000000] Built 1 zonelists, mobility grouping on.  Total pages0
[    0.000000] Dentry cache hash table entries: 262144 (orderache hash table enf
[    0.000000] Memory: 1961664K/2095104K available (121s, 67904K reserved, 6553)
[    0.000000] SLUB: H000000] rcu: Preemptible hierarchical RCU implementation. 
[    ds=6.                                                                      
[    0.000000]  Tasks RCU enabled.                                              
[    0.000000] rcu: Rdelay is 25 jiffies.                                       
[    0.000000] rcu: Adjusting geometry for4, nr_irqs: 64, preallocated irqs: 0  
[    0.000000] GICv3: GIC: implemented                                          
pport0.000000] GICv3: 0 Extended SPIs implemented                               
[    0.000000] GICv3: 16 PPIs implemented                                       
[    0.000000]] GICv3: CPU0: found redistributor 0 region 0:0x00000000fef000000e
[    0.000000] GICv3: using LPI property tablhing for LPI property table        
[    0.000000] GICv3: CPU0: using a GICv3: GIC: PPI partition interrupt-partiti0
[  .                                                                            
[    0.000000] clocksource: arch_sys_counter: mask: 0xfffffff[    0.000010] sch5
[    0.005319] printk: console [tty0] enabllated using timer frequency.. 48.00 )
[    005780] LSM: Security Framework initializing                               
[    0.005937] Moun[    0.005996] Mountpoint-cache hash table entries: 4096 (ors
[    0.040043] rcu: Hierarchical SRCller@fee20000 domain created                
[    0.048777] PCI/MSI: /interrupt                                              
[    0.056823] EFI services will not be available.                              
[    0.061 Detected VIPT I-cache on CPU1                                        
[    0.093948] GICv3: CPU1: founGICv3: CPU1: using allocated LPI pending table ]
[    0.126022] Detected VIPT I-cache on CPU2                                    
[   00fef40000                                                                  
[    0.126082] GICv3: CPU2: using allocated LPI pendsecondary processor 0x00000]
[    0.158180] Ded redistributor 3 region 0:0x00000000fef60000                  
[    0.158239] GI[    0.158283] CPU3: Booted secondary processor 0x0000000003 [g
[    0.193366] ARM_SMCCC_ARCH_WORKAROUND_1 missin[    0.195021] GICv3: CPU4: fo0
[    0.196747] CPU4: Boo15] Detected PIPT I-cache on CPU5                       
[    0.238004] GICv3: CPU5: f0.238434] GICv3: CPU5: using allocated LPI pending]
[    0.244698] smp: Brought up 1 node, 6 [    0.245346] CPU features: detected:t
[    02695] CPU: All CPU(s) started at EL2                                      
[    0.403442] alternativzed                                                    
[    0.438112] clocksource: jiffies: mask: 0xffffffff max_c342] futex hash tabln
[    0.449211] DMI not present or invalid.                                      
[    0.450203] NETated 256 KiB pool for atomic allocations                      
[    0.470078] audit: it: type=2000 audit(0.460:1): state=initialized audit_enas
[    0.579606] HugeTLB registered 2.00 MiB page size 64.0 KiB page size, pre-als
[    0.605094] cryptisabled.                                                    
[    0.626950] vcc5v0_core: supplied by vdd_5v                                  
[    0_typec: supplied by vdd_5v                                                
[    0.628059] vcc5v0_usb1: suppliedre                                          
[    0.628538] vcc3v0_sd: supplied by vcc3v3_sys                                
[    0.628iommu: Default domain type: Translated                                
[    0.637041] vgaarb: 95] usbcore: registered new interface driver usbfs       
[    0.64031] usbcore: registered new device driver usb                         
[    0.643352] pps_Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <0
[    0.649050] FPGA manager river Initialized.                                  
[    0.653076] clocksource: Switched to cloct_6.6.0                             
[    0.654010] VFS: Dquot-cache hash table entries: 512                         
                                                       [    0.668886] thermal_s'
[    0.670399] NET: Registered protocol faes: 1024 (order: 2, 16384 bytes, line)
[    0.671625] TCP estear)                                                      
[    0.671998] TCP bind hash table entries: 16384 (order: igured (established 1)
[    0.673281] UDP hash t.673429] UDP-Lite hash table entries: 1024 (order: 3, .
[    0.677145] 0.677191] PCI: CLS 0 bytes, default 64                           
[    0.678151] Unpacking[    0.806723] hw perfevents: enabled with armv8_cortexe
[  kvm [1]: vgic-v2@fff20000                                                    
[    0.813738] kvm [1]: GIC system rerupt IRQ10                                 
[    0.819106] kvm [1]: Hyp mode initialized success[    0.931331] workingset: r
[    0.952238] NFS: Registering the id_resolver key 0.952421] Key type id_legacd
[    0.952461] nfs4file7973] Key type asymmetric registered                     
[    0.998066] Asymmetric I generic (bsg) driver version 0.4 loaded (major 245) 
[    0.99heduler kyber registered                                               
[    1.054996] EINJ: ACPI disabled.                                             
[for PL330 DMAC-241330                                                          
[    1.073738] dma-pl330 ff6d0000.dma-con[    1.077258] dma-pl330 ff6e0000.dma-d
[    1.110851] ff180000.serial: ttyS0 at MMIO 0x.111358] serial serial0: tty pod
[    1.11261= 1500000) is a 16550A                                              
[    1.212565] printk: console [ttyS2] e[    1.217380] SuperH (H)SCI(F) driver d
[    1.219873] msm_serial: driver initialized                                   
[    1.225802] cacheinfo: Unable to detect cache hierarchy for CPU 0            
[    1.245720] loop: module loaded                                              
[    1.261546] libphy: Fixed MDIO Bus: probed                                   
[    1.262763] tun: Universal TUN/TAP device driver, 1.6                        
[    1.266911] thunder_xcv, ver 1.0                                             
[    1.267313] thunder_bgx, ver 1.0                                             
[    1.267711] nicpf, ver 1.0                                                   
[    1.270205] hclge is initializing                                            
[    1.270527] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - versin
[    1.271191] hns3: Copyright (c) 2017 Huawei Corporation.                     
[    1.271 Network Driver - 3.2.6-k                                             
[    1.272402] e1000e: Copyright(c) 1273105] igb: Intel(R) Gigabit Ethernet Net.
[    1.274354] igbvf: Intel(R) Gigabit Virtual Function 74] igbvf: Copyright (c.
[    1.276895] sky2: driver version 1.30                                        
[    1.279786] VFIO - User Level meta-driver version: 0.3                       
[    1.294007] OF: graph: no port node found in /syscon@ff770000/usb2-phy@e450/t
[    1.311044] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver       
[    1.311821] ehci-pci: EHCI PCI platform driver                               
[    1.312327] ehci-platform: EHCI generic platform driver                      
[    1.315957] ehci-platform fe380000.usb: EHCI Host Controller                 
[    1.316565] ehci-platform fe380000.usb: new USB bus registernumber 1         
[    1.318285] ehci-platform fe380000.usb: irq 31, io mem 0xfe380000            
[    1.332912] ehci-platform fe380000.usb: USB 2.0 started, EHCI 1.00           
[    1.335586] hub 1-0:1.0: USB hub found                                       
[    1.336007] hub 1-0:1.0: 1 port detected                                     
[    1.339657] ehci-platform fe3c0000.usb: EHCI Host Controller                 
[    1.340217] ehci-platform fe3c0000.usb: new USB bus registered, assigned bus2
[    1.356919] ehci-platform fe3c0000.usb: USB 2.0 started, EHCI 1.00           
[    1.358793] hub 2-0:1.0: USB hub found                                       
[    1.359203] hub 2-0:1.0: 1 port detected                                     
[    1.360741] ehci-orion: EHCI orion driver                                    
[    1.361658] ehci-exynos: EHCI EXYNOS driver                                  
[    1.362370] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver           
[    1.363051] ohci-pci: OHCI PCI platform driver                               
[    1.363580] ohci-platform: OHCI gener[    1.364628] ohci-platform fe3a0000.ur
[    1.365392] ohci-platform fe3a0000.usb: new USB bus re[    1.366504] ohci-pld
[    1.430971] hub 3-0:1.0: 1 port detected                                     
[    1.432447] ohci-platform fe3e0000.usb: Generic Platform OHCI controller     
[    1.433154] ohci-platform fe3e0000.usb: new USB bus registered, assigned bus4
[    1.434186] ohci-platform fe3e0000.usb: irq 34, io mem 0xfe3e0000            
[    1.498020] hub 4-0:1.0: USB hub found                                       
[    1.498429] hub 4-0:1.0: 1 port detected                                     
[    1.499878] ohci-exynos: OHCI EXYNOS driver                                  
[    1.502313] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller                   
[    1.502892] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus n5
[    1.503903] xhci-hcd xhci-hcd.0.auto: hcc params 0x0220fe64 hci version 0x110
[    1.504938] xhci-hcd xhci-hcd.0.auto: irq 227, io mem 0xfe800000             
[    1.507741] hub 5-0:1.0: USB hub found                                       
[    1.508154] hub 5-0:1.0: 1 port detected                                     
[    1.509437] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller                   
[    1.509973] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus n6
[    1.51SuperSpeed                                                             
[    1.511428] usb usb6: We don't know the algorithm[    1.513485] hub 6-0:1.0:d
[    1.513895] hub 6-0:1.0: 1 port detected                                     
[    1.515218] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller                   
[    1.515761] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus n7
[    1.516906] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220fe64 hci version 0x110
[    1.520181] hub 7-0:1.0: USB hub found                                       
[    1.520593] hub 7-0:1.0: 1 port detected                                     
[    1.521654] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller                   
[    1.522189] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus n8
[    1.521.auto: Host supports USB 3.0 SuperSpeed                               
[    1.523621] usb usbost, disabling LPM.                                       
[    1.525568] hub 8-0:1.0: USB hub found                                       
[    1.525990] hub 8-0:1.0: 1 port detected                                     
[    1.528070] usbcore: registered new interface driver usb-storage             
[    1.539899] i2c /dev entries driver                                          
[    1.550275] fan53555-regulator 0-0040: FAN53555 Option[8] Rev[1] Detected!   
[    1.551132] fan53555-reg: supplied by vcc3v3_sys                             
[    1.554321] fan53555-regulator 0-0041: FAN53555 Option[8] Rev[1] Detected!   
[    1.554996] fan53555-reg: supplied by vcc3v3_sys                             
[    1.558070] rk808 0-001b: chip id: 0x0                                       
[    1.566728] rk808-regulator rk808-regulator: there is no dvs0 gpio           
[    1.567466] rk808-regulator rk808-regulator: there is no dvs1 gpio           
[    1.568146] DCDC_REG1: supplied by vcc3v3_sys                                
[    1.570198] DCDC_REG2: supplied by vcc3v3_sys                                
[    1.571498] DCDC_REG3: supplied by vcc3v3_sys                                
[    1.572318] DCDC_REG4: supplied by vcc3v3_sys                                
[    1.573685] LDO_REG1: supplied by vcc3v3_sys                                 
[    1.575741] LDO_REG2: supplied by vcc3v3_sys                                 
[    1.577442] LDO_REG3: supplied by vcc3v3_sys                                 
[    1.579240] LDO_REG4: supplied by vcc3v3_sys                                 
[    1.581096] LDO_REG5: supplied by vcc3v3_sys                                 
[    1.582744] LDO_REG6: supplied by vcc3v3_sys                                 
[    1.584550] LDO_REG7: supplied by vcc3v3_sys                                 
[    1.586343] LDO_REG8: supplied by vcc3v3_sys                                 
[    1.588207] SWITCH_REG1: supplied by vcc3v3_sys                              
[    1.589250] SWITCH_REG2: supplied by vcc3v3_sys                              
[    1.616001] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 400000 z
[    1.617612] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changez
[    1.621101] cpufreq: cpufreq_online: CPU4: Running at unlisted freq: 12000 Kz
[    1.622627] random: fast init done                                           
[    1.623301] cpufreq: cpufreq_online: CPU4: Unlisted initial frequency changez
[    1.626797] sdhci: Secure Digital Host Controller Interface driver           
[    1.627346] sdhci: Copyright(c) Pierre Ossman                                
[    1.628132] Synopsys Designware Multimedia Card Interface Driver             
[    1.629603] dwmmc_rockchip fe310000.dwmmc: IDMAC supports 32-bit address mod.
mmc: Version ID is 270ackchip fe310000.dwmmc: Using internal DMA controller.    
[    1.631410] dwmmc_rockchip fe310000. deep fifo                               
[    1.632357] dwmmc_rockchip fe310000.dwmmc: allocas non-removable.            
[    1.646494] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz,)
[    1.660668] dwmmc_rockchip fe320000.dwmmc: IDMAC supports 32-bit address mod.
ip fe320000.dwmmc: Version ID is 270a0.dwmmc: Using internal DMA controller.    
[    1.662529] dwmmc_rock data width,256 deep fifo                              
[    1.663545] dwmmc_rockchip fe32000[    1.677267] mmc_host mmc1: Bus speed (s)
[    1.691974] sdhci-pltfm: SDHCI platform and OF driver helper                 
[    1.693799] mmc2: CQHCI version 5.10                                         
[    1.696825] mmc0: queuing unknown CIS tuple 0x80 (2 bytes)                   
[    1.699364] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)                   
[    1.701585] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)                   
[    1.705018] mmc0: queuing unknown CIS tuple 0x80 (7 bytes)                   
Waiting for root system /dev/mmcblk1p2, countdown : 4                           
Rootfs: /dev/mmcblk1p2                                                          
[    6.824126] EXT4-fs (mmcblk1p2): mounted filesystem without journal. Opts: ()
[    7.195154] systemd[1]: System time before build time, advancing clock.      
[    7.513305] NET: Registered protocol family 10                               
[    7.514320] Segment Routing w[    7.559444] systemd[1]: systemd 242 running )
[    7.561688] systemd[1]: Detected architecture arm64                          
Welcome to Ubuntu 19.10!                                                        
                                                                                
[    7.619839] systemd[1]: Set hostname to <nanopi-m4>.                         
[    7.621164] systemd[1]: Failed to bump fs.file-max, ignoring: Invalid argumet
[    7.810484] systemd[1]: File /lib/systemd/system/systemd-journald.service:12)
[    7.971355] systemd[1]: Listening on udev Control Socket.                    
[  OK  ] Listening on udev Control Socket.                                      
[    7.980817] random: systemd: uninitialized urandom read (16 bytes read)      
[    7.981486] systemd[1]: Started Forward Password Requests to Wall Directory )
[    7.993633] systemd[1]: Reached target Remote Fil[  OK  ] Reached target Rem.
         Mounting POSIX Message Queue File System...                            
         Mounting Huge Pages File System...                                     
[  OK  ] Created slice system-serial\x2dgetty.slice.                            
[  OK  ] Listening on Syslog Socket.                                            
         Mounting Kernel Debug File System...                                   
[  OK  ] Listening on udev Kernel Socket.                                       
         Starting udev Coldplug all Devices...                                  
[    8.072916] phy phy-ff770000.syscon:[email protected]: charger = USB_DCP_CHARGR
[  OK  ] Created slice User and Session Slice.                                  
[  OK  ] Created slice system-systemd\x2dfsck.slice.                            
         Starting Set the console keyboard layout...                            
[  OK  ] Listening on initctl Compatibility Named Pipe.                         
         Starting Load Kernel Modules...                                        
[  OK  ] Started Dispatch Password ��…ts to Console Directory Watch.            
[  OK  ] Reached target Local Encrypted Volumes.                                
[  OK  ] Listening on Journal Audit Socket.                                     
         Starting Nameserver information manager...                             
[  OK  ] Listening on Journal Socket (/dev/log).                                
         Starting Journal Service...                                            
[  OK  ] Reached target Swap.                                                   
[  OK  ] Listening on fsck to fsckd communication Socket.                       
         Starting Remount Root and Kernel File Systems...                       
         Starting Create list of re��…odes for the current kernel...            
[    8.222273] EXT4-fs (mmcblk1p2): re-mounted. Opts: commit=600,errors=remounto
[  OK  ] Reached target Slices.                                                 
[  OK  ] Mounted POSIX Message Queue File System.                               
[  OK  ] Mounted Huge Pages File System.                                        
[  OK  ] Mounted Kernel Debug File System.                                      
[  OK  ] Started Set the console keyboard layout.                               
[  OK  ] Started Load Kernel Modules.                                           
[  OK  ] Started Remount Root and Kernel File Systems.                          
[  OK  ] Started Create list of req��… nodes for the current kernel.            
[  OK  ] Started Nameserver information manager.                                
[  OK  ] Reached target Network (Pre).                                          
         Starting Load/Save Random Seed...                                      
         Starting Create System Users...                                        
         Starting Apply Kernel Variables...                                     
         Mounting Kernel Configuration File System...                           
[  OK  ] Started Load/Save Random Seed.                                         
[  OK  ] Started Journal Service.                                               
[  OK  ] Started udev Coldplug all Devices.                                     
[  OK  ] Started Create System Users.                                           
[  OK  ] Started Apply Kernel Variables.                                        
[  OK  ] Mounted Kernel Configuration File System.                              
         Starting Create Static Device Nodes in /dev...                         
         Starting Helper to synchronize boot up for ifupdown...                 
         Starting Flush Journal to Persistent Storage...                        
[  OK  ] Started Helper to synchronize boot up for ifupdown.                    
[  OK  ] Started Create Static Device Nodes in /dev.                            
         Starting udev Kernel Device Manager...                                 
[  OK  ] Reached target Local File Systems (Pre).                               
[  OK  ] Started Flush Journal to Persistent Storage.                           
[  OK  ] Started udev Kernel Device Manager.                                    
[  OK  ] Found device /dev/ttyS2.                                               
[    9.254838] rk_gmac-dwmac fe300000.ethernet: IRQ eth_wake_irq not found      
[    9.255447] rk_gm[    9.256281] rk_gmac-dwmac fe3[    9.460762] rockchip-pci!
[  OK  ] Listening on Load/Save RF ��…itch S[  OK  ] Found device /sys/subsyste.
         Starting Load/Save RF Kill Switch Status...                            
[  OK  ] Started Load/Save RF Kill Switch Status.                               
[  OK  ] Found device /dev/mmcblk1p1.                                           
         Starting File System Check on /dev/mmcblk1p1...                        
[  OK  ] Started File System Check Daemon to report status.                     
[  OK  ] Started File System Check on /dev/mmcblk1p1.                           
         Mounting /boot...                                                      
[  OK  ] Mounted /boot.                                                         
[  OK  ] Reached target Local File Systems.                                     
         Starting Create Volatile Files and Directories...                      
         Starting Set console font and keymap...                                
         Starting Raise network interfaces...                                   
[  OK  ] Started ifup for eth0.                                                 
[  OK  ] Started Set console font and keymap.                                   
[  OK  ] Started Create Volatile Files and Directories.                         
         Starting Network Time Synchronization...                               
         Starting Network Name Resolution...                                    
         Starting Update UTMP about System Boot/Shutdown...                     
[  OK  ] Started Raise network interfaces.                                      
[  OK  ] Started Update UTMP about System Boot/Shutdown.                        
[  OK  ] Started Network Name Resolution.                                       
[  OK  ] Reached target Host and Network Name Lookups.                          
[  OK  ] Started Network Time Synchronization.                                  
[  OK  ] Reached target System Time Set.                                        
[  OK  ] Reached target System Time Synchronized.                               
[  OK  ] Reached target System Initialization.                                  
[  OK  ] Started Daily rotation of log files.                                   
[  OK  ] Started Message of the Day.                                            
[  OK  ] Started Daily Cleanup of Temporary Directories.                        
[  OK  ] Listening on D-Bus System Message Bus Socket.                          
[  OK  ] Started resolvconf-pull-resolved.path.                                 
[  OK  ] Reached target Paths.                                                  
[  OK  ] Started Discard unused blocks once a week.                             
[  OK  ] Started Periodic ext4 Onli��…ata Check for All Filesystems.            
[  OK  ] Started Daily man-db regeneration.                                     
         Starting Socket activation for snappy daemon.                          
[  OK  ] Started Daily apt download activities.                                 
[  OK  ] Started Daily apt upgrade and clean activities.                        
[  OK  ] Reached target Timers.                                                 
[  OK  ] Listening on Socket activation for snappy daemon.                      
[  OK  ] Reached target Sockets.                                                
[  OK  ] Reached target Basic System.                                           
         Starting Login Service...                                              
         Starting Bluetooth service...                                          
[  OK  ] Started Set the CPU Frequency Scaling governor.                        
[  OK  ] Started D-Bus System Message Bus.                                      
         Starting Deferred execution scheduler...                               
         Starting System Logging Service...                                     
         Starting Dispatcher daemon for systemd-networkd...                     
[  OK  ] Started Save initial kernel messages after boot.                       
         Starting Remove Stale Onli��…t4 Metadata Check Snapshots...            
         Starting WPA supplicant...                                             
         Starting Snappy daemon...                                              
         Starting resolvconf-pull-resolved.service...                           
[  OK  ] Reached target Sound Card.                                             
[  OK  ] Started Regular background program processing daemon.                  
[  OK  ] Started Deferred execution scheduler.                                  
[  OK  ] Started Bluetooth service.                                             
[  OK  ] Reached target Bluetooth.                                              
[  OK  ] Started System Logging Service.                                        
[  OK  ] Started resolvconf-pull-resolved.service.                              
[  OK  ] Stopped Deferred execution scheduler.                                  
         Starting Deferred execution scheduler...                               
         Starting Hostname Service...                                           
[  OK  ] Started Deferred execution scheduler.                                  
[  OK  ] Started WPA supplicant.                                                
[  OK  ] Reached target Network.                                                
         Starting OpenBSD Secure Shell server...                                
         Starting Permit User Sessions...                                       
[  OK  ] Started Login Service.                                                 
[  OK  ] Started Permit User Sessions.                                          
[  OK  ] Stopped Deferred execution scheduler.                                  
         Starting Deferred execution scheduler...                               
         Starting Set console scheme...                                         
[  OK  ] Started Serial Getty on ttyS2.                                         
[  OK  ] Started Deferred execution scheduler.                                  
[  OK  ] Started Set console scheme.                                            
[  OK  ] Created slice system-getty.slice.                                      
[  OK  ] Started Getty on tty1.                                                 
[  OK  ] Reached target Login Prompts.                                          
[  OK  ] Stopped Deferred execution schedule         Starting Deferred executio.
[  OK  ] Started OpenBSD Secure Shell server.                                   
[  OK  ] Started Deferred execution scheduler.                                  
[  OK  ] Started Hostname Service.                                              
[   12.325453] Filesystem uses "xz" compression. This is not supported          
[  OK  ] Stopped Deferred execution scheduler.                                  
         Starting Deferred execution scheduler...                               
[  OK  ] Started Deferred execution scheduler.                                  
[  OK  ] Started Dispatcher daemon for systemd-networkd.                        
[  OK  ] Started Snappy daemon.                                                 
         Starting Wait until snapd is fully seeded...                           
[  OK  ] Started Wait until snapd is fully seeded.                              
[  OK  ] Stopped Deferred execution scheduler.                                  
[FAILED] Failed to start Deferred execution scheduler.                          
See 'systemctl status atd.service' for details.                                 
[  OK  ] Reached target Multi-User System.                                      
[  OK  ] Started Remove Stale Onlin��…ext4 M                                    
[  OK  ] Reached target Graphical Interface.                                    
         Starting Update UTMP about System Runlevel Changes...                  
[  OK  ] Started Update UTMP about System Runlevel Changes.                     
                                                                                
Ubuntu 19.10 nanopi-m4 ttyS2                                                    
                                                                                
nanopi-m4 login: 

@avafinger
Copy link
Owner

ubuntu                                                                          
Password:                                                                       
Last login: Sun Jan  5 23:19:16 UTC 2020 from 192.168.254.253 on pts/0          
Welcome to Ubuntu 19.10 (GNU/Linux 5.4.8 aarch64)                               
                                                                                
 * Documentation:  https://help.ubuntu.com                                      
 * Management:     https://landscape.canonical.com                              
 * Support:ps://ubuntu.com/advantage                                            
                                                                                
 * Overheard at KubeCon: "microk8s.ands#microk8s.status                         
ubuntu@nanopi-m4:~$ 

@dmikushin
Copy link
Author

Executing script at 00500000

26055168 bytes read in 1648 ms (15.1 MiB/s)
1157052 bytes read in 78 ms (14.1 MiB/s)

Nice eMMC read speed! Which one is that? I can get only 9MB/sec out of mine.

@avafinger
Copy link
Owner

it's a 32 GB SD card (Sandisk Ultra) , 80 MB/s read. Vendor info. But many builds i think is wearing out too fast also.

@dmikushin
Copy link
Author

dmikushin commented Jan 7, 2020

I need to raise ethernet, yet I don't copy most of the kernel modules due to ramdisk economy. The boot log gives me:

[   10.169469] dhclient[235]: Error getting hardware address for "eth0": No such device

Am I missing some particular kernel module for ethernet support?

TTY login does not start as well, perhaps due to the missing modules as well:

[ TIME ] Timed out waiting for device /dev/ttyS2.
[   99.565630] systemd[1]: dev-ttyS2.device: Job dev-ttyS2.device/start timed out.
[DEPEND] Dependency failed for Serial Getty on ttyS2.
[   99.589139] systemd[1]: Timed out waiting for device /dev/ttyS2.
[   99.602220] systemd[1]: Dependency failed for Serial Getty on ttyS2.
[  OK  ] Reached target Login Prompts.
[   99.613096] systemd[1]: [email protected]: Job [email protected]/start failed with result 'dependency'.
[  OK  ] Reached target Multi-User System.
[   99.636980] systemd[1]: dev-ttyS2.device: Job dev-ttyS2.device/start failed with result 'timeout'.

Any clue here? Thanks a lot!

@dmikushin
Copy link
Author

I have of course dumped your active module set and brought their .ko files into the rootfs. But this does not help. What am I missing?

This is my log: https://gist.github.com/dmikushin/5d762745573361d0c923d6aacc904ecb

@avafinger
Copy link
Owner

Please, attach a complete boot log.

@dmikushin
Copy link
Author

@dmikushin
Copy link
Author

[ 6.930262] ttyS2 - failed to request DMA

@dmikushin
Copy link
Author

Two more tests:

  • I was able to launch it in Qemu. There, the network raises OK, but same issue with TTY.
  • Also I have a eMMC-to-sdcard adapter, so I tried to change boot_from_device to 1 and boot as from sdcard, but boot does not start (empty UART output).

@avafinger
Copy link
Owner

Some tips:

  • I see you have a different partition scheme, seems to be only one partition

  • You are using U-boot for BSP (Kernel 4.4), for mainline i use: U-Boot 2019.10-rc3-00141-g877294b-dirty (Sep 03 2019)
    They switch device ID value, so you may need to adjust boot.cmd in root=/dev/mmcblk0p2
    You need to change /etc/fstab accordingly, i think you are aware of that.

  • For the ttyS2
    Do you have something like this in your boot.cmd?
    setenv bootargs "console=ttyS2,115200 .....

@dmikushin
Copy link
Author

dmikushin commented Jan 7, 2020

If I add console=ttyS2,115200, then I don't see anything after Starting kernel ... in the UART output.

I am booting into the RAM, so there is only one boot/ partition alone, and the boot process should finish at the initrd state, so the root argument is effectively not in use.

@dmikushin
Copy link
Author

At this point, I'm quite certain the cause of the problem is that initrd cannot have kernel modules. Don't have an exact pointer, but appears to be it. Am going to test this.

@avafinger
Copy link
Owner

If I add console=ttyS2,115200, then I don't see anything after Starting kernel ... in the UART output.

I am booting into the RAM, so there is only one boot/ partition alone, and the boot process should finish at the initrd state, so the root argument is effectively not in use.

You should not add this to the boot.cmd!
I think you are rolling your own distro, your UART problem is a known issue and is related to the uart service in the distro, look for this service, if i recall correctly there is a missing symlink or symlink to wrong ttyS*

initrd cannot have kernel modules
Try to use Built-in modules instead of loadable modules

@dmikushin
Copy link
Author

Unfortunately, I cannot recompile from your release, because source code zip/tar.gz does not contain any source/patches. Do you wish to share them?

@dmikushin
Copy link
Author

I mean do you add anything special on top of https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.8.tar.gz ?

@dmikushin
Copy link
Author

So what I did now: I created a kernel defconfig based on your kernel config with all modules (=m) removed and all active modules in lsmod added back (=y). The resulting kernel is only 2M larger than original. It boots, yet with non-working UART - I will check this out, thanks for the pointer! And thanks for so kindly leading my way!!

@dmikushin
Copy link
Author

I think you are rolling your own distro, your UART problem is a known issue and is related to the uart service in the distro, look for this service, if i recall correctly there is a missing symlink or symlink to wrong ttyS*

@avafinger Are you talking about /etc/securetty? I'm trying to find what you've suggested, is it a systemctl service?

@dmikushin
Copy link
Author

I can only see that in stock FriendlyDesktop ttyS2 is named ttyFIQ0 instead. But this is not our case.

@dmikushin
Copy link
Author

Maybe you mean [email protected] ? But these files are identical for your and mine rootfs.

@avafinger
Copy link
Owner

Maybe you mean [email protected] ? But these files are identical for your and mine rootfs.

Yes.

and
ttyS0 = BT
ttyS2 = console

@avafinger
Copy link
Owner

Make sure you have:


&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_xfer &uart0_rts &uart0_cts>;
	status = "okay";

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		clocks = <&rk808 1>;
		clock-names = "lpo";
		device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
		max-speed = <4000000>;
		pinctrl-names = "default";
		pinctrl-0 = <&bt_reg_on_h &bt_host_wake_l &bt_wake_l>;
		vbat-supply = <&vcc3v3_sys>;
		vddio-supply = <&vcc_1v8>;
	};
};

&uart2 {
	status = "okay";
};

@dmikushin
Copy link
Author

Meanwhile, I've tested two xhci measures.

First, wrote a simple CPU core locker, which should bound application threads to individual cores. However, this does not affect the performance or makes it worse, depending on core indexes selection.

Second, I've installed cpufrequtils and enforced min/max bounds towards core maximums:

sudo apt-get install cpufrequtils
sudo cat /etc/default/cpufrequtils
GOVERNOR="performance"
MIN_SPEED="1500MHz"
MAX_SPEED="2000MHz"
sudo /etc/init.d/cpufrequtils restart
cpufreq-info

This also does not improve the performance, yet works in principle: if min/max bounds are lower, then xhci application is slower.

I will also look into how callback threads are waiting for sync. There is a chance that on ARM glib is using a timer with limited resolution, rounding delays towards higher values.

I'd highly appreciate any other ideas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants