Public bug reported: I think I found a bug/regression with the ubuntu server 23.04 riscv64 Nezha/Sipeed kernels. Somehow, the CPU speed on my mangopi mq pro seems to have decreased by 2.7x compared to the 22.10 image.
The allwinner D1 should run at 1Ghz, and execute a single add per cycle. On 22.10 I was able to confirm that executing `1024*1024*1024` add instructions took roughly a second, but on 23.04 it took 2.7 seconds (both fresh installs, with the same code [1]). There were no resource hungry background processes running, when I checked top. I also binary patched the opensbi image afterward, to disable mcountinhibit for `rdcycle`, and confirmed that even the hardware cycle counter was slower than 1Ghz. [2] One second had 410398820 cycles instead of something closer to the expected 1073741824. On suggestion from the #ubuntu webchat, I also tested adding `mitigations=off` to the linux cmd options, but that didn't change anything. [1] // test.c #include <stdio.h> #include <time.h> int main(void) { for (int i = 0; i < 10; ++i) { clock_t beg = clock(); extern void foo(void); foo(); printf("%f\n", (clock() - beg) * 1.0/CLOCKS_PER_SEC); } } // test.S .text .global foo foo: li t0, (1024*1024*1024/(8*32)) 1: .rept 32 add a1, a1, a0 add a2, a2, a1 add a3, a3, a2 add a4, a4, a3 add a5, a5, a4 add a6, a6, a5 add a7, a7, a6 add a0, a0, a7 .endr addi t0, t0, -1 bnez t0, 1b ret $ gcc -Ofast -march=rv64gc test.* && ./a.out [2] https://github.com/camel-cdr/rvv-d1/#extra-enable-rdcycle ProblemType: Bug DistroRelease: Ubuntu 23.04 Package: linux-image-5.19.0-1009-allwinner 5.19.0-1009.9 ProcVersionSignature: User Name 5.19.0-1009.9-allwinner 5.19.17 Uname: Linux 5.19.0-1009-allwinner riscv64 ApportVersion: 2.26.1-0ubuntu2 Architecture: riscv64 CasperMD5CheckResult: unknown CloudArchitecture: riscv64 CloudBuildName: server CloudID: nocloud CloudName: unknown CloudPlatform: nocloud CloudSerial: 20230415.2 CloudSubPlatform: seed-dir (/var/lib/cloud/seed/nocloud-net) Date: Fri Jun 23 20:10:14 2023 ProcCpuinfoMinimal: processor : 0 hart : 0 isa : rv64imafdc mmu : sv39 uarch : thead,c906 ProcEnviron: LANG=C.UTF-8 PATH=(custom, no user) SHELL=/bin/bash TERM=st-256color XDG_RUNTIME_DIR=<set> SourcePackage: linux-allwinner UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: linux-allwinner (Ubuntu) Importance: Undecided Status: New ** Tags: apport-bug cloud-image lunar riscv64 -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-allwinner in Ubuntu. https://bugs.launchpad.net/bugs/2024935 Title: cpu 2.7x slower on ubuntu server 23.04 riscv64 Nezha/Sipeed images compared to 22.10 on mangopi mq-pro Status in linux-allwinner package in Ubuntu: New Bug description: I think I found a bug/regression with the ubuntu server 23.04 riscv64 Nezha/Sipeed kernels. Somehow, the CPU speed on my mangopi mq pro seems to have decreased by 2.7x compared to the 22.10 image. The allwinner D1 should run at 1Ghz, and execute a single add per cycle. On 22.10 I was able to confirm that executing `1024*1024*1024` add instructions took roughly a second, but on 23.04 it took 2.7 seconds (both fresh installs, with the same code [1]). There were no resource hungry background processes running, when I checked top. I also binary patched the opensbi image afterward, to disable mcountinhibit for `rdcycle`, and confirmed that even the hardware cycle counter was slower than 1Ghz. [2] One second had 410398820 cycles instead of something closer to the expected 1073741824. On suggestion from the #ubuntu webchat, I also tested adding `mitigations=off` to the linux cmd options, but that didn't change anything. [1] // test.c #include <stdio.h> #include <time.h> int main(void) { for (int i = 0; i < 10; ++i) { clock_t beg = clock(); extern void foo(void); foo(); printf("%f\n", (clock() - beg) * 1.0/CLOCKS_PER_SEC); } } // test.S .text .global foo foo: li t0, (1024*1024*1024/(8*32)) 1: .rept 32 add a1, a1, a0 add a2, a2, a1 add a3, a3, a2 add a4, a4, a3 add a5, a5, a4 add a6, a6, a5 add a7, a7, a6 add a0, a0, a7 .endr addi t0, t0, -1 bnez t0, 1b ret $ gcc -Ofast -march=rv64gc test.* && ./a.out [2] https://github.com/camel-cdr/rvv-d1/#extra-enable-rdcycle ProblemType: Bug DistroRelease: Ubuntu 23.04 Package: linux-image-5.19.0-1009-allwinner 5.19.0-1009.9 ProcVersionSignature: User Name 5.19.0-1009.9-allwinner 5.19.17 Uname: Linux 5.19.0-1009-allwinner riscv64 ApportVersion: 2.26.1-0ubuntu2 Architecture: riscv64 CasperMD5CheckResult: unknown CloudArchitecture: riscv64 CloudBuildName: server CloudID: nocloud CloudName: unknown CloudPlatform: nocloud CloudSerial: 20230415.2 CloudSubPlatform: seed-dir (/var/lib/cloud/seed/nocloud-net) Date: Fri Jun 23 20:10:14 2023 ProcCpuinfoMinimal: processor : 0 hart : 0 isa : rv64imafdc mmu : sv39 uarch : thead,c906 ProcEnviron: LANG=C.UTF-8 PATH=(custom, no user) SHELL=/bin/bash TERM=st-256color XDG_RUNTIME_DIR=<set> SourcePackage: linux-allwinner UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-allwinner/+bug/2024935/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp