We create the /etc/modprobe.d/kvm.rt.tuned.conf file at every boot. However, there's nothing that guarantees that the kvm module will be loaded after tuned. Indeed, it's possible to reproduce a race where the kvm module is loaded before tuned. When this happens, the kvm module will be loaded with incorrect parameters as the kvm.rt.tuned.conf file doesn't exist. The solution to this problem is to create the kvm.rt.tuned.conf file only if it doesn't exist and delete it when changing profiles. Resolves: rhbz#1292117 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> profiles/realtime-virtual-host/script.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
84 lines
2.6 KiB
Bash
Executable file
84 lines
2.6 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
. /usr/lib/tuned/functions
|
|
|
|
modfile=/etc/modprobe.d/kvm.rt.tuned.conf
|
|
ltanfile=/sys/module/kvm/parameters/lapic_timer_advance_ns
|
|
|
|
create_modfile()
|
|
{
|
|
modinfo -p kvm | grep -q kvmclock_periodic_sync
|
|
if [ "$?" -eq 0 ]; then
|
|
echo "options kvm kvmclock_periodic_sync=0" > $modfile
|
|
fi
|
|
|
|
modinfo -p kvm_intel | grep -q ple_gap
|
|
if [ "$?" -eq 0 ]; then
|
|
echo "options kvm_intel ple_gap=0" >> $modfile
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
python /usr/libexec/tuned/defirqaffinity.py "remove" "$TUNED_isolated_cores_expanded" &&
|
|
tuna -c "$TUNED_isolated_cores_expanded" -i
|
|
retval = "$?"
|
|
|
|
if [ ! $retval -eq 0 ]; then
|
|
return $retval
|
|
fi
|
|
|
|
if [ ! -f $modfile ]; then
|
|
create_modfile
|
|
fi
|
|
|
|
if [ -f lapic_timer_adv_ns.cpumodel ]; then
|
|
curmodel=`cat /proc/cpuinfo | grep "model name" | cut -f 2 -d ":" | uniq`
|
|
genmodel=`cat lapic_timer_adv_ns.cpumodel`
|
|
|
|
if [ "$curmodel" != "$genmodel" ]; then
|
|
rm -f lapic_timer_adv_ns
|
|
rm -f lapic_timer_adv_ns.cpumodel
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ -f $ltanfile -a ! -f ./lapic_timer_adv_ns ]; then
|
|
if [ -f /usr/share/qemu-kvm/tscdeadline_latency.flat ]; then
|
|
tempdir=`mktemp -d`
|
|
isolatedcpu=`echo "$TUNED_isolated_cores_expanded" | cut -f 1 -d ","`
|
|
sh ./run-tscdeadline-latency.sh $isolatedcpu > $tempdir/lat.out
|
|
sh ./find-lapictscdeadline-optimal.sh $tempdir/lat.out > $tempdir/opt.out
|
|
if [ $? -eq 0 ]; then
|
|
echo `cat $tempdir/opt.out | cut -f 2 -d ":"` > ./lapic_timer_adv_ns
|
|
curmodel=`cat /proc/cpuinfo | grep "model name" | cut -f 2 -d ":" | uniq`
|
|
echo "$curmodel" > lapic_timer_adv_ns.cpumodel
|
|
fi
|
|
fi
|
|
fi
|
|
if [ -f $ltanfile -a -f ./lapic_timer_adv_ns ]; then
|
|
echo `cat ./lapic_timer_adv_ns` > $ltanfile
|
|
fi
|
|
|
|
return $retval
|
|
}
|
|
|
|
stop() {
|
|
[ "$1" = "profile_switch" ] && rm -f $modfile
|
|
tuna -c "$TUNED_isolated_cores_expanded" -I &&
|
|
python /usr/libexec/tuned/defirqaffinity.py "add" "$TUNED_isolated_cores_expanded"
|
|
return "$?"
|
|
}
|
|
|
|
verify() {
|
|
python /usr/libexec/tuned/defirqaffinity.py "verify" "$TUNED_isolated_cores_expanded"
|
|
retval = "$?"
|
|
if [ $retval -eq 0 -a -f /sys/module/kvm/parameters/kvmclock_periodic_sync ]; then
|
|
retval = `cat /sys/module/kvm/parameters/kvmclock_periodic_sync`
|
|
fi
|
|
if [ $retval -eq 0 -a -f /sys/module/kvm_intel/parameters/ple_gap ]; then
|
|
retval = `cat /sys/module/kvm_intel/parameters/ple_gap`
|
|
fi
|
|
return $retval
|
|
}
|
|
|
|
process $@
|