4 4
MX_Master

Has anybody a good latency after the RT-PREEMPT patch?

Recommended Posts

Has anybody a good latency after the RT-PREEMPT patch?

 

I'm using Orange Pi One (H3), Ubuntu Desktop and legacy 3.4.113 kernel patched with 30-real-time143-full-plus-rt-fixes.patch.

Also I have the isolcpus=3 enabled. And latency test results for this config is

master@orangepione:~/rt-tests$ sudo ./cyclictest -a -t -n -p99
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 2.18 2.49 1.19 1/299 3693           

T: 0 ( 3034) P:99 I:1000 C: 364441 Min:      7 Act:   31 Avg:   23 Max:    3655
T: 1 ( 3035) P:99 I:1500 C: 242985 Min:      7 Act:   32 Avg:   23 Max:    3578
T: 2 ( 3036) P:99 I:2000 C: 182252 Min:      7 Act:   43 Avg:   20 Max:    2198
T: 3 ( 3037) P:99 I:2500 C: 145802 Min:      9 Act:   30 Avg:   23 Max:     195

Max latency is about 3500 us. It's a bad result.

So I tried this test with same config but without RT patched kernel. And results are

master@orangepione:~/rt-tests$ sudo ./cyclictest -a -t -n -p99
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 2.32 2.57 1.45 3/270 3437           

T: 0 ( 3034) P:99 I:1000 C: 561884 Min:      7 Act:   31 Avg:   23 Max:    3716
T: 1 ( 3035) P:99 I:1500 C: 374713 Min:      7 Act:   32 Avg:   23 Max:    3966
T: 2 ( 3036) P:99 I:2000 C: 281162 Min:      7 Act:   43 Avg:   20 Max:    2247
T: 3 ( 3037) P:99 I:2500 C:  26364 Min:      9 Act:   30 Avg:   23 Max:      97

Max latency is almost the same. Any ideas?

If somebody using the RT kernel, please, show your latency results here.

Thanks.

Share this post


Link to post
Share on other sites

Hi. MitchD. Thanks for the fast reply.

 

I see you got 42 us with cmd cyclictest -p 80 -t5 -n. With same cmd my results is about 250 us.

master@orangepione:~/rt-tests$ sudo ./cyclictest -p 80 -t4 -n
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 2.46 1.56 0.66 1/293 4110           

T: 0 ( 3498) P:80 I:500 C: 335436 Min:      8 Act:   27 Avg:   24 Max:     235
T: 1 ( 3499) P:80 I:1000 C: 167700 Min:      7 Act:   32 Avg:   27 Max:     158
T: 2 ( 3500) P:80 I:1500 C: 111787 Min:      8 Act:   27 Avg:   24 Max:     128
T: 3 ( 3501) P:80 I:2000 C:  83830 Min:      7 Act:   32 Avg:   25 Max:     150

But when I use the -a parameter ( cyclictest -p 80 -t5 -n -a ) the latency becomes really wild.

Can you test your config with this cmd?

cyclictest -p 80 -t5 -n -a

 

Share this post


Link to post
Share on other sites

Sure thing! Here are my results:

# cyclictest -p 80 -t5 -n -a
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.12 0.17 0.08 1/93 193          
T: 0 (  186) P:80 I:1000 C: 551057 Min:      5 Act:    8 Avg:    8 Max:      29
T: 1 (  187) P:80 I:1500 C: 367371 Min:      5 Act:    8 Avg:    7 Max:      44
T: 2 (  188) P:80 I:2000 C: 275529 Min:      7 Act:    8 Avg:    7 Max:      13
T: 3 (  189) P:80 I:2500 C: 220423 Min:      7 Act:    8 Avg:    7 Max:      11
T: 4 (  190) P:80 I:3000 C: 183685 Min:      5 Act:    8 Avg:    7 Max:      24

