From 3a06abc9d9fbc4790b545f7f1cce0c157f9ea9e2 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Mon, 6 Apr 2020 10:19:31 +0200 Subject: [PATCH] scripts/vagrant: enable hugepages backing for VM memory Change-Id: I66c1c965d9de8b4e9625c1f1850cbb28d11138ad Signed-off-by: Karol Latecki Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1684 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Maciej Wawryk --- scripts/vagrant/Vagrantfile | 4 ++++ scripts/vagrant/create_vbox.sh | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/vagrant/Vagrantfile b/scripts/vagrant/Vagrantfile index 48f6fee11..5aa1b1623 100644 --- a/scripts/vagrant/Vagrantfile +++ b/scripts/vagrant/Vagrantfile @@ -213,6 +213,10 @@ Vagrant.configure(2) do |config| libvirt.cpus = "#{vmcpu}" libvirt.video_type = "cirrus" + if ENV['VAGRANT_HUGE_MEM'] == "1" + libvirt.memorybacking :hugepages + end + # Optional field if we want use other storage pools than default # libvirt.storage_pool_name = "vm" end diff --git a/scripts/vagrant/create_vbox.sh b/scripts/vagrant/create_vbox.sh index 7252cf15f..6a007e2cd 100755 --- a/scripts/vagrant/create_vbox.sh +++ b/scripts/vagrant/create_vbox.sh @@ -33,6 +33,7 @@ display_help() { echo " Parameters for -b option: ,,." echo " Available types: nvme, ocssd." echo " -c Create all above disk, default 0" + echo " -H Use hugepages for allocating VM memory. Only for libvirt provider. Default: false." echo " -u Use password authentication to the VM instead of SSH keys." echo " -l Use a local copy of spdk, don't try to rsync from the host." echo " -a Copy spdk/autorun.sh artifacts from VM to host system." @@ -79,8 +80,9 @@ NVME_AUTO_CREATE=0 VAGRANTFILE_DIR="" VAGRANT_PASSWORD_AUTH=0 VAGRANT_PACKAGE_BOX=0 +VAGRANT_HUGE_MEM=0 -while getopts ":b:n:s:x:p:u:vcraldh-:" opt; do +while getopts ":b:n:s:x:p:u:vcraldHh-:" opt; do case "${opt}" in -) case "${OPTARG}" in @@ -132,6 +134,9 @@ while getopts ":b:n:s:x:p:u:vcraldh-:" opt; do u) VAGRANT_PASSWORD_AUTH=1 ;; + H) + VAGRANT_HUGE_MEM=1 + ;; *) echo " Invalid argument: -$OPTARG" >&2 echo " Try: \"$0 -h\"" >&2 @@ -239,6 +244,7 @@ export NVME_DISKS_TYPE export NVME_DISKS_NAMESPACES export NVME_FILE export VAGRANT_PASSWORD_AUTH +export VAGRANT_HUGE_MEM if [ -n "$SPDK_VAGRANT_PROVIDER" ]; then provider="--provider=${SPDK_VAGRANT_PROVIDER}" @@ -265,6 +271,7 @@ if [ ${DRY_RUN} = 1 ]; then printenv NVME_DISKS_NAMESPACES printenv NVME_FILE printenv SPDK_DIR + printenv VAGRANT_HUGE_MEM fi if [ -z "$VAGRANTFILE_DIR" ]; then VAGRANTFILE_DIR="${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}"