From 075bce6d42fa3e877be142310a28df174d967859d2e0074e27b08f683b9b9d62 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Wed, 17 Jul 2019 16:19:48 +0000 Subject: [PATCH 1/2] Accepting request 716097 from home:trenn:branches:hardware - Add intel-speed-select tool (jsc#SLE-5364) A intel-speed-select-1.0.tar.bz2 A intel-speed-select_remove_DATE_TIME.patch - Fix missing governors when running cpupower frequency-info (bsc#1117709) M rapl_monitor.patch OBS-URL: https://build.opensuse.org/request/show/716097 OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=97 --- Makefile.intel-speed-select | 34 +++++++++++++++++++ cpupower.changes | 9 +++++ cpupower.spec | 22 +++++++++++- cpupower_export_tarball_from_git.sh | 32 +++++++++++++++--- cpupower_rapl.patch | 41 +++++++---------------- intel-speed-select-1.0.tar.bz2 | 3 ++ intel-speed-select_remove_DATE_TIME.patch | 12 +++++++ 7 files changed, 119 insertions(+), 34 deletions(-) create mode 100644 Makefile.intel-speed-select create mode 100644 intel-speed-select-1.0.tar.bz2 create mode 100644 intel-speed-select_remove_DATE_TIME.patch diff --git a/Makefile.intel-speed-select b/Makefile.intel-speed-select new file mode 100644 index 0000000..314204c --- /dev/null +++ b/Makefile.intel-speed-select @@ -0,0 +1,34 @@ +bindir ?= /usr/bin + +# Do not use make's built-in rules +# (this improves performance and avoids hard-to-debug behaviour); +MAKEFLAGS += -r + +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I include + +ALL_PROGRAMS := intel-speed-select + +all: $(ALL_PROGRAMS) + +OBJ = isst-config.o isst-core.o isst-display.o + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +intel-speed-select: isst-config.o isst-core.o isst-display.o + $(CC) -o $@ $^ $(CFLAGS) + +clean: + rm -f $(ALL_PROGRAMS) + rm -rf include/linux/isst_if.h + find . -name '*.o' -delete -o -name '\.*.d' -delete + +install: $(ALL_PROGRAMS) + install -d -m 755 $(DESTDIR)$(bindir); \ + for program in $(ALL_PROGRAMS); do \ + install $$program $(DESTDIR)$(bindir); \ + done + +FORCE: + +.PHONY: all install clean diff --git a/cpupower.changes b/cpupower.changes index 69880a1..1361397 100644 --- a/cpupower.changes +++ b/cpupower.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Jul 17 16:01:20 UTC 2019 - trenn@suse.de + +- Add intel-speed-select tool (jsc#SLE-5364) +A intel-speed-select-1.0.tar.bz2 +A intel-speed-select_remove_DATE_TIME.patch +- Fix missing governors when running cpupower frequency-info (bsc#1117709) +M rapl_monitor.patch + ------------------------------------------------------------------- Wed Jun 5 11:38:15 UTC 2019 - trenn@suse.de diff --git a/cpupower.spec b/cpupower.spec index 20bab67..88bbb14 100644 --- a/cpupower.spec +++ b/cpupower.spec @@ -22,6 +22,7 @@ %define tsversion 19.03.20 %define pbversion 17.05.11 +%define ssversion 1.0 Name: cpupower # Use this as version when things are in mainline kernel @@ -36,12 +37,22 @@ Source: %{name}-%{version}.tar.bz2 Source1: turbostat-%{tsversion}.tar.bz2 Source2: cpupower_export_tarball_from_git.sh Source3: x86_energy_perf_policy-%{pbversion}.tar.bz2 +Source4: intel-speed-select-%{ssversion}.tar.bz2 +Source5: Makefile.intel-speed-select Patch1: cpupower_rapl.patch Patch2: rapl_monitor.patch Patch3: cpupower_exclude_kernel_Makefile.patch + +#turbostat patches Patch22: turbostat_makefile_fix_asm_header.patch + +# x86_energy_perf patches # Fixes bsc#1048546: Patch30: x86_perf_makefile_fix_asm_header.patch + +# intel-speed-select patches +Patch50: intel-speed-select_remove_DATE_TIME.patch + BuildRequires: gettext-tools BuildRequires: pciutils BuildRequires: pciutils-devel @@ -79,7 +90,7 @@ For that purpose, it compares the performance governor to a configured powersave module. %prep -%setup -q -D -b 1 -b 3 +%setup -q -D -b 1 -b 3 -b 4 %patch1 -p1 %patch2 -p1 %patch3 -p1 @@ -90,6 +101,10 @@ cd ../turbostat-%{tsversion} cd ../x86_energy_perf_policy-%{pbversion} %patch30 -p1 +cd ../intel-speed-select-%{ssversion} +cp %{SOURCE5} Makefile +%patch50 -p1 + %build CONF="PACKAGE_BUGREPORT=https://bugs.opensuse.org mandir=%{_mandir} libdir=%{_libdir} CPUFRQ_BENCH=true VERSION=%{version}" export CFLAGS="%{optflags} -I ." @@ -101,6 +116,8 @@ export CFLAGS="%{optflags} -I ." make %{?_smp_mflags} cd ../x86_energy_perf_policy-%{pbversion} make %{?_smp_mflags} +cd ../intel-speed-select-%{ssversion} +make %{?_smp_mflags} %endif %install @@ -119,6 +136,8 @@ cd ../turbostat-%{tsversion} %make_install -e cd ../x86_energy_perf_policy-%{pbversion} %make_install +cd ../intel-speed-select-%{ssversion} +%make_install %endif %post -n libcpupower0 -p /sbin/ldconfig @@ -133,6 +152,7 @@ cd ../x86_energy_perf_policy-%{pbversion} %{_bindir}/turbostat %{_mandir}/man8/x86_energy_perf_policy* %{_bindir}/x86_energy_perf_policy +%{_bindir}/intel-speed-select %endif %files bench diff --git a/cpupower_export_tarball_from_git.sh b/cpupower_export_tarball_from_git.sh index 8abea1d..fcb8033 100644 --- a/cpupower_export_tarball_from_git.sh +++ b/cpupower_export_tarball_from_git.sh @@ -9,7 +9,7 @@ VERSION="" TOOL="" function usage(){ - echo "$(basename $0) [ -k git_tag ] [ -v tag_to_use ] -t cpupower | turbostat | x86_perf_bias " + echo "$(basename $0) [ -k git_tag ] [ -v tag_to_use ] -t cpupower | turbostat | x86_perf_bias | intel-speed-select" echo echo "git_tag Must be a valid kernel git tag, for example v3.1" echo " if git_tag is not passed HEAD will be used which" @@ -84,7 +84,7 @@ function export_turbostat() { git archive --format=tar $GIT_TAG tools/power/x86/turbostat |tar -x - if [ "$TURBOSTAT_VERSION"x == ""x ];then + if [ -z "$TURBOSTAT_VERSION" ];then TURBOSTAT_VERSION=$(grep "turbostat version" tools/power/x86/turbostat/turbostat.c |grep fprintf |sed 's/.*turbostat version \([0-9][0-9].[0-9][0-9].[0-9][0-9]\).*/\1/') fi TURBOSTAT_VERSION=$(echo "-$TURBOSTAT_VERSION") @@ -104,7 +104,7 @@ function export_x86_perf_bias() { set -x git archive --format=tar $GIT_TAG tools/power/x86/x86_energy_perf_policy |tar -x - if [ "$PERF_BIAS_VERSION"x == ""x ];then + if [ -z "$PERF_BIAS_VERSION" ];then PERF_BIAS_VERSION=$(grep 'printf("x86_energy_perf_policy .* (C) Len Brown Index: cpupower-5.1/Makefile =================================================================== ---- cpupower-5.1.orig/Makefile 2019-04-08 07:51:09.000000000 +0200 -+++ cpupower-5.1/Makefile 2019-04-08 16:04:14.350451358 +0200 +--- cpupower-5.1.orig/Makefile 2019-05-06 02:42:58.000000000 +0200 ++++ cpupower-5.1/Makefile 2019-07-17 18:05:02.455869697 +0200 @@ -143,7 +143,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/h utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ @@ -78,7 +78,7 @@ Index: cpupower-5.1/Makefile Index: cpupower-5.1/lib/powercap.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/lib/powercap.c 2019-04-08 16:04:14.350451358 +0200 ++++ cpupower-5.1/lib/powercap.c 2019-07-17 18:05:02.455869697 +0200 @@ -0,0 +1,290 @@ +/* + * (C) 2016 Thomas Renninger @@ -373,7 +373,7 @@ Index: cpupower-5.1/lib/powercap.c Index: cpupower-5.1/lib/powercap.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/lib/powercap.h 2019-04-08 16:04:14.350451358 +0200 ++++ cpupower-5.1/lib/powercap.h 2019-07-17 18:05:02.455869697 +0200 @@ -0,0 +1,54 @@ +/* + * (C) 2016 Thomas Renninger @@ -431,8 +431,8 @@ Index: cpupower-5.1/lib/powercap.h +#endif /* __CPUPOWER_RAPL_H__ */ Index: cpupower-5.1/utils/builtin.h =================================================================== ---- cpupower-5.1.orig/utils/builtin.h 2019-04-08 07:51:09.000000000 +0200 -+++ cpupower-5.1/utils/builtin.h 2019-04-08 16:04:14.350451358 +0200 +--- cpupower-5.1.orig/utils/builtin.h 2019-05-06 02:42:58.000000000 +0200 ++++ cpupower-5.1/utils/builtin.h 2019-07-17 18:05:02.455869697 +0200 @@ -8,6 +8,8 @@ extern int cmd_freq_set(int argc, const extern int cmd_freq_info(int argc, const char **argv); extern int cmd_idle_set(int argc, const char **argv); @@ -444,8 +444,8 @@ Index: cpupower-5.1/utils/builtin.h #endif Index: cpupower-5.1/utils/cpupower.c =================================================================== ---- cpupower-5.1.orig/utils/cpupower.c 2019-04-08 07:51:09.000000000 +0200 -+++ cpupower-5.1/utils/cpupower.c 2019-04-08 16:04:14.354451358 +0200 +--- cpupower-5.1.orig/utils/cpupower.c 2019-05-06 02:42:58.000000000 +0200 ++++ cpupower-5.1/utils/cpupower.c 2019-07-17 18:05:02.455869697 +0200 @@ -53,6 +53,7 @@ static struct cmd_struct commands[] = { { "frequency-set", cmd_freq_set, 1 }, { "idle-info", cmd_idle_info, 0 }, @@ -457,7 +457,7 @@ Index: cpupower-5.1/utils/cpupower.c Index: cpupower-5.1/utils/powercap-info.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/utils/powercap-info.c 2019-04-08 16:04:14.354451358 +0200 ++++ cpupower-5.1/utils/powercap-info.c 2019-07-17 18:05:02.455869697 +0200 @@ -0,0 +1,113 @@ +#include +#include @@ -574,8 +574,8 @@ Index: cpupower-5.1/utils/powercap-info.c +} Index: cpupower-5.1/utils/helpers/sysfs.c =================================================================== ---- cpupower-5.1.orig/utils/helpers/sysfs.c 2019-04-08 07:51:09.000000000 +0200 -+++ cpupower-5.1/utils/helpers/sysfs.c 2019-04-08 16:04:14.354451358 +0200 +--- cpupower-5.1.orig/utils/helpers/sysfs.c 2019-05-06 02:42:58.000000000 +0200 ++++ cpupower-5.1/utils/helpers/sysfs.c 2019-07-17 18:06:13.311873515 +0200 @@ -18,7 +18,7 @@ unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) @@ -585,27 +585,10 @@ Index: cpupower-5.1/utils/helpers/sysfs.c ssize_t numread; fd = open(path, O_RDONLY); -@@ -31,6 +31,16 @@ unsigned int sysfs_read_file(const char - return 0; - } - -+ /* -+ * Sigh, sysfs workaround, some do return \0 -+ * -+ */ -+ for (i = 0; i < numread; i++) { -+ if (buf[i] == '\n') { -+ numread = i; -+ break; -+ } -+ } - buf[numread] = '\0'; - close(fd); - Index: cpupower-5.1/man/cpupower-powercap-info.1 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/man/cpupower-powercap-info.1 2019-04-08 16:04:14.354451358 +0200 ++++ cpupower-5.1/man/cpupower-powercap-info.1 2019-07-17 18:05:02.455869697 +0200 @@ -0,0 +1,25 @@ +.TH CPUPOWER\-POWERCAP\-INFO "1" "05/08/2016" "" "cpupower Manual" +.SH NAME diff --git a/intel-speed-select-1.0.tar.bz2 b/intel-speed-select-1.0.tar.bz2 new file mode 100644 index 0000000..de8b14a --- /dev/null +++ b/intel-speed-select-1.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92e83b5a97b64358f1e5c5a0b5e47a2014104a9afd2df1dca7f815a5ff8f7853 +size 16246 diff --git a/intel-speed-select_remove_DATE_TIME.patch b/intel-speed-select_remove_DATE_TIME.patch new file mode 100644 index 0000000..5ba4199 --- /dev/null +++ b/intel-speed-select_remove_DATE_TIME.patch @@ -0,0 +1,12 @@ +Index: intel-speed-select-1.0/isst-config.c +=================================================================== +--- intel-speed-select-1.0.orig/isst-config.c 2019-07-17 00:15:29.000000000 +0200 ++++ intel-speed-select-1.0/isst-config.c 2019-07-17 17:53:30.371832405 +0200 +@@ -1521,7 +1521,6 @@ static void usage(void) + static void print_version(void) + { + fprintf(outf, "Version %s\n", version_str); +- fprintf(outf, "Build date %s time %s\n", __DATE__, __TIME__); + exit(0); + } + From 86456d40c693016cca147339327f154e68d457d0b7dae4d9faf741f8209f6fff Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Thu, 18 Jul 2019 10:09:20 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=98 --- cpupower_rapl.patch | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/cpupower_rapl.patch b/cpupower_rapl.patch index 408a943..29b7e4f 100644 --- a/cpupower_rapl.patch +++ b/cpupower_rapl.patch @@ -28,7 +28,7 @@ Signed-off-by: Thomas Renninger Index: cpupower-5.1/Makefile =================================================================== --- cpupower-5.1.orig/Makefile 2019-05-06 02:42:58.000000000 +0200 -+++ cpupower-5.1/Makefile 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/Makefile 2019-07-18 12:14:08.787390727 +0200 @@ -143,7 +143,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/h utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ @@ -78,7 +78,7 @@ Index: cpupower-5.1/Makefile Index: cpupower-5.1/lib/powercap.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/lib/powercap.c 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/lib/powercap.c 2019-07-18 12:14:08.787390727 +0200 @@ -0,0 +1,290 @@ +/* + * (C) 2016 Thomas Renninger @@ -373,7 +373,7 @@ Index: cpupower-5.1/lib/powercap.c Index: cpupower-5.1/lib/powercap.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/lib/powercap.h 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/lib/powercap.h 2019-07-18 12:14:08.787390727 +0200 @@ -0,0 +1,54 @@ +/* + * (C) 2016 Thomas Renninger @@ -432,7 +432,7 @@ Index: cpupower-5.1/lib/powercap.h Index: cpupower-5.1/utils/builtin.h =================================================================== --- cpupower-5.1.orig/utils/builtin.h 2019-05-06 02:42:58.000000000 +0200 -+++ cpupower-5.1/utils/builtin.h 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/utils/builtin.h 2019-07-18 12:14:08.787390727 +0200 @@ -8,6 +8,8 @@ extern int cmd_freq_set(int argc, const extern int cmd_freq_info(int argc, const char **argv); extern int cmd_idle_set(int argc, const char **argv); @@ -445,7 +445,7 @@ Index: cpupower-5.1/utils/builtin.h Index: cpupower-5.1/utils/cpupower.c =================================================================== --- cpupower-5.1.orig/utils/cpupower.c 2019-05-06 02:42:58.000000000 +0200 -+++ cpupower-5.1/utils/cpupower.c 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/utils/cpupower.c 2019-07-18 12:14:08.787390727 +0200 @@ -53,6 +53,7 @@ static struct cmd_struct commands[] = { { "frequency-set", cmd_freq_set, 1 }, { "idle-info", cmd_idle_info, 0 }, @@ -457,7 +457,7 @@ Index: cpupower-5.1/utils/cpupower.c Index: cpupower-5.1/utils/powercap-info.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/utils/powercap-info.c 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/utils/powercap-info.c 2019-07-18 12:14:08.787390727 +0200 @@ -0,0 +1,113 @@ +#include +#include @@ -572,23 +572,10 @@ Index: cpupower-5.1/utils/powercap-info.c + powercap_show(); + return 0; +} -Index: cpupower-5.1/utils/helpers/sysfs.c -=================================================================== ---- cpupower-5.1.orig/utils/helpers/sysfs.c 2019-05-06 02:42:58.000000000 +0200 -+++ cpupower-5.1/utils/helpers/sysfs.c 2019-07-17 18:06:13.311873515 +0200 -@@ -18,7 +18,7 @@ - - unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) - { -- int fd; -+ int fd, i; - ssize_t numread; - - fd = open(path, O_RDONLY); Index: cpupower-5.1/man/cpupower-powercap-info.1 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-5.1/man/cpupower-powercap-info.1 2019-07-17 18:05:02.455869697 +0200 ++++ cpupower-5.1/man/cpupower-powercap-info.1 2019-07-18 12:14:08.787390727 +0200 @@ -0,0 +1,25 @@ +.TH CPUPOWER\-POWERCAP\-INFO "1" "05/08/2016" "" "cpupower Manual" +.SH NAME