I have isolcpus=2,3 running, and I'm running a mainline 4.11 kernel with the rt patch, as well as an ethernet patch and usb otg patch. It is also a buildroot environment, so I'm not sure how much that is skewing these results in my favor. 

# uname -a
Linux nanopi-neo 4.11.9-rt7 #1 SMP PREEMPT RT Fri Sep 22 10:38:22 CDT 2017 armv7l GNU/Linux


 

Share this post


Link to post
Share on other sites

Thanks, MitchD!

 

3 hours ago, MitchD said:

I have isolcpus=2,3 running, and I'm running a mainline 4.11 kernel with the rt patch, as well as an ethernet patch and usb otg patch. It is also a buildroot environment, so I'm not sure how much that is skewing these results in my favor. 

 

Your results are very good! I'll try to learn more about your environment.

 

By the way, I found the new RT patch for the mainline kernel 4.13. I build a fresh desktop Ubuntu Xenial image with this RT patch. Setup the isolcpus=3. And my new latency results are

master@orangepione:~/rt-tests$ sudo ./cyclictest -a -t -n -p80    
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 4.81 2.25 1.02 6/382 3797           

T: 0 ( 3376) P:80 I:1000 C: 237748 Min:      5 Act:   30 Avg:   15 Max:     136
T: 1 ( 3377) P:80 I:1500 C: 158502 Min:      5 Act:   17 Avg:   16 Max:     103
T: 2 ( 3378) P:80 I:2000 C: 118876 Min:      5 Act:   44 Avg:   18 Max:     113
T: 3 ( 3379) P:80 I:2500 C:  95101 Min:      6 Act:   17 Avg:   13 Max:      98

It's much better!

Share this post


Link to post
Share on other sites

Cool, I didn't know RT patches for 4.13 were out already! Thats great news, I should bump up my version. Are you building your kernel using the armbian toolset or your own?

 

Another point is that mine is specifically for the nanopi neo, which doesn't involve any HDMI setup or clocking. I'm not sure if that affects the results of cyclictest, but it might, as the HDMI subsystem must involve interrupts to the kernel. Armbian also ships with irqutils, which balances the irqs over the 4 cores (or 3, as you have one isolated). I have no idea if that matters either. 

 

I'm using my stuff for audio, and having the full RT kernel helps with audio dropouts on my USB device. Using alsa (no jack) I can get it down to ~10ms round trip. Without RT it was more like ~30ms. I've found the best test of any RT system is how it responds with your application.

Share this post


Link to post
Share on other sites
5 minutes ago, MitchD said:

Are you building your kernel using the armbian toolset or your own?

 

I'm using the armbian toolset without any kernel tweaks. Just RT patch, option 5. Without any PREEMPT debug.

I think it's time to make some tweaks to the kernel.. :)

Share this post


Link to post
Share on other sites

Hey @MX_Master, reporting in with some more numbers with the 4.13 RT stuff. 

 

# uname -a
Linux nanopi-neo 4.13.11-rt3 #2 SMP PREEMPT RT Thu Nov 30 11:17:18 CST 2017 armv7l GNU/Linux

# cyclictest -a -t -n -p80 
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.11 0.10 0.03 1/94 920          

T: 0 (  915) P:80 I:1000 C: 238476 Min:      6 Act:    9 Avg:    9 Max:      38
T: 1 (  916) P:80 I:1500 C: 158983 Min:      5 Act:    9 Avg:    9 Max:      27
T: 2 (  917) P:80 I:2000 C: 119238 Min:      8 Act:    9 Avg:    8 Max:      17
T: 3 (  918) P:80 I:2500 C:  95390 Min:      7 Act:    9 Avg:    9 Max:      16

 

Share this post


Link to post
Share on other sites

Im running Armbian Debian Stretch mainline  with 4.14.3-rt4 on a NanoPi Neo Plus2 ( Allwinner H5 ).

The patch applied just fine and performance is good.

 

