Cloud Hypervisor Performance Metrics - AmpereComputing/ampere-lts-kernel---DEPRECATED GitHub Wiki

Current state:

All test case are passed after disable mshv.

Build failed with MSHV option

Reference document:performance-metrics

$ ./scripts/dev_cli.sh tests --metrics
Compiling hypervisor v0.1.0 (/cloud-hypervisor/hypervisor)
error[E0433]: failed to resolve: use of undeclared crate or module `mshv`
  --> hypervisor/src/lib.rs:77:8
   |
77 |     if mshv::MshvHypervisor::is_available()? {
   |        ^^^^ use of undeclared crate or module `mshv`

error[E0433]: failed to resolve: use of undeclared crate or module `mshv`
  --> hypervisor/src/lib.rs:78:16
   |
78 |         return mshv::MshvHypervisor::new();
   |                ^^^^ use of undeclared crate or module `mshv`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `hypervisor` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

It looks cloud hypervisor does not support mshv for arm64 (https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/release-notes.md#release-binary-supports-both-mshv-and-kvm).

Release Binary Supports Both MSHV and KVM
On x86-64 the binary included in releases supports both the KVM and MSHV hypervisor with runtime detection to identify the correct hypervisor to use.

So change scripts/run_metrics.sh to disable mshv in cloud hypervisor:

diff --git a/scripts/run_metrics.sh b/scripts/run_metrics.sh
index ea4aa990..ed7b4b39 100755
--- a/scripts/run_metrics.sh
+++ b/scripts/run_metrics.sh
@@ -92,7 +92,8 @@ if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then
     CFLAGS="-I /usr/include/${TEST_ARCH}-linux-musl/ -idirafter /usr/include/"
 fi

-cargo build --no-default-features --features "kvm,mshv" --all --release --target $BUILD_TARGET
+#cargo build --no-default-features --features "kvm,mshv" --all --release --target $BUILD_TARGET
+cargo build --no-default-features --features "kvm" --all --release --target $BUILD_TARGET

 # setup hugepages
 echo 6144 | sudo tee /proc/sys/vm/nr_hugepages

We can get metrics:

{
  "git_human_readable": "v28.0-231-g3df82337-dirty",
  "git_revision": "3df82337f1f3bc81f04d787fdd98c8c612b1099f",
  "git_commit_date": "Fri Jan 13 01:34:59 2023 +0000",
  "date": "Wed Jan 18 13:33:04 UTC 2023",
  "results": [
    {
      "name": "boot_time_ms",
      "mean": 295.95369999999997,
      "std_dev": 10.243182533275483,
      "max": 316.84599999999995,
      "min": 285.472
    },

... ...

It is interesting to note, linux kernel supports booting linux guest on MS hyper-v on ARM64 HW: https://lore.kernel.org/all/[email protected]/ . How to test MSHV on arm64?

All tests without mshv.

Erros and solution:

Test command of ./scripts/dev_cli.sh tests --metrics -- -- --report-file /tmp/metrics.json

The command calls:TEST_ARCH=aarch64 BUILD_TARGET=aarch64-unknown-linux-gnu target/aarch64-unknown-linux-gnu/release/performance-metrics

1.

thread '<unnamed>' panicked at 'assertion failed: `(left == right)`                                                                                                                                                
  left: `0`,                                                                                                                                                                                                       
 right: `2`: Expecting two matching lines for 'Debug I/O port: Kernel code'', performance-metrics/src/performance_tests.rs:176:9      

The meaning of this error is to find two sentences "Debug I/O port: Kernel code" in the output, but only one sentence.

The correct output is as follows:

==== Start cloud-hypervisor command-line ====

"target/aarch64-unknown-linux-gnu/release/cloud-hypervisor" "--cpus" "boot=1" "--memory" "size=1G" "--kernel" "/root/workloads/Image" "--cmdline" "root=/dev/vda1 console=hvc0 rw systemd.journald.forward_to_console=1" "--console" "off" "--disk" "path=/tmp/chlaarGk/osdisk.img" "--disk" "path=/tmp/chlaarGk/cloudinit"

==== End cloud-hypervisor command-line ====
cloud-hypervisor: 2.606113s: <vcpu0> WARN:devices/src/legacy/uart_pl011.rs:358 -- [Debug I/O port: Kernel code: 0x40] 2.2603196 seconds
cloud-hypervisor: 3.624890s: <vcpu0> WARN:devices/src/legacy/uart_pl011.rs:358 -- [Debug I/O port: Kernel code: 0x41] 3.3621974 seconds

I modify PerformanceTest::control::test_timeout in performance-metrics/src/main.rs from 2 to 5,the following cases passed boot_time_ms,boot_time_pmem_ms,boot_time_16_vcpus_ms,boot_time_16_vcpus_pmem_ms

2.

Test 'virtio_net_throughput_single_queue_rx_gbps' running .. (control: test_timeout = 10s, test_iterations = 5, num_queues = 2, queue_size = 256, rx = true, bandwidth = true, overrides: )
"target/aarch64-unknown-linux-gnu/release/cloud-hypervisor" "--cpus" "boot=2" "--memory" "size=4G" "--kernel" "/root/workloads/Image" "--cmdline" "root=/dev/vda1 console=hvc0 rw systemd.journald.forward_to_conso
le=1" "--disk" "path=/tmp/chT6TyJG/osdisk.img" "--disk" "path=/tmp/chT6TyJG/cloudinit" "--net" "tap=,mac=12:34:56:78:90:00,ip=172.19.0.1,mask=255.255.255.0,num_queues=2,queue_size=256"

 ==== Start 'wait_vm_boot' (FAILED) ====                                                                                                                                                                            
                                                                                                                                                                                                                   
duration ="120.102775817s, timeout = 120s"                                                                                                                                                                         
listen_addr="0.0.0.0:8000"                                                                                                                                                                                         
expected_guest_addr="172.19.0.2"                                                                                                                                                                                   
message=""                                                                                                                                                                                                         
error="EpollWaitTimeout"

Solution:

apt install iperf3
⚠️ **GitHub.com Fallback** ⚠️