Bug 1395855

Summary: cpu-partitioning: disable kvmclock sync and ple
Product: Red Hat Enterprise Linux 7 Reporter: Luiz Capitulino <lcapitulino>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: unspecified Docs Contact: Lenka Kimlickova <lkimlick>
Priority: high    
Version: 7.4CC: atragler, bhu, jeder, jskarvad, psklenar, tcerna
Target Milestone: rcKeywords: Patch, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.8.0-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1439156 (view as bug list) Environment:
Last Closed: 2017-08-01 12:32:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1394932, 1400961, 1439156    

Description Luiz Capitulino 2016-11-16 20:13:58 UTC
The cpu-partitioning profile should disable the kvmclock sync feature and the ple, just as the real-time host profile does. Otherwise, a process running on isolated CPUs will be interrupted by timers or unwanted VM exists.

Here's the code to do this (from /usr/lib/tuned/realtime-virtual-host/script.sh):

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()
{
    [...]

    if [ ! -f $modfile ]; then
        create_modfile
    fi

    [...]
}

stop()
{
    [...]
    [ "$1" = "profile_switch" ] && rm -f $modfile
    [...]
}

A few observations:

1. In the RT profiles, this code is only part of the host profile. But I guess there's no problem running it in the guest too (meaning, we can keep a single cpu-partitioning profile instead of breaking it into host and guest profiles)

2. modfile should probably be /etc/modprobe.d/kvm-cpu-partitioning.conf

3. Maybe we should create functions in /usr/lib/tuned/functions to handle /etc/modprobe.d files? So that we avoid code duplication like this?

Comment 6 Tereza Cerna 2017-04-26 10:27:27 UTC
Verified in:
    tuned-2.8.0-2.el7.noarch
PASS


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Check that kvmclock sync feature and ple are disabled [BZ#1395855]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'ls /etc/modprobe.d | grep kvm.rt.tuned.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep N /sys/module/kvm/parameters/kvmclock_periodic_sync' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep 0 /sys/module/kvm_intel/parameters/ple_gap' (Expected 0, got 0)
:: [   PASS   ] :: Command 'tuned-adm profile virtual-guest' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ls /etc/modprobe.d | grep kvm.rt.tuned.conf' (Expected 1, got 1)
:: [   LOG    ] :: Duration: 3s
:: [   LOG    ] :: Assertions: 5 good, 0 bad
:: [   PASS   ] :: RESULT: Check that kvmclock sync feature and ple are disabled [BZ#1395855]

Comment 10 errata-xmlrpc 2017-08-01 12:32:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2102