T: 0 ( 1634) P:99 I:1000 C:1810076 Min:      6 Act:    9 Avg:    8 Max:      32
T: 1 ( 1635) P:99 I:1500 C:1206709 Min:      6 Act:    7 Avg:    8 Max:      44
T: 2 ( 1636) P:99 I:2000 C: 905025 Min:      6 Act:    7 Avg:    8 Max:      37
T: 3 ( 1637) P:99 I:2500 C: 724014 Min:      7 Act:    7 Avg:    7 Max:      31
T: 4 ( 1638) P:99 I:3000 C: 603343 Min:      7 Act:    7 Avg:    8 Max:      42

 

uname -a:

Linux nanopineoplus2 4.14.3-rt4-sunxi64 #8 SMP PREEMPT RT Sat Dec 2 22:08:45 CET 2017 aarch64 GNU/Linux

 

 

Latest Armbian =  :beer::beer:

Share this post


Link to post
Share on other sites

Can someone please tell me if I need a latency patch?

 

Here are my results:

 

root@nanopineo:/home/nanopi/rt-tests# sudo ./cyclictest -a -t -n -p80
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.73 0.63 0.42 1/98 8763

T: 0 ( 8735) P:80 I:1000 C: 101511 Min:     10 Act:   61 Avg:   65 Max:    2279
T: 1 ( 8736) P:80 I:1500 C:  67687 Min:     11 Act:   50 Avg:   62 Max:     252
T: 2 ( 8737) P:80 I:2000 C:  50765 Min:     11 Act:   49 Avg:   59 Max:     248
T: 3 ( 8738) P:80 I:2500 C:  40612 Min:     12 Act:   62 Avg:   61 Max:     312

and here's my current kernel:

 

root@nanopineo:/home/nanopi/rt-tests# uname -a
Linux nanopineo 3.4.113-sun8i #4 SMP PREEMPT Wed Nov 22 13:45:28 CET 2017 armv7l GNU/Linux

Thanks

Share this post


Link to post
Share on other sites
On 12/7/2017 at 8:18 PM, MitchD said:

Great job! What CNC software are you running, and which CNC are you using? It looks nice and compact. Love that little PSU. 

I'm using Machinekit with my GPIO driver. I have a big CNC machine (4 axes).

 

On 12/10/2017 at 8:53 AM, mockingbird said:

Can someone please tell me if I need a latency patch?

yep. 2279 microseconds is bad result

Share this post


Link to post
Share on other sites

Anyone knows which is the right RT path for mainline 4.14.y kernel? I am trying to patch it for orangepizero (sunxi-next patches folder) but both, patch-4.13.10-rt3.patch included one and patch-4.14.12-rt10.patch downloaded fail.

 

Regards

Share this post


Link to post
Share on other sites

Hello,

 

enabled patch for OrangePi Zero H2+ 512 with build environment Armbian 5.41 on Ubuntu 16.04.3 LTS for build Xenial 3.4.113 with rt143.

Following results:

dev@orangepizero:~/rt-tests-1.0$ uname -a
Linux orangepizero 3.4.113-rt143-sun8i #2 SMP PREEMPT RT Thu Feb 22 17:25:21 EET 2018 armv7l armv7l armv7l GNU/Linux
dev@orangepizero:~/rt-tests-1.0$ sudo ./cyclictest -p 80 -t5 -n
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.47 0.41 0.70 2/138 20170

T: 0 ( 2844) P:80 I:1000 C:3969645 Min:      8 Act:   62 Avg:   54 Max:    2062
T: 1 ( 2845) P:80 I:1500 C:2646431 Min:      8 Act:   90 Avg:   56 Max:     571^C
T: 2 ( 2846) P:80 I:2000 C:1984823 Min:      8 Act:   52 Avg:   55 Max:     346
T: 3 ( 2847) P:80 I:2500 C:1587859 Min:      8 Act:   91 Avg:   55 Max:     341
T: 4 ( 2848) P:80 I:3000 C:1323215 Min:      8 Act:   64 Avg:   55 Max:     297

