Skip to content

Commit 2e129ba

Browse files
authored
Merge pull request #2 from TUM-DSE/dev/measure3
- automate multi-host measurements - add Interface.VPP - add filter VNF to measurements - restructure unikraft builds a bit more
2 parents 054b0b0 + 7739ca5 commit 2e129ba

33 files changed

+2990
-1982
lines changed

.config.click_qemu-x86_64.known-working

+451
Large diffs are not rendered by default.

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
build/
33
nix/builds/
44
target
5-
.config
65
.unikraft
76
.config.click_qemu-x86_64
87
.config.click_qemu-x86_64.old
@@ -18,7 +17,7 @@ libs/libcxxabi/
1817
libs/libunwind/
1918
libs/musl/
2019
libs/openssl/
21-
libs/unikraft/
20+
libs/click-og/
2221

2322
VMs/
2423
out*/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "baseline/click"]
55
path = baseline/click
66
url = [email protected]:kohler/click.git
7+
[submodule "libs/unikraft"]
8+
path = libs/unikraft
9+
url = https://github.com/unikraft/unikraft.git

Makefile

+1-27
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,4 @@ build:
44
mkdir -p .unikraft/build/libclick/origin/click-a5384835a6cac10f8d44da4eeea8eaa8f8e6a0c2/elements/unikraft || true
55
cp -r libs/click/unikraft .unikraft/build/libclick/origin/click-a5384835a6cac10f8d44da4eeea8eaa8f8e6a0c2/elements
66

7-
kraft build --log-type basic
8-
downloadLibs:
9-
@nix develop .#unikraft --command bash -c 'sourceRoot=$$(pwd); eval "$$postUnpack"'
10-
11-
kill:
12-
sudo pkill -f "clicknet"
13-
sudo pkill -f "controlnet"
14-
15-
throughput.cpio: throughput.click
16-
rm -r /tmp/ukcpio-$(USER) || true
17-
mkdir -p /tmp/ukcpio-$(USER)
18-
cp ./throughput.click /tmp/ukcpio-$(USER)/config.click
19-
./libs/unikraft/support/scripts/mkcpio ./throughput.cpio /tmp/ukcpio-$(USER)
20-
21-
vm: throughput.cpio
22-
sudo taskset -c 3,4 qemu-system-x86_64 -accel kvm -cpu max -netdev bridge,id=en0,br=clicknet -device virtio-net-pci,netdev=en0 -append " vfs.fstab=[\"initrd0:/:extract::ramfs=1:\"] --" -kernel ./.unikraft/build/click_qemu-x86_64 -initrd ./throughput.cpio -nographic
23-
24-
perf-kvm-top:
25-
sudo perf kvm --guestkallsyms=./.unikraft/build/click_qemu-x86_64.sym --guestvmlinux=.unikraft/build/click_qemu-x86_64.dbg top -p $(pgrep qemu)
26-
27-
perf-kvm-record:
28-
sudo perf kvm --guestkallsyms=./.unikraft/build/click_qemu-x86_64.sym --guestvmlinux=.unikraft/build/click_qemu-x86_64.dbg record -g -p $(pgrep qemu)
29-
sudo perf kvm --guestkallsyms=./.unikraft/build/click_qemu-x86_64.sym --guestvmlinux=.unikraft/build/click_qemu-x86_64.dbg report
30-
31-
perf-qemu-record:
32-
sudo perf record -g -p $(pgrep qemu)
33-
sudo perf script > perf.trace
7+
kraft build --log-type basic $(EXTRA_KRAFT_ARGS)

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The project is structured as follows:
2929
1. Clone the repository with the `--recursive` flag to also clone the submodules
3030
2. Install the `nix` package manager
3131
3. Run `nix develop .#fhs` to enter the development environment with all system dependencies
32-
4. Run `make downloadLibs` to download unikraft libraries as pinned by `flake.*`
32+
4. Run `just downloadLibs` to download unikraft libraries as pinned by `flake.*`
3333

3434
### Building the Unikernel
3535

@@ -72,7 +72,11 @@ make sync
7272
You can run the benchmarks:
7373

