From d792accb76bb16af0cbf0710a41491d21de75721 Mon Sep 17 00:00:00 2001 From: Yunhong Jiang Date: Fri, 4 Dec 2015 14:47:31 -0500 Subject: 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 Signed-off-by: Yunhong Jiang --- ci/envs/host-setup0.sh | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 ci/envs/host-setup0.sh (limited to 'ci/envs/host-setup0.sh') diff --git a/ci/envs/host-setup0.sh b/ci/envs/host-setup0.sh new file mode 100755 index 000000000..eeb91c19d --- /dev/null +++ b/ci/envs/host-setup0.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 + +rpmdir=${1:-"/root/workspace/rpm/"} +rpmpat="kernel-4.1*.rpm" + +config_grub () { + key=$1 + val=$2 + + if grep '[" ]'${key} /etc/default/grub > /dev/null ; then + sed -i 's/\([" ]\)'${key}'=[^ "]*/\1'${key}'='${val}'/' /etc/default/grub + else + sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="\1 '${key}'='${val}'"/' /etc/default/grub + fi +} + +# The script's caller should passing the rpm directory that is built out from +# build.sh. The default rpmdir is the one used by yardstick scripts. +install_kernel () { + # Install the kernel rpm + filenum=`ls -l ${rpmdir}/${rpmpat} |wc -l` + if [ $filenum -eq 0 ] + then + echo "No kernel rpm found in workspace/rpm" + exit 1 + elif [ $filenum -gt 1 ] + then + echo "Multiple kernel rpm found in workspace/rpm" + exit 1 + else + krpm=`find "${rpmdir}" -name "${rpmpat}"` + rpm -ihv $krpm + fi +} + +# Isolate CPUs from the general scheduler +config_grub 'isolcpus' ${host_isolcpus} + +# Stop timer ticks on isolated CPUs whenever possible +config_grub 'nohz_full' ${host_isolcpus} + +# Do not call RCU callbacks on isolated CPUs +config_grub 'rcu_nocbs' ${host_isolcpus} + +# Enable intel iommu driver and disable DMA translation for devices +config_grub 'iommu' 'pt' +config_grub 'intel_iommu' 'on' + +# Set HugeTLB pages to 1GB +config_grub 'default_hugepagesz' '1G' +config_grub 'hugepagesz' '1G' + +# Disable machine check +config_grub 'mce' 'off' + +## Use polling idle loop to improve performance +config_grub 'idle' 'poll' + +## Disable clocksource verification at runtime +config_grub 'tsc' 'reliable' + +sed -i s/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/ /etc/default/grub +grub2-mkconfig -o /boot/grub2/grub.cfg + +install_kernel -- cgit 1.2.3-korg