tests: Use hugepages for test_vfio

Using hugepages with VFIO and virtiofs can improve the performance of
the test_vfio test.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
(cherry picked from commit 5c9828a34c)
This commit is contained in:
Rob Bradford 2020-02-13 14:32:24 +00:00
parent 27c1b40c83
commit 548ef43ca2
3 changed files with 9 additions and 3 deletions

View File

@ -173,6 +173,10 @@ sudo bash -c "echo 1 > /sys/kernel/mm/ksm/run"
time cargo test --no-run --features "integration_tests" -- --nocapture time cargo test --no-run --features "integration_tests" -- --nocapture
ls target/debug/deps/cloud_hypervisor-* | xargs -n 1 sudo setcap cap_net_admin+ep ls target/debug/deps/cloud_hypervisor-* | xargs -n 1 sudo setcap cap_net_admin+ep
# test_vfio relies on hugepages
echo 4096 | sudo tee /proc/sys/vm/nr_hugepages
sudo chmod a+rwX /dev/hugepages
sudo adduser $USER kvm sudo adduser $USER kvm
newgrp kvm << EOF newgrp kvm << EOF
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1

View File

@ -3830,7 +3830,7 @@ mod tests {
let mut child = Command::new("target/release/cloud-hypervisor") let mut child = Command::new("target/release/cloud-hypervisor")
.args(&["--cpus", "boot=4"]) .args(&["--cpus", "boot=4"])
.args(&["--memory", "size=1G,file=/dev/shm"]) .args(&["--memory", "size=1G,file=/dev/hugepages"])
.args(&["--kernel", kernel_path.to_str().unwrap()]) .args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&[ .args(&[
"--disk", "--disk",

View File

@ -63,5 +63,7 @@ write_files:
bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id" 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 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" bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id"
# 512M ram requires 256 pages
/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 --device path=/sys/bus/pci/devices/0000:00:05.0/ path=/sys/bus/pci/devices/0000:00:06.0/ 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/