7474
```
75-
python3 benchmark/pysrc/measure_throughput.py -c benchmark/conf/autotest_localhost.cfg -vvv
75+
# localhost doesn't support Interface.VPP (vhost-user):
76+
python3 benchmark/pysrc/measure_throughput.py -c benchmark/conf/uk_localhost.cfg -vvv
77+
78+
# multihost:
79+
python3 benchmark/pysrc/measure_throughput.py -c benchmark/conf/uk_adelaide_wilfred.cfg -vvv
7680
```
7781

7882
See `-h` for more benchmarking options. When run on other hosts than `adelaide`, the config file and `benchmark/conf/ssh_config_doctor_cluster` may need adjusting.

benchmark/conf/ssh_config_doctor_cluster

+34-54
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,71 @@
1-
Host vm.local
2-
Hostname 192.168.56.20
3-
User root
1+
Host *
42
StrictHostKeyChecking=no
5-
IdentityFile /home/okelmann/appclick-ubpf/nix/ssh_key
63
UserKnownHostsFile=/dev/null
74
IdentityAgent=/dev/null
85
StrictHostKeyChecking=no
96
LogLevel=ERROR
107

11-
Host guest.vmux.local
12-
Hostname 192.168.56.20
13-
User root
14-
StrictHostKeyChecking=no
15-
IdentityFile /scratch/okelmann/vmuxIO/nix/ssh_key
16-
UserKnownHostsFile=/dev/null
17-
IdentityAgent=/dev/null
18-
StrictHostKeyChecking=no
19-
LogLevel=ERROR
8+
9+
# hosts in the doctor-cluster that are accessible if python is run on christina
10+
11+
Host christina.christina
12+
Hostname christina.dos.cit.tum.de
13+
IdentityFile /root/.ssh/lawful_access
14+
15+
Host adelaide.christina
16+
Hostname adelaide.dos.cit.tum.de
17+
IdentityFile /root/.ssh/lawful_access
18+
19+
Host rose.christina
20+
Hostname rose.dos.cit.tum.de
21+
IdentityFile /root/.ssh/lawful_access
2022

2123
Host rose.christina
2224
Hostname rose.dos.cit.tum.de
2325
IdentityFile /root/.ssh/lawful_access
24-
StrictHostKeyChecking=no
25-
UserKnownHostsFile=/dev/null
26-
IdentityAgent=/dev/null
27-
StrictHostKeyChecking=no
28-
LogLevel=ERROR
2926

3027
Host wilfred.christina
3128
Hostname wilfred.dos.cit.tum.de
3229
IdentityFile /root/.ssh/lawful_access
33-
StrictHostKeyChecking=no
34-
UserKnownHostsFile=/dev/null
35-
IdentityAgent=/dev/null
36-
StrictHostKeyChecking=no
37-
LogLevel=ERROR
3830

3931
Host river.christina
4032
Hostname river.dos.cit.tum.de
4133
IdentityFile /root/.ssh/lawful_access
42-
StrictHostKeyChecking=no
43-
UserKnownHostsFile=/dev/null
44-
IdentityAgent=/dev/null
45-
LogLevel=ERROR
4634

4735
Host amy.christina
4836
Hostname amy.dos.cit.tum.de
4937
IdentityFile /root/.ssh/lawful_access
50-
StrictHostKeyChecking=no
51-
UserKnownHostsFile=/dev/null
52-
IdentityAgent=/dev/null
53-
LogLevel=ERROR
38+
39+
40+
# VMs
41+
42+
Host vm*
43+
IdentityFile /home/okelmann/appclick-ubpf/nix/ssh_key
44+
45+
Host vm.local
46+
Hostname 192.168.56.20
47+
User root
48+
49+
Host guest.vmux.local
50+
Hostname 192.168.56.20
51+
User root
52+
IdentityFile /home/okelmann/appclick-ubpf/nix/ssh_key
53+
54+
Host vm*.adelaide.christina
55+
ProxyJump adelaide.christina
56+
User root
5457

5558
Host vm*.rose.christina
5659
ProxyJump rose.christina
5760
User root
58-
StrictHostKeyChecking=no
59-
IdentityFile /scratch/okelmann/vmuxIO/nix/ssh_key
60-
UserKnownHostsFile=/dev/null
61-
IdentityAgent=/dev/null
62-
LogLevel=ERROR
6361

