diff --git a/SOURCES/tuned-2.5.1-realtime-virtual-host-modprobe-race-fix.patch b/SOURCES/tuned-2.5.1-realtime-virtual-host-modprobe-race-fix.patch new file mode 100644 index 0000000..2422e53 --- /dev/null +++ b/SOURCES/tuned-2.5.1-realtime-virtual-host-modprobe-race-fix.patch @@ -0,0 +1,154 @@ +diff --git a/profiles/functions b/profiles/functions +index 957dfb6..ee525e0 100644 +--- a/profiles/functions ++++ b/profiles/functions +@@ -495,19 +495,21 @@ stop() { + # + + process() { +- case "$1" in ++ ARG="$1" ++ shift ++ case "$ARG" in + start) +- start ++ start "$@" + RETVAL=$? + ;; + stop) +- stop ++ stop "$@" + RETVAL=$? + ;; + verify) + if declare -f verify &> /dev/null; + then +- verify ++ verify "$@" + else + : + fi +diff --git a/profiles/realtime-virtual-host/script.sh b/profiles/realtime-virtual-host/script.sh +index 161052c..9c09ee3 100755 +--- a/profiles/realtime-virtual-host/script.sh ++++ b/profiles/realtime-virtual-host/script.sh +@@ -2,8 +2,22 @@ + + . /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 +@@ -13,14 +27,8 @@ start() { + return $retval + fi + +- modinfo -p kvm | grep -q kvmclock_periodic_sync +- if [ "$?" -eq 0 ]; then +- echo "options kvm kvmclock_periodic_sync=0" > /etc/modprobe.d/kvm.rt.tuned.conf +- fi +- +- modinfo -p kvm_intel | grep -q ple_gap +- if [ "$?" -eq 0 ]; then +- echo "options kvm_intel ple_gap=0" >> /etc/modprobe.d/kvm.rt.tuned.conf ++ if [ ! -f $modfile ]; then ++ create_modfile + fi + + if [ -f lapic_timer_adv_ns.cpumodel ]; then +@@ -55,7 +63,7 @@ start() { + } + + stop() { +- rm -f /etc/modprobe.d/kvm.rt.tuned.conf ++ [ "$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 "$?" +diff --git a/tuned.spec b/tuned.spec +index e152dac..2e2d9e9 100644 +--- a/tuned.spec ++++ b/tuned.spec +@@ -139,6 +139,10 @@ mkdir -p %{buildroot}%{_datadir}/tuned/grub2 + mv %{buildroot}%{_sysconfdir}/grub.d/00_tuned %{buildroot}%{_datadir}/tuned/grub2/00_tuned + rmdir %{buildroot}%{_sysconfdir}/grub.d + ++# ghost for NFV ++mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d ++touch %{buildroot}%{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf ++ + %post + %systemd_post tuned.service + +@@ -283,6 +287,7 @@ fi + %defattr(-,root,root,-) + %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-guest-variables.conf + %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-host-variables.conf ++%ghost %{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf + %{_prefix}/lib/tuned/realtime-virtual-guest + %{_prefix}/lib/tuned/realtime-virtual-host + %{_libexecdir}/tuned/defirqaffinity* +diff --git a/tuned/plugins/plugin_script.py b/tuned/plugins/plugin_script.py +index 7b3d487..57a6335 100644 +--- a/tuned/plugins/plugin_script.py ++++ b/tuned/plugins/plugin_script.py +@@ -30,14 +30,14 @@ class ScriptPlugin(base.Plugin): + def _instance_cleanup(self, instance): + pass + +- def _call_scripts(self, scripts, argument): ++ def _call_scripts(self, scripts, arguments): + for script in scripts: + environ = os.environ + environ.update(self._variables.get_env()) +- log.info("calling script '%s' with argument '%s'" % (script, argument)) ++ log.info("calling script '%s' with arguments '%s'" % (script, str(arguments))) + log.debug("using environment '%s'" % str(environ.items())) + try: +- proc = Popen([script, argument], stdout=PIPE, stderr=PIPE, close_fds=True, env=environ, \ ++ proc = Popen([script] + arguments, stdout=PIPE, stderr=PIPE, close_fds=True, env=environ, \ + cwd = os.path.dirname(script)) + out, err = proc.communicate() + if proc.returncode: +@@ -50,13 +50,13 @@ class ScriptPlugin(base.Plugin): + + def _instance_apply_static(self, instance): + super(self.__class__, self)._instance_apply_static(instance) +- self._call_scripts(instance._scripts, "start") ++ self._call_scripts(instance._scripts, ["start"]) + + def _instance_verify_static(self, instance): + ret = True + if super(self.__class__, self)._instance_verify_static(instance) == False: + ret = False +- if self._call_scripts(instance._scripts, "verify") == True: ++ if self._call_scripts(instance._scripts, ["verify"]) == True: + log.info(consts.STR_VERIFY_PROFILE_OK % instance._scripts) + else: + log.error(consts.STR_VERIFY_PROFILE_FAIL % instance._scripts) +@@ -64,5 +64,8 @@ class ScriptPlugin(base.Plugin): + return ret + + def _instance_unapply_static(self, instance, profile_switch = False): +- self._call_scripts(reversed(instance._scripts), "stop") ++ args = ["stop"] ++ if profile_switch: ++ args = args + ["profile_switch"] ++ self._call_scripts(reversed(instance._scripts), args) + super(self.__class__, self)._instance_unapply_static(instance, profile_switch) diff --git a/SPECS/tuned.spec b/SPECS/tuned.spec index 2653011..e5266ea 100644 --- a/SPECS/tuned.spec +++ b/SPECS/tuned.spec @@ -1,7 +1,7 @@ Summary: A dynamic adaptive system tuning daemon Name: tuned Version: 2.5.1 -Release: 4%{?dist}.1 +Release: 4%{?dist}.2 License: GPLv2+ Source: https://fedorahosted.org/releases/t/u/tuned/tuned-%{version}.tar.bz2 URL: https://fedorahosted.org/tuned/ @@ -26,6 +26,8 @@ Patch4: tuned-2.5.1-lapic-timer-adv-ns-cache-fix.patch Patch5: tuned-2.5.1-find-lapictscdeadline-optimal-fix.patch # rhbz#1282570 Patch6: tuned-2.5.1-realtime-remove-nohz-full.patch +# rhbz#1298204 +Patch7: tuned-2.5.1-realtime-virtual-host-modprobe-race-fix.patch %description The tuned package contains a daemon that tunes system settings dynamically. @@ -132,6 +134,7 @@ It can be also used to fine tune your system for specific scenarios. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 %build @@ -149,6 +152,10 @@ mkdir -p %{buildroot}%{_datadir}/tuned/grub2 mv %{buildroot}%{_sysconfdir}/grub.d/00_tuned %{buildroot}%{_datadir}/tuned/grub2/00_tuned rmdir %{buildroot}%{_sysconfdir}/grub.d +# ghost for NFV +mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d +touch %{buildroot}%{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf + %post %systemd_post tuned.service @@ -297,6 +304,7 @@ fi %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-guest-variables.conf %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-host-variables.conf +%ghost %{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf %{_prefix}/lib/tuned/realtime-virtual-guest %{_prefix}/lib/tuned/realtime-virtual-host %{_libexecdir}/tuned/defirqaffinity* @@ -314,6 +322,11 @@ fi %{_mandir}/man7/tuned-profiles-compat.7* %changelog +* Wed Jan 13 2016 Jaroslav Škarvada - 2.5.1-4.2 +- fixed race in modprobe in realtime-virtual-host profile and extended + stop action to have hint why it is called + resolves: rhbz#1298204 + * Mon Nov 16 2015 Jaroslav Škarvada - 2.5.1-4.1 - fixed various verification issues (by verification-fixes patch) resolves: rhbz#1282565