From ba319ac7fd9beeabc725db31134d31adcddc4814 Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Nov 08 2013 16:55:34 +0000 Subject: import tuned-2.3.0-3.el7.src.rpm --- diff --git a/.tuned.metadata b/.tuned.metadata new file mode 100644 index 0000000..1328a39 --- /dev/null +++ b/.tuned.metadata @@ -0,0 +1 @@ +e0bcdb54215e38738f9a0e564d3309476b8545bd SOURCES/tuned-2.3.0.tar.bz2 diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/tuned-2.3.0-fix-race.patch b/SOURCES/tuned-2.3.0-fix-race.patch new file mode 100644 index 0000000..6427fce --- /dev/null +++ b/SOURCES/tuned-2.3.0-fix-race.patch @@ -0,0 +1,20 @@ +diff --git a/tuned/daemon/daemon.py b/tuned/daemon/daemon.py +index 9741cac..804ac0b 100644 +--- a/tuned/daemon/daemon.py ++++ b/tuned/daemon/daemon.py +@@ -65,7 +65,6 @@ class Daemon(object): + self._save_active_profile(self._profile.name) + self._unit_manager.start_tuning() + +- self._terminate.clear() + while not tuned.utils.commands.wait(self._terminate, self._update_interval): + log.debug("updating monitors") + self._unit_manager.update_monitors() +@@ -105,6 +104,7 @@ class Daemon(object): + + log.info("starting tuning") + self._thread = threading.Thread(target=self._thread_code) ++ self._terminate.clear() + self._thread.start() + return True + diff --git a/SOURCES/tuned-2.3.0-timing-improvements.patch b/SOURCES/tuned-2.3.0-timing-improvements.patch new file mode 100644 index 0000000..7d9bd97 --- /dev/null +++ b/SOURCES/tuned-2.3.0-timing-improvements.patch @@ -0,0 +1,139 @@ +diff --git a/man/tuned-main.conf.5 b/man/tuned-main.conf.5 +index 61a6a4b..6f324be 100644 +--- a/man/tuned-main.conf.5 ++++ b/man/tuned-main.conf.5 +@@ -16,17 +16,31 @@ will be used. Please note if it is enabled here, it is still possible + to individually disable it in plugins. + + .TP ++.BI sleep_interval= INT ++Tuned daemon is periodically waken after \fIINT\fR seconds and checks ++for events. By default this is set to 1 second. If you have Python 2 ++interpreter with applied patch from Red Hat Bugzilla #917709 this ++controls responsiveness time of Tuned to commands (i.e. if you ++request profile switch, it may take up to 1 second until Tuned reacts). ++Increase this number for higher responsiveness times and more power ++savings (due to lower number of wakeups). In case you have unpatched ++Python 2 interpreter, this settings will have no visible effect, ++because the intepreter will poll 20 times per second. ++ ++.TP + .BI update_interval= INT + Update interval for dynamic tuning (in seconds). Tuned daemon is periodically + waken after \fIINT\fR seconds, updates its monitors, calculates new tuning + parameters for enabled plugins and applies the changes. Plugins that have + disabled dynamic tuning are not processed. By default the \fIINT\fR is set + to 10 seconds. Tuned daemon doesn't periodically wake if dynamic tuning is +-globally disabled (see \fBdynamic_tuning\fR). ++globally disabled (see \fBdynamic_tuning\fR) or this setting set to 0. ++This must be multiple of \fBsleep_interval\fR. + + .SH EXAMPLE + .nf + dynamic_tuning = 1 ++sleep_interval = 1 + update_interval = 10 + .fi + +diff --git a/tuned/consts.py b/tuned/consts.py +index 1dd53ab..6c8dc4b 100644 +--- a/tuned/consts.py ++++ b/tuned/consts.py +@@ -18,5 +18,7 @@ SYSTEM_RELEASE_FILE = "/etc/system-release-cpe" + + # default configuration + CFG_DEF_DYNAMIC_TUNING = True ++# how long to sleep before checking for events (in seconds) ++CFG_DEF_SLEEP_INTERVAL = 1 + # update interval for dynamic tuning (in seconds) + CFG_DEF_UPDATE_INTERVAL = 10 +diff --git a/tuned/daemon/application.py b/tuned/daemon/application.py +index f1b5208..e4c9da3 100644 +--- a/tuned/daemon/application.py ++++ b/tuned/daemon/application.py +@@ -16,6 +16,7 @@ log = tuned.logs.get() + __all__ = ["Application"] + + global_config_spec = ["dynamic_tuning = boolean(default=%s)" % consts.CFG_DEF_DYNAMIC_TUNING, ++ "sleep_interval = integer(default=%s)" % consts.CFG_DEF_SLEEP_INTERVAL, + "update_interval = integer(default=%s)" % consts.CFG_DEF_UPDATE_INTERVAL] + + class Application(object): +@@ -31,7 +32,6 @@ class Application(object): + self.config = self._load_global_config() + if self.config.get("dynamic_tuning"): + log.info("dynamic tuning is enabled (can be overriden in plugins)") +- log.info("update interval is %d seconds" % self.config.get("update_interval")) + else: + log.info("dynamic tuning is globally disabled") + +@@ -44,7 +44,7 @@ class Application(object): + profile_loader = profiles.Loader(profile_locator, profile_factory, profile_merger) + + +- self._daemon = daemon.Daemon(unit_manager, profile_loader, profile_name, int(self.config.get("update_interval", consts.CFG_DEF_UPDATE_INTERVAL))) ++ self._daemon = daemon.Daemon(unit_manager, profile_loader, profile_name, self.config) + self._controller = controller.Controller(self._daemon) + + self._dbus_exporter = None +diff --git a/tuned/daemon/daemon.py b/tuned/daemon/daemon.py +index 804ac0b..35f60c2 100644 +--- a/tuned/daemon/daemon.py ++++ b/tuned/daemon/daemon.py +@@ -9,9 +9,27 @@ log = tuned.logs.get() + + + class Daemon(object): +- def __init__(self, unit_manager, profile_loader, profile_name=None, update_interval = int(consts.CFG_DEF_UPDATE_INTERVAL)): ++ def __init__(self, unit_manager, profile_loader, profile_name=None, config=None): + log.debug("initializing daemon") +- self._update_interval = update_interval ++ self._sleep_interval = int(consts.CFG_DEF_SLEEP_INTERVAL) ++ self._update_interval = int(consts.CFG_DEF_UPDATE_INTERVAL) ++ self._dynamic_tuning = consts.CFG_DEF_DYNAMIC_TUNING ++ if config is not None: ++ self._sleep_interval = int(config.get("sleep_interval", consts.CFG_DEF_SLEEP_INTERVAL)) ++ self._update_interval = int(config.get("update_interval", consts.CFG_DEF_UPDATE_INTERVAL)) ++ self._dynamic_tuning = config.get("dynamic_tuning", consts.CFG_DEF_DYNAMIC_TUNING) ++ if self._sleep_interval <= 0: ++ self._sleep_interval = int(consts.CFG_DEF_SLEEP_INTERVAL) ++ if self._update_interval == 0: ++ self._dynamic_tuning = False ++ elif self._update_interval < self._sleep_interval: ++ self._update_interval = self._sleep_interval ++ self._sleep_cycles = self._update_interval // self._sleep_interval ++ log.info("using sleep interval of %d second(s)" % self._sleep_interval) ++ if self._dynamic_tuning: ++ log.info("dynamic tuning is enabled (can be overriden by plugins)") ++ log.info("using update interval of %d second(s) (%d times of the sleep interval)" % (self._sleep_cycles * self._sleep_interval, self._sleep_cycles)) ++ + self._unit_manager = unit_manager + self._profile_loader = profile_loader + self._init_threads() +@@ -65,11 +83,21 @@ class Daemon(object): + self._save_active_profile(self._profile.name) + self._unit_manager.start_tuning() + +- while not tuned.utils.commands.wait(self._terminate, self._update_interval): +- log.debug("updating monitors") +- self._unit_manager.update_monitors() +- log.debug("performing tunings") +- self._unit_manager.update_tuning() ++ # In python 2 interpreter with applied patch for rhbz#917709 we need to periodically ++ # poll, otherwise the python will not have chance to update events / locks (due to GIL) ++ # and e.g. DBus control will not work. The polling interval of 1 seconds (which is ++ # the default) is still much better than 50 ms polling with unpatched interpreter. ++ # For more details see tuned rhbz#917587. ++ _sleep_cnt = self._sleep_cycles ++ while not tuned.utils.commands.wait(self._terminate, self._sleep_interval): ++ if self._dynamic_tuning: ++ _sleep_cnt -= 1 ++ if _sleep_cnt <= 0: ++ _sleep_cnt = self._sleep_cycles ++ log.debug("updating monitors") ++ self._unit_manager.update_monitors() ++ log.debug("performing tunings") ++ self._unit_manager.update_tuning() + + self._unit_manager.stop_tuning() + self._unit_manager.destroy_all() diff --git a/SPECS/tuned.spec b/SPECS/tuned.spec new file mode 100644 index 0000000..0876726 --- /dev/null +++ b/SPECS/tuned.spec @@ -0,0 +1,303 @@ +Summary: A dynamic adaptive system tuning daemon +Name: tuned +Version: 2.3.0 +Release: 3%{?dist} +License: GPLv2+ +Source: https://fedorahosted.org/releases/t/u/tuned/tuned-%{version}.tar.bz2 +URL: https://fedorahosted.org/tuned/ +BuildArch: noarch +BuildRequires: python, systemd +Requires(post): systemd, virt-what +Requires(preun): systemd +Requires(postun): systemd +Requires: python-decorator, dbus-python, pygobject3-base, python-pyudev +Requires: virt-what, python-configobj, ethtool, gawk +Patch0: tuned-2.3.0-fix-race.patch +Patch1: tuned-2.3.0-timing-improvements.patch + +%description +The tuned package contains a daemon that tunes system settings dynamically. +It does so by monitoring the usage of several system components periodically. +Based on that information components will then be put into lower or higher +power saving modes to adapt to the current usage. Currently only ethernet +network and ATA harddisk devices are implemented. + +%package utils +Requires: %{name} = %{version}-%{release} +Summary: Various tuned utilities +Requires: powertop + +%description utils +This package contains utilities that can help you to fine tune and +debug your system and manage tuned profiles. + +%package utils-systemtap +Summary: Disk and net statistic monitoring systemtap scripts +Requires: %{name} = %{version}-%{release} +Requires: systemtap + +%description utils-systemtap +This package contains several systemtap scripts to allow detailed +manual monitoring of the system. Instead of the typical IO/sec it collects +minimal, maximal and average time between operations to be able to +identify applications that behave power inefficient (many small operations +instead of fewer large ones). + +%package profiles-compat +Summary: Additional tuned profiles mainly for backward compatibility with tuned 1.0 +Requires: %{name} = %{version}-%{release} + +%description profiles-compat +Additional tuned profiles mainly for backward compatibility with tuned 1.0. +It can be also used to fine tune your system for specific scenarios. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + + +%build + + +%install +make install DESTDIR=%{buildroot} +%if 0%{?rhel} +sed -i 's/\(dynamic_tuning[ \t]*=[ \t]*\).*/\10/' %{buildroot}%{_sysconfdir}/tuned/tuned-main.conf +%endif + + +%post +%systemd_post tuned.service + +# try to autodetect the best profile for the system in case there is none preset +if [ ! -f /etc/tuned/active_profile -o -z "`cat /etc/tuned/active_profile 2>/dev/null`" ] +then + PROFILE=`/usr/sbin/tuned-adm recommend 2>/dev/null` + [ "$PROFILE" ] || PROFILE=balanced + /usr/sbin/tuned-adm profile "$PROFILE" 2>/dev/null || echo -n "$PROFILE" > /etc/tuned/active_profile +fi + +# convert active_profile from full path to name (if needed) +sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile + + +%preun +%systemd_preun tuned.service + + +%postun +%systemd_postun_with_restart tuned.service + + +%triggerun -- tuned < 2.0-0 +# remove ktune from old tuned, now part of tuned +/usr/sbin/service ktune stop &>/dev/null || : +/usr/sbin/chkconfig --del ktune &>/dev/null || : + + +%files +%defattr(-,root,root,-) +%doc AUTHORS +%doc COPYING +%doc README +%doc doc/TIPS.txt +%{_sysconfdir}/bash_completion.d +%{python_sitelib}/tuned +%{_sbindir}/tuned +%{_sbindir}/tuned-adm +%exclude %{_prefix}/lib/tuned/default +%exclude %{_prefix}/lib/tuned/desktop-powersave +%exclude %{_prefix}/lib/tuned/laptop-ac-powersave +%exclude %{_prefix}/lib/tuned/server-powersave +%exclude %{_prefix}/lib/tuned/laptop-battery-powersave +%exclude %{_prefix}/lib/tuned/enterprise-storage +%exclude %{_prefix}/lib/tuned/spindown-disk +%{_prefix}/lib/tuned +%dir %{_sysconfdir}/tuned +%config(noreplace) %{_sysconfdir}/tuned/active_profile +%config(noreplace) %{_sysconfdir}/tuned/tuned-main.conf +%{_sysconfdir}/tmpfiles.d +%{_sysconfdir}/dbus-1/system.d/com.redhat.tuned.conf +%{_unitdir}/tuned.service +%dir %{_localstatedir}/log/tuned +%dir /run/tuned +%{_mandir}/man5/tuned* +%{_mandir}/man8/tuned* + +%files utils +%defattr(-,root,root,-) +%doc COPYING +%{_bindir}/powertop2tuned +%{_libexecdir}/tuned/pmqos-static* + +%files utils-systemtap +%defattr(-,root,root,-) +%doc doc/README.utils +%doc doc/README.scomes +%doc COPYING +%{_sbindir}/varnetload +%{_sbindir}/netdevstat +%{_sbindir}/diskdevstat +%{_sbindir}/scomes +%{_mandir}/man8/varnetload.* +%{_mandir}/man8/netdevstat.* +%{_mandir}/man8/diskdevstat.* +%{_mandir}/man8/scomes.* + +%files profiles-compat +%defattr(-,root,root,-) +%{_prefix}/lib/tuned/default +%{_prefix}/lib/tuned/desktop-powersave +%{_prefix}/lib/tuned/laptop-ac-powersave +%{_prefix}/lib/tuned/server-powersave +%{_prefix}/lib/tuned/laptop-battery-powersave +%{_prefix}/lib/tuned/enterprise-storage +%{_prefix}/lib/tuned/spindown-disk + +%changelog +* Fri Nov 8 2013 Jaroslav Škarvada - 2.3.0-3 +- defuzzified patches + related: rhbz#1028119, rhbz#1028122 + +* Fri Nov 8 2013 Jaroslav Škarvada - 2.3.0-2 +- fixed race condition in the start/stop code + resolves: rhbz#1028119 +- improved tuned responsiveness + resolves: rhbz#1028122 + +* Wed Nov 6 2013 Jaroslav Škarvada - 2.3.0-1 +- new-release + resolves: rhbz#1020743 + - audio plugin: fixed audio settings in standard profiles + - video plugin: fixed tunings + - daemon: fixed crash if preset profile is not available + - man: various updates and corrections + - functions: fixed usb and bluetooth handling + - tuned: switched to lightweighted pygobject3-base + - daemon: added global config for dynamic_tuning + - utils: added pmqos-static script for debug purposes + - throughput-performance: various fixes + - tuned: added global option update_interval + - plugin_cpu: added support for x86_energy_perf_policy + resolves: rhbz#1015675 + - dbus: fixed KeyboardInterrupt handling + - plugin_cpu: added support for intel_pstate + resolves: rhbz#996722 + - profiles: various fixes + - profiles: added desktop profile + resolves: rhbz#996723 + - tuned-adm: implemented non DBus fallback control + - profiles: added sap profile + - tuned: lowered CPU usage due to python bug + +* Wed Oct 16 2013 Jaroslav Škarvada - 2.2.2-4 +- lock CPU to C1 instead of C0 in latency-performance profile + resolves: rhbz#1013085 +- readahed multiply set to 4 in throughput-performance profile + resolves: rhbz#987570 +- packaged pmqos-static script for debugging purposes + resolves: rhbz#1015676 +- added global configuration file with the possibility to globally + disable the dynamic tuning and it is by default disabled on RHEL + resolves: rhbz#1006427 + +* Thu Jul 25 2013 Jaroslav Škarvada - 2.2.2-3 +- do not package backup file + related: rhbz#986468 + +* Thu Jul 25 2013 Jaroslav Škarvada - 2.2.2-2 +- used pygobject3-base instead of pygobject2 + resolves: rhbz#986468 + +* Tue Mar 19 2013 Jaroslav Škarvada - 2.2.2-1 +- new-release: + - cpu plugin: fixed cpupower workaround + - cpu plugin: fixed crash if cpupower is installed + +* Fri Mar 1 2013 Jaroslav Škarvada - 2.2.1-1 +- new release: + - audio plugin: fixed error handling in _get_timeout + - removed cpupower dependency, added sysfs fallback + - powertop2tuned: fixed parser crash on binary garbage + resolves: rhbz#914933 + - cpu plugin: dropped multicore_powersave as kernel upstream already did + - plugins: options manipulated by dynamic tuning are now correctly saved and restored + - powertop2tuned: added alias -e for --enable option + - powertop2tuned: new option -m, --merge-profile to select profile to merge + - prefer transparent_hugepage over redhat_transparent_hugepage + - recommend: use recommend.conf not autodetect.conf + - tuned.service: switched to dbus type service + resolves: rhbz#911445 + - tuned: new option --pid, -P to write PID file + - tuned, tuned-adm: added new option --version, -v to show version + - disk plugin: use APM value 254 for cleanup / APM disable instead of 255 + resolves: rhbz#905195 + - tuned: new option --log, -l to select log file + - powertop2tuned: avoid circular deps in include (one level check only) + - powertop2tuned: do not crash if powertop is not installed + - net plugin: added support for wake_on_lan static tuning + resolves: rhbz#885504 + - loader: fixed error handling + - spec: used systemd-rpm macros + resolves: rhbz#850347 + +* Mon Jan 28 2013 Jan Vcelak 2.2.0-1 +- new release: + - remove nobarrier from virtual-guest (data loss prevention) + - devices enumeration via udev, instead of manual retrieval + - support for dynamically inserted devices (currently disk plugin) + - dropped rfkill plugins (bluetooth and wifi), the code didn't work + +* Wed Jan 2 2013 Jaroslav Škarvada - 2.1.2-1 +- new release: + - systemtap {disk,net}devstat: fix typo in usage + - switched to configobj parser + - latency-performance: disabled THP + - fixed fd leaks on subprocesses + +* Thu Dec 06 2012 Jan Vcelak 2.1.1-1 +- fix: powertop2tuned execution +- fix: ownership of /etc/tuned + +* Mon Dec 03 2012 Jan Vcelak 2.1.0-1 +- new release: + - daemon: allow running without selected profile + - daemon: fix profile merging, allow only safe characters in profile names + - daemon: implement missing methods in DBus interface + - daemon: implement profile recommendation + - daemon: improve daemonization, PID file handling + - daemon: improved device matching in profiles, negation possible + - daemon: various internal improvements + - executables: check for EUID instead of UID + - executables: run python with -Es to increase security + - plugins: cpu - fix cpupower execution + - plugins: disk - fix option setting + - plugins: mounts - new, currently supports only barriers control + - plugins: sysctl - fix a bug preventing settings application + - powertop2tuned: speedup, fix crashes with non-C locales + - powertop2tuned: support for powertop 2.2 output + - profiles: progress on replacing scripts with plugins + - tuned-adm: bash completion - suggest profiles from all supported locations + - tuned-adm: complete switch to D-bus + - tuned-adm: full control to users with physical access + +* Mon Oct 08 2012 Jaroslav Škarvada - 2.0.2-1 +- New version +- Systemtap scripts moved to utils-systemtap subpackage + +* Sun Jul 22 2012 Fedora Release Engineering - 2.0.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Jun 12 2012 Jaroslav Škarvada - 2.0.1-3 +- another powertop-2.0 compatibility fix + Resolves: rhbz#830415 + +* Tue Jun 12 2012 Jan Kaluza - 2.0.1-2 +- fixed powertop2tuned compatibility with powertop-2.0 + +* Tue Apr 03 2012 Jaroslav Škarvada - 2.0.1-1 +- new version + +* Fri Mar 30 2012 Jan Vcelak 2.0-1 +- first stable release