6462
Host vm*.amy.christina
6563
ProxyJump amy.christina
6664
User root
67-
StrictHostKeyChecking=no
68-
IdentityFile /scratch/okelmann/vmuxIO/nix/ssh_key
69-
UserKnownHostsFile=/dev/null
70-
IdentityAgent=/dev/null
71-
LogLevel=ERROR
7265

7366
Host vm.river.christina
7467
ProxyJump river.christina
7568
User root
76-
StrictHostKeyChecking=no
77-
IdentityFile /scratch/okelmann/vmuxIO/nix/ssh_key
78-
UserKnownHostsFile=/dev/null
79-
IdentityAgent=/dev/null
80-
LogLevel=ERROR
81-
82-
Host christina.christina
83-
Hostname christina.dos.cit.tum.de
84-
IdentityFile /root/.ssh/lawful_access
85-
StrictHostKeyChecking=no
86-
UserKnownHostsFile=/dev/null
87-
IdentityAgent=/dev/null
88-
LogLevel=ERROR
8969

9070

9171
# generate vm*.* hosts with:
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[common]
2+
tmux_socket=vmux-${username}.tmux.sock
3+
4+
[local]
5+
moonprogs_dir = ${projectDirectory}/test/moonprogs/
6+
7+
[host]
8+
fqdn=${username}@adelaide.christina
9+
admin_bridge=bra-${username}0
10+
admin_bridge_ip_net=192.168.56.1/21
11+
admin_tap=tapa-${username}0
12+
test_iface=eno1
13+
test_iface_addr=0000:01:00.0
14+
test_iface_mac=3c:ec:ef:62:ad:f2
15+
test_iface_driv=ixgbe
16+
test_iface_dpdk_driv=vfio-pci
17+
test_iface_vfio_driv=vfio-pci
18+
test_bridge=br-${username}
19+
test_bridge_ip_net=10.1.0.1/21
20+
test_tap=tap-${username}
21+
test_macvtap=mvtap-${username}1
22+
vmux_socket_path=/tmp/vpp-${username}.sock
23+
tmux_socket=${common:tmux_socket}
24+
moongen_dir=${projectDirectory}/mgln/
25+
project_root=${projectDirectory}
26+
xdp_reflector_dir=${projectDirectory}/xdp/lib/
27+
qemu_path=${projectDirectory}/nix/builds/qemu/bin
28+
vmux_qemu_path=
29+
root_disk_file=${projectDirectory}/VMs/guest-image.qcow2
30+
fsdevs=home:${projectDirectoryParent},nixstore:/nix/store
31+
ssh_config=${projectDirectory}/benchmark/conf/ssh_config_doctor_cluster
32+
ssh_as_root=True
33+
vmux_path=${projectDirectory}/build_release/vmux
34+
35+
[guest]
36+
fqdn=vm.adelaide.christina
37+
vcpus=1
38+
memory=8192
39+
admin_iface_mac=52:54:00:ea:00:0f
40+
test_iface=ens7
41+
test_iface_addr=0000:00:07.0
42+
test_iface_mac=52:54:00:fa:00:60
43+
test_iface_ip_net=10.1.0.20/21
44+
test_iface_driv=virtio-pci
45+
test_iface_dpdk_driv=igb_uio
46+
tmux_socket=${common:tmux_socket}
47+
moongen_dir=/root/${projectDirectoryName}/mgln/
48+
project_root=/root/${projectDirectoryName}
49+
xdp_reflector_dir=/root/${projectDirectoryName}/xdp/lib/
50+
ssh_config=/root/${projectDirectoryName}/benchmark/conf/ssh_config_doctor_cluster
51+
52+
[loadgen] # is christina
53+
fqdn=localhost
54+
test_iface=eno2
55+
test_iface_addr=0000:01:00.1
56+
test_iface_mac=3c:ec:ef:62:ad:7d
57+
test_iface_ip_net=10.1.0.2/21
58+
test_iface_driv=ixgbe
59+
test_iface_dpdk_driv=vfio-pci
60+
tmux_socket=${common:tmux_socket}
61+
moongen_dir=${projectDirectory}/mgln/
62+
project_root=${projectDirectory}
63+
ssh_config=${projectDirectory}/benchmark/conf/ssh_config_doctor_cluster

