1
0
Fork 0

functions: reworked setup_kvm_mod_low_latency to count with kernel changes

It updates the KVM modprobe file if its content differs from what's
supported on the current system. It may look a bit over-engineered, but
it's done this way to lower the possibility of race condition.

Resolves: rhbz#1649408

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2018-11-22 17:38:12 +01:00
parent bc9a2da3e8
commit c4a0aef63d
No known key found for this signature in database
GPG key ID: D8E1C00E076E840B

View file

@ -503,28 +503,31 @@ eee_set_normal_fsb() {
kvm_modprobe_file=/etc/modprobe.d/kvm.rt.tuned.conf
setup_kvm_mod_low_latency()
{
if [ -f $kvm_modprobe_file ]; then
return
fi
modinfo -p kvm | grep -q kvmclock_periodic_sync
if [ "$?" -eq 0 ]; then
echo "options kvm kvmclock_periodic_sync=0" > $kvm_modprobe_file
fi
modinfo -p kvm_intel | grep -q ple_gap
if [ "$?" -eq 0 ]; then
echo "options kvm_intel ple_gap=0" >> $kvm_modprobe_file
fi
}
teardown_kvm_mod_low_latency()
{
rm -f $kvm_modprobe_file
}
setup_kvm_mod_low_latency()
{
local HAS_KPS=""
local HAS_PLE_GAP=""
local WANTS_KPS=""
local WANTS_PLE_GAP=""
modinfo -p kvm | grep -q kvmclock_periodic_sync && HAS_KPS=1
modinfo -p kvm_intel | grep -q ple_gap && HAS_PLE_GAP=1
grep -qs kvmclock_periodic_sync "$kvm_modprobe_file" && WANTS_KPS=1
grep -qs ple_gap "$kvm_modprobe_file" && WANTS_PLE_GAP=1
if [ "$HAS_KPS" != "$WANTS_KPS" -o "$HAS_PLE_GAP" != "$WANTS_PLE_GAP" ]; then
teardown_kvm_mod_low_latency
[ "$HAS_KPS" ] && echo "options kvm kvmclock_periodic_sync=0" > $kvm_modprobe_file
[ "$HAS_PLE_GAP" ] && echo "options kvm_intel ple_gap=0" >> $kvm_modprobe_file
fi
return 0
}
#
# KSM
#