Commit c83f9378 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 21173cd0
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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
========
+0 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ fi

# set up huge pages
timing_enter afterboot
./scripts/configure_hugepages.sh 1024
./scripts/setup.sh
timing_exit afterboot

scripts/configure_hugepages.sh

deleted100755 → 0
+0 −32
Original line number Diff line number Diff line
#!/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
+13 −0
Original line number Diff line number Diff line
@@ -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"