# Lightweight VM BIG module
## 1.Install guide
---
- ITRI_Report_Aug_2019.pdf
## 2.Benchmark
---
### Cyclictest
- Evaluated the timer-interrupt latency
```
sudo apt-get install rt-tests
sudo cyclictest -p 90 -m -c 0 -i 200 -n -h 100 -q -l 100000
```
### PARSEC 3.0
```
wget http://parsec.cs.princeton.edu/download/3.0/parsec-3.0.tar.gz
tar -xzf parsec-3.0.tar.gz
cd parsec-3.0
source env.sh
```
- Build/run a benchmark (EX: Streamcluster)
```
parsecmgmt -a build -p streamcluster
parsecmgmt -a run -p streamcluster -i simlarge
```
# Test environment 1
```
Test machine:
CPU : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz (2 sockets, 24 cores)
Memory: 96G
```
```
Bare-Metal : 24 core pcpu
Bare-Metal(8 core): 8 core pcpu(isolcpus=8-23)
Vanilla : 8 core vcpu(-smp 8,cores=8,threads=1,sockets=1)
DID : 8 core vcpu(-smp 8,cores=8,threads=1,sockets=1)
```
| PARSEC |Bare-Metal | Bare-Metal(8 core) | Vanilla| DID |
| :------------|:----------|:-------------| :-----| :--|
| Facesim | 7.226 s | 8.326 s |7.724 s |10.288 s|
| Streamcluster| 5.723 s | 6.404 s |6.409 s |8.492 s |
| Canneal | 8.101 s | 7.608 s |9.191 s |8.916 s |
| Freqmine | 8.585 s | 8.611 s |8.711 s |13.832 s|
| Blackscholes | 4.241 s | 4.264 s |1.613 s |2.168 s |
| Fluidanimate | 3.037 s | 2.716 s |2.593 s |3.332 s |
| Ferret | 4.487 s | 4.429 s |4.455 s |7.352 s |
| Bodytrack | 3.729 s | 3.511 s |3.301 s |6.048 s |
# Test environment 2
```
Test machine:
CPU : Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
Memory: 132G
Disable Intel Hyper-Threading in BIOS
Load PARSEC 3.0 to tmpfs
```
```
Vanilla : 4 core vcpu(-smp 4,cores=4,threads=1,sockets=1)
DID : 4 core vcpu(-smp 4,cores=4,threads=1,sockets=1)
```
Parsec script(EX: Streamcluster)
```
parsecmgmt -a run -p streamcluster -i simlarge -n 4 >
/mnt/ramdisk/streamcluster.txt
```
| PARSEC | Vanilla(s)| DID(s) |
| :------------| :-----| :--|:--|
| Facesim |2.640 |13.286|
| Streamcluster|1.347 |3 m 42.9 |
| Canneal |3.713 |6.660 |
| Freqmine |2.060 |4.748 |
| Blackscholes |0.447 |0.800 |
| Fluidanimate |0.894 |2.028 |
| Ferret |1.461 |3.860 |
| Bodytrack |0.616 |3.184 |
#
Host grub
```
isolcpus=10-13 >>> isolcpus=1-4 (must be 1-4)
pin pcpu 1-4 to vcpu 0-3
```
Guest grub
```
nowatchdog rcupdate.rcu_cpu_stall_suppress=1
```
Timer interrupt (270000/s > 250/s)
```
wrmsr -p ${cpu} 0x838 0x616D
```
| PARSEC | Vanilla(s)| DID(s) |
| :------------| :-----| :--|:--|
| Facesim |2.288/4.486 |2.245/4.433 |
| Streamcluster|1.139/3.933 |1.279/3.961 |
| Canneal |3.437/4.918 |3.555/4.905 |
| Freqmine |1.968/5.017 |1.964/5.016 |
| Blackscholes |0.298/0.825 |0.296/0.823 |
| Fluidanimate |0.700/1.562 |0.691/1.496 |
| Ferret |1.330/2.582 |1.328/2.563 |
| Bodytrack |0.564/1.752 |0.545/1.745 |
lscpu without hyper-threading
```
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 28
On-line CPU(s) list: 0-27
Thread(s) per core: 1
Core(s) per socket: 14
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
Stepping: 1
CPU MHz: 1200.146
CPU max MHz: 3300.0000
CPU min MHz: 1200.0000
BogoMIPS: 4799.90
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 35840K
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
```
lscpu with hyper-threading
```
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 56
On-line CPU(s) list: 0-55
Thread(s) per core: 2
Core(s) per socket: 14
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
Stepping: 1
CPU MHz: 1365.087
CPU max MHz: 3300.0000
CPU min MHz: 1200.0000
BogoMIPS: 4799.89
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 35840K
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
```
# NEW
* Host kernel parameter add "intel_pstate=disable"
* Kernel configuration:Power management and ACPI options -> CPU Frequency scaling

