Bug 1259452

Summary: tuned-profiles-nfv: lapic_timer_adv_ns cache not working
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:
Priority: high    
Version: 7.2CC: bhu, hhuang, jeder, jscotka, jskarvad, juzhang, lcapitulino, tcerna, tlavigne, xfu
Target Milestone: rcKeywords: ZStream
Target Release: ---Flags: tcerna: needinfo-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.5.1-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1282567 (view as bug list) Environment:
Last Closed: 2016-11-04 07:25:01 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: 1240765, 1273048, 1282567    

Description Luiz Capitulino 2015-09-02 15:56:23 UTC
Description of problem:

Every time I boot my KVM-RT host, I can observe that the file /sys/module/kvm/parameters/lapic_timer_advance_ns keeps changing for minutes. Even after the system is fully booted.

Version-Release number of selected component (if applicable): tuned-profiles-nfv-2.5.1-3.el7.noarch


How reproducible:


Steps to Reproduce:
1. Boot a host with the realtime-virtual-host profile setup
2. After boot, run:

 # watch -n1 cat /sys/module/kvm/parameters/lapic_timer_advance_ns

3. Check the file contents changing every few seconds or so

Actual results:


Expected results:


Additional info:

Comment 1 Luiz Capitulino 2015-09-02 15:56:53 UTC
I've debugged this down to two bugs in the code that implements lapic_timer_adv_ns cache caching. The patch below should fix them:

diff --git a/profiles/realtime-virtual-host/script.sh b/profiles/realtime-virtual-host/script.sh
index 9970b8e..161052c 100755
--- a/profiles/realtime-virtual-host/script.sh
+++ b/profiles/realtime-virtual-host/script.sh
@@ -27,7 +27,7 @@ start() {
         curmodel=`cat /proc/cpuinfo | grep "model name" | cut -f 2 -d ":" | uniq`
         genmodel=`cat lapic_timer_adv_ns.cpumodel`
 
-        if [ "$cpumodel" != "$genmodel" ]; then
+        if [ "$curmodel" != "$genmodel" ]; then
             rm -f lapic_timer_adv_ns
             rm -f lapic_timer_adv_ns.cpumodel
         fi
@@ -43,7 +43,7 @@ start() {
              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
+                  echo "$curmodel" > lapic_timer_adv_ns.cpumodel
              fi
         fi
     fi

Comment 4 Jaroslav Škarvada 2015-11-16 16:30:10 UTC
Upstream commit fixing the problem:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=cb826c1e38a3bf68a1c169a2665d2edab72abb2d

Comment 13 errata-xmlrpc 2016-11-04 07:25:01 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://rhn.redhat.com/errata/RHBA-2016-2479.html