summaryrefslogtreecommitdiffstats
path: root/ci/envs/host-setup1.sh
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@linux.intel.com>2015-12-04 14:47:31 -0500
committerYunhong Jiang <yunhong.jiang@linux.intel.com>2016-01-04 19:06:33 -0500
commitd792accb76bb16af0cbf0710a41491d21de75721 (patch)
tree778b29a710a635b76e1865d57f110c1ea13f553c /ci/envs/host-setup1.sh
parentb52baab237a0b45cb18b26f529e6490b42574209 (diff)
Add host environment setup scripts
Testing KVM4NFV project requires special host environment to get the best result. Two scrripts are used to setup the environment. The host-setup0.sh setup the environment that should take effect before the kernel is bringup, mostly the grub entries. The host-setup1.sh setup the environment that takes effect after the kernel is up, like some sysfs entry, interrupt affinity etc. The host-config provides the configurations. Change-Id: Ie933ea0089ac82acd39fc48088615215993312f3 Signed-off-by: David Su <david.w.su@intel.com> Signed-off-by: Yunhong Jiang <yunhong.jiang@linux.intel.com>
Diffstat (limited to 'ci/envs/host-setup1.sh')
-rwxr-xr-xci/envs/host-setup1.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/ci/envs/host-setup1.sh b/ci/envs/host-setup1.sh
new file mode 100755
index 000000000..3d2de6ddf
--- /dev/null
+++ b/ci/envs/host-setup1.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+##############################################################################
+## Copyright (c) 2015 Intel Corp.
+##
+## All rights reserved. This program and the accompanying materials
+## are made available under the terms of the Apache License, Version 2.0
+## which accompanies this distribution, and is available at
+## http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+source host-config
+
+
+##############################
+# Create 1GB pages for guest #
+##############################
+
+hugepage_size=`cat /proc/meminfo |grep Hugepagesize |tr -s " "| cut -f 2 -d " "`
+if [[ $hugepage_size -ne 1048576 ]]
+then
+ echo "Need 1G huge page support for performance benefit"
+ exit 1
+fi
+
+mkdir -p /mnt/hugetlbfs-1g
+mount -t hugetlbfs hugetlbfs /mnt/hugetlbfs-1g -osize=1G
+
+hugepage_dir="/sys/devices/system/node/node${numa_node}/hugepages/hugepages-1048576kB/nr_hugepages"
+
+huge_pages+=`cat $hugepage_dir`
+echo ${huge_pages} > ${hugepage_dir}
+
+############################
+# RT optimization #
+############################
+# Disable watchdogs to reduce overhead
+echo 0 > /proc/sys/kernel/watchdog
+echo 0 > /proc/sys/kernel/nmi_watchdog
+
+# Change RT priority of ksoftirqd and rcuc kernel threads on isolated CPUs
+i=0
+for c in `echo $host_isolcpus | sed 's/,/ /g'` ; do
+ tid=`pgrep -a ksoftirq | grep "ksoftirqd/${c}$" | cut -d ' ' -f 1`
+ chrt -fp 2 ${tid}
+
+ tid=`pgrep -a rcuc | grep "rcuc/${c}$" | cut -d ' ' -f 1`
+ chrt -fp 3 ${tid}
+
+ cpu[$i]=${c}
+ i=`expr $i + 1`
+done
+
+# Change RT priority of rcub kernel threads
+for tid in `pgrep -a rcub | cut -d ' ' -f 1` ; do
+ chrt -fp 3 ${tid}
+done
+
+# Disable RT throttling
+echo -1 > /proc/sys/kernel/sched_rt_period_us
+echo -1 > /proc/sys/kernel/sched_rt_runtime_us
+
+# Reroute interrupts bound to isolated CPUs to CPU 0
+for irq in /proc/irq/* ; do
+ if [ -d ${irq} ] && ! grep - ${irq}/smp_affinity_list > /dev/null ; then
+ al=`cat ${irq}/smp_affinity_list`
+ if [[ ${cpu[*]} =~ ${al} ]] ; then
+ echo 0 > ${irq}/smp_affinity_list
+ fi
+ fi
+done
+
+# Change the iptable so that we can ssh to the guest remotely
+iptables -I INPUT -p tcp --dport 5555 -j ACCEPT
+# TODO: download guest disk image from artifactory
+