scripts: merge hugepage config into setup.sh

For now, drop the option to configure the number of hugepages (just use
the default 1024).

Change-Id: I686b6151e4a32ffa4ae9a9cf2694693369e03f49
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-04-14 13:22:11 -07:00
parent 21173cd036
commit c83f9378da
4 changed files with 16 additions and 37 deletions

View File

@ -87,11 +87,10 @@ Hugepages and Device Binding
Before running an SPDK application, some hugepages must be allocated and
any NVMe and I/OAT devices must be unbound from the native kernel drivers.
SPDK includes scripts to automate this process on both Linux and FreeBSD.
Both of these scripts should be run as root.
SPDK includes a script to automate this process on both Linux and FreeBSD.
This script should be run as root.
1) scripts/configure_hugepages.sh
2) scripts/setup.sh
sudo scripts/setup.sh
Examples
========

View File

@ -35,7 +35,6 @@ fi
# set up huge pages
timing_enter afterboot
./scripts/configure_hugepages.sh 1024
./scripts/setup.sh
timing_exit afterboot

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -e
function configure_linux {
if mount | grep -qv hugetlbfs; then
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
fi
echo $NRHUGE > /proc/sys/vm/nr_hugepages
}
function configure_freebsd {
kldunload contigmem.ko || true
kenv hw.contigmem.num_buffers=$((NRHUGE * 2 / 32))
kenv hw.contigmem.buffer_size=$((32 * 1024 * 1024))
kldload contigmem.ko
}
if [ "$1" = "" ]; then
NRHUGE=1024
else
NRHUGE="$1"
fi
if [ `uname` = Linux ]; then
configure_linux
else
configure_freebsd
fi

View File

@ -63,6 +63,12 @@ function configure_linux {
rm $TMP
echo "1" > "/sys/bus/pci/rescan"
if ! mount | grep -q hugetlbs; then
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
fi
echo "$NRHUGE" > /proc/sys/vm/nr_hugepages
}
function reset_linux {
@ -101,6 +107,11 @@ function configure_freebsd {
kenv hw.nic_uio.bdfs=$BDFS
kldload nic_uio.ko
rm $TMP
kldunload contigmem.ko || true
kenv hw.contigmem.num_buffers=$((NRHUGE * 2 / 32))
kenv hw.contigmem.buffer_size=$((32 * 1024 * 1024))
kldload contigmem.ko
}
function reset_freebsd {
@ -108,6 +119,8 @@ function reset_freebsd {
kldunload nic_uio.ko || true
}
NRHUGE=1024
mode=$1
if [ "$mode" == "" ]; then
mode="config"