mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-05 11:31:14 +00:00
e8e4f43d52
Using hugepages with VFIO and virtiofs can improve the performance of the test_vfio test. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
70 lines
2.1 KiB
Plaintext
70 lines
2.1 KiB
Plaintext
#cloud-config
|
|
users:
|
|
- name: cloud
|
|
passwd: $6$7125787751a8d18a$sHwGySomUA1PawiNFWVCKYQN.Ec.Wzz0JtPPL1MvzFrkwmop2dq7.4CYf03A5oemPQ4pOFCCrtCelvFBEle/K.
|
|
sudo:
|
|
- ALL=(ALL) NOPASSWD:ALL
|
|
write_files:
|
|
-
|
|
path: /etc/systemd/network/00-static-l1.network
|
|
permissions: 0644
|
|
content: |
|
|
[Match]
|
|
MACAddress=12:34:56:78:90:ab
|
|
|
|
[Network]
|
|
Address=192.168.2.2/24
|
|
Gateway=192.168.2.1
|
|
|
|
-
|
|
path: /etc/systemd/network/00-static-l2-1.network
|
|
permissions: 0644
|
|
content: |
|
|
[Match]
|
|
MACAddress=de:ad:be:ef:12:34
|
|
|
|
[Network]
|
|
Address=192.168.2.3/24
|
|
Gateway=192.168.2.1
|
|
|
|
-
|
|
path: /etc/systemd/network/00-static-l2-2.network
|
|
permissions: 0644
|
|
content: |
|
|
[Match]
|
|
MACAddress=de:ad:be:ef:34:56
|
|
|
|
[Network]
|
|
Address=192.168.2.4/24
|
|
Gateway=192.168.2.1
|
|
|
|
-
|
|
path: /etc/systemd/system/vfio.service
|
|
permissions: 0644
|
|
content: |
|
|
[Unit]
|
|
Description=VFIO test systemd service
|
|
|
|
[Service]
|
|
Type=simple
|
|
ExecStart=/bin/bash /usr/bin/cloud-hypervisor-vfio.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|
|
-
|
|
path: /usr/bin/cloud-hypervisor-vfio.sh
|
|
permissions: 0755
|
|
content: |
|
|
#!/bin/bash
|
|
|
|
mount -t virtiofs -o dax myfs /mnt
|
|
bash -c "echo 0000:00:05.0 > /sys/bus/pci/devices/0000\:00\:05.0/driver/unbind"
|
|
bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id"
|
|
bash -c "echo 0000:00:06.0 > /sys/bus/pci/devices/0000\:00\:06.0/driver/unbind"
|
|
bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id"
|
|
# 512M ram requires 256 pages
|
|
echo 256 | sudo tee /proc/sys/vm/nr_hugepages
|
|
sudo chmod a+rwX /dev/hugepages
|
|
/mnt/cloud-hypervisor --kernel /mnt/vmlinux --cmdline "console=hvc0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=/dev/vda2 VFIOTAG" --disk path=/mnt/clear-31310-cloudguest.img path=/mnt/cloudinit.img --cpus boot=1 --memory size=512M,file=/dev/hugepages --device path=/sys/bus/pci/devices/0000:00:05.0/ path=/sys/bus/pci/devices/0000:00:06.0/
|