* Cyclictest(Evaluated the timer-interrupt latency)
| Cyclictest(before) |Bare-Metal|Vanilla|DID|
| :------------- |:-------|:--------|:-------|
| min (us) | 1 | 8 | 3 |
| avg (us) | 1 | 13 | 6 |
| max (us) | 16 | 86 |340 |
| Cyclictest(after) |Bare-Metal|Vanilla|DID|
| :------------- |:-------|:--------|:-------|
| min (us) | 1 | 5 | 1 |
| avg (us) | 1 | 13 | 2 |
| max (us) | 16 | 72 |18 |
* PARSEC
Parsec script
```
packages=("facesim" "streamcluster" "canneal" "freqmine"
"blackscholes" "fluidanimate" "ferret" "bodytrack")
parsecmgmt -a run -i simlarge -n 4 -p ${packages[@]} >
/mnt/ramdisk/output.txt
```
```
Configuration A: we spread the four VCPUs on two NUMA nodes.
vapicid = per_cpu(x86_cpu_to_apicid, vcpu_id + 1);
- VCPU(0) -> PCPU(1) on NUMA 1.
- VCPU(1) -> PCPU(2) on NUMA 0.
- VCPU(2) -> PCPU(3) on NUMA 1.
- VCPU(3) -> PCPU(4) on NUMA 0.
```
| PARSEC(before) | Vanilla(s)| DID(s) |
| :------------| :-----| :--|:--|
| Facesim |2.288/4.486 |2.245/4.433 |
| Streamcluster|1.139/3.933 |1.279/3.961 |
| Canneal |3.437/4.918 |3.555/4.905 |
| Freqmine |1.968/5.017 |1.964/5.016 |
| Blackscholes |0.298/0.825 |0.296/0.823 |
| Fluidanimate |0.700/1.562 |0.691/1.496 |
| Ferret |1.330/2.582 |1.328/2.563 |
| Bodytrack |0.564/1.752 |0.545/1.745 |
| PARSEC(after) | Vanilla(s)| DID(s) |
| :------------| :-----| :--|:--|
| Facesim |0.92288/2.20742 |0.93078/2.24042|
| Streamcluster|1.14474/1.14474 |1.25302/1.25302 |
| Canneal |0.48874/2.93771 |0.49069/2.95693 |
| Freqmine |1.97101/1.97338 |1.96923/1.97154|
| Blackscholes |0.18814/0.29578 |0.18779/0.29481 |
| Fluidanimate |0.39259/0.72356 |0.38893/0.71914 |
| Ferret |1.25634/1.31542 |1.25007/1.30969 |
| Bodytrack |0.51007/0.55379 |0.50149/0.54605 |
```
Configuration B: we pinned all four VCPUs on the same node.
vapicid = per_cpu(x86_cpu_to_apicid, vcpu_id * 2 + 2);
- VCPU(0) -> PCPU(2) on NUMA 0.
- VCPU(1) -> PCPU(4) on NUMA 0.
- VCPU(2) -> PCPU(6) on NUMA 0.
- VCPU(3) -> PCPU(8) on NUMA 0.
```
| PARSEC | Vanilla(s)| DID(s) |
| :------------| :-----| :--|:--|
| Facesim |0.92700/2.22796 |0.91826/2.30164|
| Streamcluster|1.18780/1.18781 |1.14147/1.14147 |
| Canneal |0.41354/2.87128 |0.41326/2.93627 |
| Freqmine |1.76949/1.77205 |1.81309/1.81567|
| Blackscholes |0.20529/0.31419 |0.20327/0.91950 |
| Fluidanimate |0.39409/0.68947 |0.39954/0.70379 |
| Ferret |1.37627/1.43030 |1.35338/1.40939 |
| Bodytrack |0.51396/0.55712 |0.51510/0.56001 |