Following interrupts are reported

dev@orangepizero:~$ cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3
 10:        564        440        442        277  sunxi_gpio_irq_chip  xradio_irq
 29:    3727320    3647150    3611500    1844956       GIC  arch_timer
 30:          0          0          0          0       GIC  arch_timer
 32:        446          0          0          0       GIC  uart0
 38:         24          0          0          0       GIC  twi0
 39:         18          0          0          0       GIC  twi1
 43:          0          0          0          0       GIC  PA
 49:       1723          0          0          0       GIC  PG
 50:          0          0          0          0       GIC  sunxi_timer0
 63:          0          0          0          0       GIC  Thermal
 72:          0          0          0          0       GIC  sunxi-rtc alarm
 77:          0          0          0          0       GIC  PL
 81:          0          0          0          0       GIC  arisc_hwmsgbox_irq
 82:          0          0          0          0       GIC  sunxi_dmac
 90:          0          0          0          0       GIC  cedar_dev
 92:      63924          0          0          0       GIC  sunxi-mmc
 93:     126255          0          0          0       GIC  sunxi-mmc
 97:          0          0          0          0       GIC  spi0
 98:          0          0          0          0       GIC  spi1
103:        353          0          0          0       GIC  sunxi_usb_udc
104:          0          0          0          0       GIC  ehci_hcd:usb1
105:          0          0          0          0       GIC  ohci_hcd:usb5
106:          0          0          0          0       GIC  ehci_hcd:usb2
107:          0          0          0          0       GIC  ohci_hcd:usb6
108:          0          0          0          0       GIC  ehci_hcd:usb3
109:          0          0          0          0       GIC  ohci_hcd:usb7
110:          0          0          0          0       GIC  ehci_hcd:usb4
111:          0          0          0          0       GIC  ohci_hcd:usb8
114:    1459073          0          0          0       GIC  gmac0
119:     336585          0          0          0       GIC  dispaly
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:     376490    1088699     535403     326760  Rescheduling interrupts
IPI3:        111        112        111        106  Function call interrupts
IPI4:          2          1          3          0  Single function call interrupts
IPI5:          0          0          0          0  CPU stop interrupts
IPI6:          0          0          0          0  CPU backtrace
IPI7:          0          0          0          0  completion interrupts

Best regards!

Dani

Share this post


Link to post
Share on other sites
On 12/4/2017 at 6:02 PM, Erikk said:

Im running Armbian Debian Stretch mainline  with 4.14.3-rt4 on a NanoPi Neo Plus2 ( Allwinner H5 ).

The patch applied just fine and performance is good.

 

T: 0 ( 1634) P:99 I:1000 C:1810076 Min:      6 Act:    9 Avg:    8 Max:      32
T: 1 ( 1635) P:99 I:1500 C:1206709 Min:      6 Act:    7 Avg:    8 Max:      44
T: 2 ( 1636) P:99 I:2000 C: 905025 Min:      6 Act:    7 Avg:    8 Max:      37
T: 3 ( 1637) P:99 I:2500 C: 724014 Min:      7 Act:    7 Avg:    7 Max:      31
T: 4 ( 1638) P:99 I:3000 C: 603343 Min:      7 Act:    7 Avg:    8 Max:      42

 

uname -a:

Linux nanopineoplus2 4.14.3-rt4-sunxi64 #8 SMP PREEMPT RT Sat Dec 2 22:08:45 CET 2017 aarch64 GNU/Linux

 

 

Latest Armbian =  :beer::beer:

Hello, I am new in kernel related things. Could give me some clue/steps to get preemptive kernel running on a H5 board?

I'm trying to compile to Orange Pi prime, since its H5 like NanoPi Neo Plus2, the same approach should work.

Cheers from Brazil! Thanks in advance,

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
4 4