benchmark/conf/autotest_localhost.cfg benchmark/conf/uk_localhost.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tmux_socket=${common:tmux_socket}
2424
moongen_dir=${projectDirectory}/mgln/
2525
project_root=${projectDirectory}
2626
xdp_reflector_dir=${projectDirectory}/xdp/lib/
27-
qemu_path=
27+
qemu_path=${projectDirectory}/nix/builds/qemu/bin
2828
vmux_qemu_path=
2929
root_disk_file=${projectDirectory}/VMs/guest-image.qcow2
3030
fsdevs=home:${projectDirectoryParent},nixstore:/nix/store
@@ -51,7 +51,7 @@ ssh_config=/root/${projectDirectoryName}/benchmark/conf/ssh_config_doctor_cluste
5151

5252
[loadgen]
5353
fqdn=localhost
54-
test_iface=enp24s0f1
54+
test_iface=tap-${username}
5555
test_iface_addr=0000:18:00.1
5656
test_iface_mac=B4:96:91:B3:8B:04
5757
test_iface_ip_net=10.1.0.2/21

benchmark/pysrc/enums.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import netaddr
33
from pathlib import Path
44
import ipaddress
5+
import getpass
6+
7+
USERNAME: str = getpass.getuser()
58

69
class Machine(Enum):
710
# Machine types
@@ -41,6 +44,9 @@ class Interface(Enum):
4144
# VFIO-passthrough to physical NIC for the VM
4245
VFIO = "vfio"
4346

47+
# vhost-user device backed by VPP software router
48+
VPP = "vpp"
49+
4450
# VMux-passthrough to physical NIC for the VM
4551
VMUX_PT = "vmux-pt"
4652

@@ -66,12 +72,18 @@ def needs_br_tap(self) -> bool:
6672
def needs_macvtap(self) -> bool:
6773
return self in [ Interface.MACVTAP ]
6874

69-
def needs_vfio(self) -> bool:
70-
return self in [ Interface.VFIO, Interface.VMUX_PT, Interface.VMUX_DPDK, Interface.VMUX_DPDK_E810, Interface.VMUX_MED ]
75+
def needs_vfio(self) -> bool: # vfio on the host
76+
return self in [ Interface.VFIO, Interface.VMUX_PT, Interface.VMUX_DPDK, Interface.VMUX_DPDK_E810, Interface.VMUX_MED, Interface.VPP ]
7177

7278
def needs_vmux(self) -> bool:
7379
return self in [ Interface.VMUX_PT, Interface.VMUX_EMU, Interface.VMUX_DPDK, Interface.VMUX_EMU_E810, Interface.VMUX_MED, Interface.VMUX_DPDK_E810 ]
7480

81+
def needs_vpp(self) -> bool:
82+
return self in [ Interface.VPP ]
83+
84+
def is_vhost_user(self) -> bool:
85+
return self in [ Interface.VPP ]
86+
7587
def is_passthrough(self) -> bool:
7688
return self in [ Interface.VFIO, Interface.VMUX_PT ]
7789

@@ -83,7 +95,7 @@ def guest_driver(self) -> str:
8395
return "ice"
8496
if self in [ Interface.BRIDGE_E1000, Interface.VMUX_EMU, Interface.VMUX_DPDK ]:
8597
return "e1000"
86-
if self in [ Interface.BRIDGE, Interface.BRIDGE_VHOST, Interface.MACVTAP ]:
98+
if self in [ Interface.BRIDGE, Interface.BRIDGE_VHOST, Interface.MACVTAP, Interface.VPP ]:
8799
return "virtio-net"
88100
raise Exception(f"Dont know which guest driver is used with {self}")
89101

@@ -172,6 +184,9 @@ def iface_name(tap_name: str, vm_number: int):
172184
if vm_number == -1: return f"{tap_name[:length]}-"
173185
return f"{tap_name[:length]}-{vm_number}"
174186

187+
@staticmethod
188+
def vhost_user_sock(vm_number: int):
189+
return f"/tmp/vhost-user-{USERNAME}.{vm_number}"
175190

176191
@staticmethod
177192
def enumerate(enumeratable: str, vm_number: int) -> str:

0 commit comments

Comments
 (0)