Hello community, here is the log from the commit of package tuned for openSUSE:Factory checked in at 2019-01-26 22:22:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tuned (Old) and /work/SRC/openSUSE:Factory/.tuned.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tuned" Sat Jan 26 22:22:21 2019 rev:19 rq:668631 version:2.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/tuned/tuned.changes 2019-01-05 14:42:13.612486930 +0100 +++ /work/SRC/openSUSE:Factory/.tuned.new.28833/tuned.changes 2019-01-26 22:22:25.454855256 +0100 @@ -1,0 +2,18 @@ +Wed Jan 16 10:47:12 UTC 2019 - [email protected] + +- Differ archs and x86 CPU vendors to avoid wrong warning about a + missing intel tool (x86_energy_perf_bias) +- Remember arch and x86 CPU vendor to allow arch/vendor specific + CPU tunings in the future (fate#326694) +A tuned_differ_x86_and_other_archs_in_cpu_plugin.patch +- Require virt-what to be able to detect whether it is running + on a virtual machine + +------------------------------------------------------------------- +Fri Jan 11 18:26:17 UTC 2019 - [email protected] + +- Update to latest git head commit 26db89de18efad1b4536 + including quite some mainline fixes +- tuned needs polkit daemon running + +------------------------------------------------------------------- New: ---- tuned_differ_x86_and_other_archs_in_cpu_plugin.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tuned.spec ++++++ --- /var/tmp/diff_new_pack.zRoOzC/_old 2019-01-26 22:22:26.574854350 +0100 +++ /var/tmp/diff_new_pack.zRoOzC/_new 2019-01-26 22:22:26.574854350 +0100 @@ -30,6 +30,7 @@ # PATCH-FIX-OPENSUSE fix-allow-receive_sender-default.patch <allow receive_sender="com.redhat.com"/> allow receive_* is normally # not needed as that is the default --<[email protected]> Patch0: fix-allow-receive_sender-default.patch +Patch1: tuned_differ_x86_and_other_archs_in_cpu_plugin.patch BuildRequires: bash-completion BuildRequires: desktop-file-utils BuildRequires: pkgconfig @@ -40,6 +41,7 @@ Requires: ethtool Requires: gawk Requires: hdparm +Requires: polkit Requires: python3-configobj Requires: python3-dbus-python Requires: python3-decorator @@ -47,6 +49,7 @@ Requires: python3-linux-procfs Requires: python3-pyudev Requires: util-linux +Requires: virt-what Obsoletes: pm-profiler BuildArch: noarch %{?systemd_requires} @@ -237,6 +240,7 @@ %{_mandir}/man8/tuned* %dir %{_datadir}/tuned %ghost %dir /run/tuned +%{_prefix}/lib/kernel/install.d/92-tuned.install %files gtk %dir %{_datadir}/icons/hicolor ++++++ _service ++++++ --- /var/tmp/diff_new_pack.zRoOzC/_old 2019-01-26 22:22:26.602854327 +0100 +++ /var/tmp/diff_new_pack.zRoOzC/_new 2019-01-26 22:22:26.606854323 +0100 @@ -6,7 +6,6 @@ <param name="versionformat">2.9.0+git%cd.%h</param> --> <param name="versionformat">2.10.0</param> - <param name="changesgenerate">enable</param> </service> <service name="recompress" mode="disabled"> <param name="file">tuned*.tar</param> ++++++ tuned-2.10.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/92-tuned.install new/tuned-2.10.0/92-tuned.install --- old/tuned-2.10.0/92-tuned.install 1970-01-01 01:00:00.000000000 +0100 +++ new/tuned-2.10.0/92-tuned.install 2019-01-08 15:07:03.000000000 +0100 @@ -0,0 +1,40 @@ +#!/bin/bash + +COMMAND="$1" +KERNEL_VERSION="$2" +BOOT_DIR_ABS="$3" +KERNEL_IMAGE="$4" + +if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then + exit 0 +fi + +MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID + +# with grub2 always /boot +BOOT_ROOT="/boot" +LOADER_ENTRIES="$BOOT_ROOT/loader/entries" + +[ -d "$LOADER_ENTRIES" ] || exit 0 + +[ "$COMMAND" = "add" ] || exit 0 + +# Workaround for rhbz#1657858 +ARCH=`uname -m` +[ "${ARCH:0:4}" = "s390" ] +HANDLE_INITRD="$?" + +pushd "$LOADER_ENTRIES" &> /dev/null +for f in `basename "$MACHINE_ID"`-*.conf; do + if [ -f "$f" -a "${f: -12}" != "-rescue.conf" ]; then + grep -q '^\s*options\s\+.*\$tuned_params' "$f" || sed -i '/^\s*options\s\+/ s/\(.*\)/\1 \$tuned_params/' "$f" + if [ "$HANDLE_INITRD" = "1" ]; then + grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f" + else + sed -i '/^\s*initrd\s\+.*\$tuned_initrd/ s/\s\+\$tuned_initrd\b//g' "$f" + fi + fi +done +popd &> /dev/null + +exit 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/Makefile new/tuned-2.10.0/Makefile --- old/tuned-2.10.0/Makefile 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/Makefile 2019-01-08 15:07:03.000000000 +0100 @@ -40,6 +40,7 @@ ifeq ($(PYTHON_SITELIB),) $(error Failed to determine python library directory) endif +KERNELINSTALLHOOKDIR = /usr/lib/kernel/install.d TUNED_PROFILESDIR = /usr/lib/tuned TUNED_RECOMMEND_DIR = $(TUNED_PROFILESDIR)/recommend.d TUNED_USER_RECOMMEND_DIR = $(SYSCONFDIR)/tuned/recommend.d @@ -59,7 +60,7 @@ cp -a tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \ tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned \ - bootcmdline modules.conf com.redhat.tuned.policy \ + 92-tuned.install bootcmdline modules.conf com.redhat.tuned.policy \ com.redhat.tuned.gui.policy tuned-gui.py tuned-gui.glade \ tuned-gui.desktop $(VERSIONED_NAME) cp -a doc experiments libexec man profiles systemtap tuned contrib icons \ @@ -180,6 +181,9 @@ # grub template install -Dpm 0755 00_tuned $(DESTDIR)$(SYSCONFDIR)/grub.d/00_tuned + # kernel install hook + install -Dpm 0755 92-tuned.install $(DESTDIR)$(KERNELINSTALLHOOKDIR)/92-tuned.install + # polkit configuration install -Dpm 0644 com.redhat.tuned.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/com.redhat.tuned.policy install -Dpm 0644 com.redhat.tuned.gui.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/com.redhat.tuned.gui.policy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/profiles/functions new/tuned-2.10.0/profiles/functions --- old/tuned-2.10.0/profiles/functions 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/profiles/functions 2019-01-08 15:07:03.000000000 +0100 @@ -503,26 +503,29 @@ kvm_modprobe_file=/etc/modprobe.d/kvm.rt.tuned.conf -setup_kvm_mod_low_latency() +teardown_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 + rm -f $kvm_modprobe_file } -teardown_kvm_mod_low_latency() +setup_kvm_mod_low_latency() { - rm -f $kvm_modprobe_file + 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 } # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/profiles/mssql/tuned.conf new/tuned-2.10.0/profiles/mssql/tuned.conf --- old/tuned-2.10.0/profiles/mssql/tuned.conf 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/profiles/mssql/tuned.conf 2019-01-08 15:07:03.000000000 +0100 @@ -6,5 +6,12 @@ summary=Optimize for MS SQL Server include=throughput-performance +[vm] +transparent_hugepage.defrag=always + [sysctl] -vm.max_map_count=262144 +vm.max_map_count=800000 +kernel.numa_balancing=0 +kernel.sched_latency_ns=60000000 +kernel.sched_min_granularity_ns=15000000 +kernel.sched_wakeup_granularity_ns=2000000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned/consts.py new/tuned-2.10.0/tuned/consts.py --- old/tuned-2.10.0/tuned/consts.py 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned/consts.py 2019-01-08 15:07:03.000000000 +0100 @@ -37,6 +37,9 @@ BOOT_CMDLINE_INITRD_ADD_VAR = "TUNED_BOOT_INITRD_ADD" BOOT_CMDLINE_FILE = "/etc/tuned/bootcmdline" PETITBOOT_DETECT_DIR = "/sys/firmware/opal" +MACHINE_ID_FILE = "/etc/machine-id" +KERNEL_UPDATE_HOOK_FILE = "/usr/lib/kernel/install.d/92-tuned.install" +BLS_ENTRIES_PATH = "/boot/loader/entries" # modules plugin configuration MODULES_FILE = "/etc/modprobe.d/tuned.conf" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned/logs.py new/tuned-2.10.0/tuned/logs.py --- old/tuned-2.10.0/tuned/logs.py 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned/logs.py 2019-01-08 15:07:03.000000000 +0100 @@ -30,7 +30,7 @@ chars = string.ascii_letters + string.digits res = "" for i in range(length): - res += random.choice(chars) + res += r.choice(chars) return res def log_capture_start(log_level): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned/plugins/plugin_bootloader.py new/tuned-2.10.0/tuned/plugins/plugin_bootloader.py --- old/tuned-2.10.0/tuned/plugins/plugin_bootloader.py 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned/plugins/plugin_bootloader.py 2019-01-08 15:07:03.000000000 +0100 @@ -94,7 +94,7 @@ def _remove_grub2_tuning(self): if not self._grub2_cfg_file_names: - log.error("cannot find grub.cfg to patch, you need to regenerate it by hand using grub2-mkconfig") + log.info("cannot find grub.cfg to patch") return self._patch_bootcmdline({consts.BOOT_CMDLINE_TUNED_VAR : "", consts.BOOT_CMDLINE_INITRD_ADD_VAR : ""}) for f in self._grub2_cfg_file_names: @@ -107,6 +107,7 @@ if full_rollback: log.info("removing grub2 tuning previously added by Tuned") self._remove_grub2_tuning() + self._update_grubenv({"tuned_params" : "", "tuned_initrd" : ""}) def _grub2_cfg_unpatch(self, grub2_cfg): log.debug("unpatching grub.cfg") @@ -138,7 +139,7 @@ def _grub2_default_env_patch(self): grub2_default_env = self._cmd.read_file(consts.GRUB2_DEFAULT_ENV_FILE) if len(grub2_default_env) <= 0: - log.error("error reading '%s'" % consts.GRUB2_DEFAULT_ENV_FILE) + log.info("cannot read '%s'" % consts.GRUB2_DEFAULT_ENV_FILE) return False d = {"GRUB_CMDLINE_LINUX_DEFAULT" : consts.GRUB2_TUNED_VAR, "GRUB_INITRD_OVERLAY" : consts.GRUB2_TUNED_INITRD_VAR} @@ -157,12 +158,12 @@ def _grub2_cfg_patch(self, d): log.debug("patching grub.cfg") if not self._grub2_cfg_file_names: - log.error("cannot find grub.cfg to patch, you need to regenerate it by hand by grub2-mkconfig") + log.info("cannot find grub.cfg to patch") return False for f in self._grub2_cfg_file_names: grub2_cfg = self._cmd.read_file(f) if len(grub2_cfg) <= 0: - log.error("error patching %s, you need to regenerate it by hand by grub2-mkconfig" % f) + log.info("cannot patch %s" % f) return False log.debug("adding boot command line parameters to '%s'" % f) grub2_cfg_new = grub2_cfg @@ -187,6 +188,37 @@ self._grub2_cfg_patch({consts.GRUB2_TUNED_VAR : self._cmdline_val, consts.GRUB2_TUNED_INITRD_VAR : self._initrd_val}) self._patch_bootcmdline({consts.BOOT_CMDLINE_TUNED_VAR : self._cmdline_val, consts.BOOT_CMDLINE_INITRD_ADD_VAR : self._initrd_val}) + def _has_bls(self): + return os.path.exists(consts.BLS_ENTRIES_PATH) + + def _update_grubenv(self, d): + log.debug("updating grubenv, setting %s" % str(d)); + l = ["%s=%s" % (str(option), str(value)) for option, value in d.items()] + (rc, out) = self._cmd.execute(["grub2-editenv", "-", "set"] + l) + if rc != 0: + log.warn("cannot update grubenv: '%s'" % out) + return False; + return True + + def _bls_entries_patch_initial(self): + machine_id = self._cmd.get_machine_id() + if machine_id == "": + return False + log.debug("running kernel update hook '%s' to patch BLS entries" % consts.KERNEL_UPDATE_HOOK_FILE) + (rc, out) = self._cmd.execute([consts.KERNEL_UPDATE_HOOK_FILE, "add"], env = {"KERNEL_INSTALL_MACHINE_ID" : machine_id}) + if rc != 0: + log.warn("cannot patch BLS entries: '%s'" % out) + return False + return True + + def _bls_update(self): + log.debug("updating BLS") + if self._has_bls() and \ + self._update_grubenv({"tuned_params" : self._cmdline_val, "tuned_initrd" : self._initrd_val}) and \ + self._bls_entries_patch_initial(): + return True + return False + def _init_initrd_dst_img(self, name): if self._initrd_dst_img_val is None: self._initrd_dst_img_val = os.path.join(consts.BOOT_DIR, os.path.basename(name)) @@ -307,4 +339,5 @@ def _instance_post_static(self, instance, enabling): if enabling and self.update_grub2_cfg: self._grub2_update() + self._bls_update() self.update_grub2_cfg = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned/plugins/plugin_scheduler.py new/tuned-2.10.0/tuned/plugins/plugin_scheduler.py --- old/tuned-2.10.0/tuned/plugins/plugin_scheduler.py 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned/plugins/plugin_scheduler.py 2019-01-08 15:07:03.000000000 +0100 @@ -448,7 +448,11 @@ def _thread_code(self, instance): r = self._cmd.re_lookup_compile(instance._sched_lookup) poll = select.poll() - for fd in instance._evlist.get_pollfd(): + # Store the file objects in a local variable so that they don't + # go out of scope too soon. This is a workaround for + # python3-perf bug rhbz#1659445. + fds = instance._evlist.get_pollfd() + for fd in fds: poll.register(fd) while not instance._terminate.is_set(): # timeout to poll in milliseconds diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned/plugins/plugin_vm.py new/tuned-2.10.0/tuned/plugins/plugin_vm.py --- old/tuned-2.10.0/tuned/plugins/plugin_vm.py 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned/plugins/plugin_vm.py 2019-01-08 15:07:03.000000000 +0100 @@ -20,6 +20,7 @@ return { "transparent_hugepages" : None, "transparent_hugepage" : None, + "transparent_hugepage.defrag" : None, } def _instance_init(self, instance): @@ -30,10 +31,11 @@ pass @classmethod - def _thp_file(self): - path = "/sys/kernel/mm/transparent_hugepage/enabled" + def _thp_path(self): + path = "/sys/kernel/mm/transparent_hugepage" if not os.path.exists(path): - path = "/sys/kernel/mm/redhat_transparent_hugepage/enabled" + # RHEL-6 support + path = "/sys/kernel/mm/redhat_transparent_hugepage" return path @command_set("transparent_hugepages") @@ -49,7 +51,7 @@ log.info("transparent_hugepage is already set in kernel boot cmdline, ingoring value from profile") return None - sys_file = self._thp_file() + sys_file = os.path.join(self._thp_path(), "enabled") if os.path.exists(sys_file): if not sim: cmd.write_to_file(sys_file, value) @@ -66,7 +68,7 @@ @command_get("transparent_hugepages") def _get_transparent_hugepages(self): - sys_file = self._thp_file() + sys_file = os.path.join(self._thp_path(), "enabled") if os.path.exists(sys_file): return cmd.get_active_option(cmd.read_file(sys_file)) else: @@ -76,3 +78,23 @@ @command_get("transparent_hugepage") def _get_transparent_hugepage(self): return self._get_transparent_hugepages() + + @command_set("transparent_hugepage.defrag") + def _set_transparent_hugepage_defrag(self, value, sim): + sys_file = os.path.join(self._thp_path(), "defrag") + if os.path.exists(sys_file): + if not sim: + cmd.write_to_file(sys_file, value) + return value + else: + if not sim: + log.warn("Option 'transparent_hugepage.defrag' is not supported on current hardware.") + return None + + @command_get("transparent_hugepage.defrag") + def _get_transparent_hugepage_defrag(self): + sys_file = os.path.join(self._thp_path(), "defrag") + if os.path.exists(sys_file): + return cmd.get_active_option(cmd.read_file(sys_file)) + else: + return None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned/utils/commands.py new/tuned-2.10.0/tuned/utils/commands.py --- old/tuned-2.10.0/tuned/utils/commands.py 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned/utils/commands.py 2019-01-08 15:07:03.000000000 +0100 @@ -25,7 +25,6 @@ class commands: def __init__(self, logging = True): - self._environment = None self._logging = logging def _error(self, msg): @@ -208,21 +207,25 @@ return self.write_to_file(f, data) + # returns machine ID or empty string "" in case of error + def get_machine_id(self, no_error = True): + return self.read_file(consts.MACHINE_ID_FILE, no_error).strip() + # "no_errors" can be list of return codes not treated as errors, if 0 is in no_errors, it means any error # returns (retcode, out), where retcode is exit code of the executed process or -errno if # OSError or IOError exception happened - def execute(self, args, shell = False, cwd = None, no_errors = [], return_err = False): + def execute(self, args, shell = False, cwd = None, env = {}, no_errors = [], return_err = False): retcode = 0 - if self._environment is None: - self._environment = os.environ.copy() - self._environment["LC_ALL"] = "C" + _environment = os.environ.copy() + _environment["LC_ALL"] = "C" + _environment.update(env) self._debug("Executing %s." % str(args)) out = "" err_msg = None try: proc = Popen(args, stdout = PIPE, stderr = PIPE, \ - env = self._environment, \ + env = _environment, \ shell = shell, cwd = cwd, \ close_fds = True, \ universal_newlines = True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tuned-2.10.0/tuned.spec new/tuned-2.10.0/tuned.spec --- old/tuned-2.10.0/tuned.spec 2018-11-21 21:05:19.000000000 +0100 +++ new/tuned-2.10.0/tuned.spec 2019-01-08 15:07:03.000000000 +0100 @@ -278,6 +278,24 @@ if [ -r "%{_sysconfdir}/default/grub" ]; then sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT:+$GRUB_CMDLINE_LINUX_DEFAULT }\\$tuned_params"/d' %{_sysconfdir}/default/grub fi + +# cleanup for Boot loader specification (BLS) + +# clear grubenv variables + grub2-editenv - unset tuned_params tuned_initrd &>/dev/null || : +# unpatch BLS entries + MACHINE_ID=`cat /etc/machine-id 2>/dev/null` + if [ "$MACHINE_ID" ] + then + for f in /boot/loader/entries/$MACHINE_ID-*.conf + do + if [ -f "$f" -a "${f: -12}" != "-rescue.conf" ] + then + sed -i '/^\s*options\s\+.*\$tuned_params/ s/\s\+\$tuned_params\b//g' "$f" &>/dev/null || : + sed -i '/^\s*initrd\s\+.*\$tuned_initrd/ s/\s\+\$tuned_initrd\b//g' "$f" &>/dev/null || : + fi + done + fi fi @@ -359,6 +377,7 @@ %{_datadir}/tuned/grub2 %{_datadir}/polkit-1/actions/com.redhat.tuned.policy %ghost %{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf +%{_prefix}/lib/kernel/install.d/92-tuned.install %files gtk %defattr(-,root,root,-) ++++++ tuned_differ_x86_and_other_archs_in_cpu_plugin.patch ++++++ diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py index 8f0babd..241e157 100644 --- a/tuned/plugins/plugin_cpu.py +++ b/tuned/plugins/plugin_cpu.py @@ -7,6 +7,8 @@ import tuned.consts as consts import os import struct import errno +import platform +import procfs log = tuned.logs.get() @@ -22,7 +24,11 @@ class CPULatencyPlugin(base.Plugin): super(CPULatencyPlugin, self).__init__(*args, **kwargs) self._has_pm_qos = True - self._has_energy_perf_bias = True + self._arch = "x86_64" + self._is_x86 = False + self._is_intel = False + self._is_amd = False + self._has_energy_perf_bias = False self._has_intel_pstate = False self._min_perf_pct_save = None @@ -58,6 +64,33 @@ class CPULatencyPlugin(base.Plugin): "no_turbo" : None, } + def _check_arch(self): + intel_archs = [ "x86_64", "i686", "i585", "i486", "i386" ] + self._arch = platform.machine() + + if self._arch in intel_archs: + # Possible other x86 vendors (from arch/x86/kernel/cpu/*): + # "CentaurHauls", "CyrixInstead", "Geode by NSC", "HygonGenuine", "GenuineTMx86", + # "TransmetaCPU", "UMC UMC UMC" + cpu = procfs.cpuinfo() + vendor = cpu.tags.get("vendor_id") + if vendor is "GenuineIntel": + self._is_intel = True + elif vendor is "AuthenticAMD" or vendor is "HygonGenuine": + self._is_amd = True + else: + # We always assign Intel, unless we know better + self._is_intel = True + log.info("We are running on an x86 %s platform" % vendor) + else: + log.info("We are running on %s (non x86)" % self._arch) + + if self._is_intel is True: + # Check for x86_energy_perf_policy, ignore if not available / supported + self._check_energy_perf_bias() + # Check for intel_pstate + self._check_intel_pstate() + def _check_energy_perf_bias(self): self._has_energy_perf_bias = False retcode_unsupported = 1 @@ -110,10 +143,7 @@ class CPULatencyPlugin(base.Plugin): else: instance._load_monitor = None - # Check for x86_energy_perf_policy, ignore if not available / supported - self._check_energy_perf_bias() - # Check for intel_pstate - self._check_intel_pstate() + self._check_arch() else: instance._first_instance = False log.info("Latency settings from non-first CPU plugin instance '%s' will be ignored." % instance.name)
