SHA256
1
0
forked from pool/cpupower

Accepting request 716264 from 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/716264
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cpupower?expand=0&rev=42
This commit is contained in:
Dominique Leuenberger 2019-07-21 09:33:23 +00:00 committed by Git OBS Bridge
commit 0ec1a92ffb
7 changed files with 117 additions and 45 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <len.brown@intel.com' tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c |sed 's/.*x86_energy_perf_policy \([0-9][0-9].[0-9][0-9].[0-9][0-9]\).*/\1/')
fi
PERF_BIAS_VERSION=$(echo "-$PERF_BIAS_VERSION")
@ -119,6 +119,26 @@ set +x
}
function export_intel-speed-select {
set -x
git archive --format=tar $GIT_TAG tools/power/x86/intel-speed-select |tar -x
if [ -z "$SPEED_SELECT_VERSION" ];then
SPEED_SELECT_VERSION=$(sed -n -e 's#static const char \*version_str = "v\(.*\)";#\1#p' tools/power/x86/intel-speed-select/isst-config.c)
fi
SPEED_SELECT_VERSION=$(echo "-$SPEED_SELECT_VERSION")
mv tools/power/x86/intel-speed-select intel-speed-select${SPEED_SELECT_VERSION}
set +x
git checkout $GIT_TAG include/uapi/linux/isst_if.h
mkdir -p intel-speed-select${SPEED_SELECT_VERSION}/include/linux
cp include/uapi/linux/isst_if.h intel-speed-select${SPEED_SELECT_VERSION}/include/linux
tar -cvjf intel-speed-select${SPEED_SELECT_VERSION}.tar.bz2 intel-speed-select${SPEED_SELECT_VERSION}
popd
mv "$DIR/intel-speed-select${SPEED_SELECT_VERSION}".tar.bz2 .
echo intel-speed-select${SPEED_SELECT_VERSION}.tar.bz2
}
parse_args $*
DIR=`mktemp -d`
@ -138,8 +158,12 @@ case $TOOL in
x86_perf_bias)
export_x86_perf_bias
;;
intel-speed-select)
set -x
export_intel-speed-select
;;
*)
echo "You have to provide the tool you want to export cpupower|turbostat|x86_energy_perf_bias"
echo "You have to provide the tool you want to export cpupower|turbostat|x86_energy_perf_bias|intel-speed-select"
usage
rm -rf "$DIR"
exit 1

View File

@ -27,8 +27,8 @@ Signed-off-by: Thomas Renninger <trenn@suse.com>
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-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-04-08 16:04:14.350451358 +0200
+++ cpupower-5.1/lib/powercap.c 2019-07-18 12:14:08.787390727 +0200
@@ -0,0 +1,290 @@
+/*
+ * (C) 2016 Thomas Renninger <trenn@suse.com>
@ -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-18 12:14:08.787390727 +0200
@@ -0,0 +1,54 @@
+/*
+ * (C) 2016 Thomas Renninger <trenn@suse.com>
@ -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-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);
@ -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-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-04-08 16:04:14.354451358 +0200
+++ cpupower-5.1/utils/powercap-info.c 2019-07-18 12:14:08.787390727 +0200
@@ -0,0 +1,113 @@
+#include <unistd.h>
+#include <stdio.h>
@ -572,40 +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-04-08 07:51:09.000000000 +0200
+++ cpupower-5.1/utils/helpers/sysfs.c 2019-04-08 16:04:14.354451358 +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);
@@ -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-18 12:14:08.787390727 +0200
@@ -0,0 +1,25 @@
+.TH CPUPOWER\-POWERCAP\-INFO "1" "05/08/2016" "" "cpupower Manual"
+.SH NAME

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92e83b5a97b64358f1e5c5a0b5e47a2014104a9afd2df1dca7f815a5ff8f7853
size 16246

View File

@ -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);
}