SHA256
1
0
forked from pool/cpupower

Accepting request 563085 from home:trenn:branches:hardware

- Add x86_energy_perf_bias tool
  This is a tool which is, same as turbostat, located in kernel sources here:
  tools/power/x86/
A x86_energy_perf_policy-17.05.11.tar.bz2
A x86_perf_fix_man_permissions.patch
A x86_perf_makefile_fix_asm_header.patch

OBS-URL: https://build.opensuse.org/request/show/563085
OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=77
This commit is contained in:
Thomas Renninger 2018-01-09 16:47:36 +00:00 committed by Git OBS Bridge
parent e6872a969d
commit 8d9c29c3ee
6 changed files with 178 additions and 55 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Jan 9 16:07:07 UTC 2018 - trenn@suse.de
- Add x86_energy_perf_bias tool
This is a tool which is, same as turbostat, located in kernel sources here:
tools/power/x86/
A x86_energy_perf_policy-17.05.11.tar.bz2
A x86_perf_fix_man_permissions.patch
A x86_perf_makefile_fix_asm_header.patch
-------------------------------------------------------------------
Fri Oct 20 15:09:15 UTC 2017 - trenn@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package cpupower
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Author: Thomas Renninger <trenn@suse.de>
#
# All modifications and additions to the file contributed by third parties
@ -23,6 +23,7 @@ Name: cpupower
Version: 4.11
Release: 0
%define tsversion 17.04.12
%define pbversion 17.05.11
Summary: Tools to determine and set CPU Power related Settings
License: GPL-2.0
Group: System/Base
@ -30,6 +31,7 @@ Url: https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git
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
Patch1: cpupower_rapl.patch
Patch2: rapl_monitor.patch
@ -38,6 +40,10 @@ Patch20: turbostat_fix_man_perm.patch
Patch22: turbostat_makefile_fix_asm_header.patch
# Fixes bsc#1048546:
Patch23: turbostat_decode_MSR_IA32_MISC_ENABLE_only_on_Intel.patch
Patch30: x86_perf_makefile_fix_asm_header.patch
Patch31: x86_perf_fix_man_permissions.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: gettext-tools
BuildRequires: pciutils
@ -81,7 +87,7 @@ For that purpose, it compares the performance governor to a configured
powersave module.
%prep
%setup -D -b 1
%setup -D -b 1 -b 3
%patch1 -p1
%patch2 -p1
cd ../turbostat-%tsversion
@ -89,6 +95,10 @@ cd ../turbostat-%tsversion
%patch22 -p1
%patch23 -p1
cd ../x86_energy_perf_policy-%{pbversion}
%patch30 -p1
%patch31 -p1
%build
# This package failed when testing with -Wl,-as-needed being default.
# So we disable it here, if you want to retest, just delete this comment and the line below.
@ -101,6 +111,8 @@ make $CONF %{?_smp_mflags}
cd ../turbostat-%tsversion
export CFLAGS="%optflags -I ."
make %{?_smp_mflags}
cd ../x86_energy_perf_policy-%{pbversion}
make %{?_smp_mflags}
%endif
%install
@ -116,6 +128,8 @@ mv %buildroot//%_docdir/%name/cpufreq-bench_script.sh %buildroot/%_docdir/%name/
%ifarch ix86 x86_64
cd ../turbostat-%tsversion
%make_install -e
cd ../x86_energy_perf_policy-%{pbversion}
%make_install
%endif
%post -n libcpupower0 -p /sbin/ldconfig
@ -129,6 +143,8 @@ cd ../turbostat-%tsversion
%ifarch ix86 x86_64
%_mandir/man8/turbostat*
%_bindir/turbostat
%_mandir/man8/x86_energy_perf_policy*
%_bindir/x86_energy_perf_policy
%endif
%files bench

View File

@ -4,8 +4,11 @@
# This code is covered and distributed under
# the General Public Licence v2
GIT_TAG=HEAD
VERSION=""
function usage(){
echo "$(basename $0) [ git_tag [ tag_to_use ] ]"
echo "$(basename $0) [ -k git_tag ] [ -v tag_to_use ] -t cpupower | turbostat | x86_perf_bias "
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"
@ -18,61 +21,128 @@ function usage(){
echo "export GIT_DIR= environment variable if the git repo is not the current directory"
echo "For example: GIT_DIR=/path_to_git_repo/.git"
}
set -x
if [ $# -gt 0 ];then
if [ "$1" = "-h" ] || [ "$1" == "--help" ];then
usage
exit 0
fi
GIT_TAG="$1"
function parse_args()
{
while getopts hv:k:t: name ; do
case $name in
v)
VERSION="$OPTARG"
;;
k)
GIT_TAG="$OPTARG"
;;
t)
TOOL="$OPTARG"
;;
?|h)
usage
exit 1
;;
esac
done
shift $(($OPTIND -1))
}
function export_cpupower() {
echo "Exporting cpupower from kernel version $GIT_TAG"
# convert - to . as package versions do not allow -
if [ $# -eq 1 ];then
VERSION="${GIT_TAG/-/.}"
# remove leading v
VERSION="-${VERSION#v}"
elif [ $# -eq 2 ];then
VERSION="${2/-/.}"
# remove leading v
VERSION="-${VERSION#v}"
elif [ $# -gt 2 ];then
usage
exit 1
if [ "$VERSION" = "" ];then
# convert - to . as package versions do not allow -
if [ $# -eq 1 ];then
VERSION="${GIT_TAG/-/.}"
# remove leading v
VERSION="-${VERSION#v}"
elif [ $# -eq 2 ];then
VERSION="${2/-/.}"
# remove leading v
VERSION="-${VERSION#v}"
elif [ $# -gt 2 ];then
usage
exit 1
fi
fi
else
GIT_TAG="HEAD"
VERSION=""
fi
# Tried to do this with one git archive command, but
# --remote= param seem not to be configured for kernel.org gits
# Tried to do this with one git archive command, but
# --remote= param seem not to be configured for kernel.org gits
git archive --format=tar $GIT_TAG tools/power/cpupower |tar -x
pushd "$DIR"
mv tools/power/cpupower cpupower${VERSION}
tar -cvjf cpupower${VERSION}.tar.bz2 cpupower${VERSION}
popd
mv "$DIR/cpupower${VERSION}".tar.bz2 .
echo cpupower${VERSION}.tar.bz2
}
function export_turbostat() {
git archive --format=tar $GIT_TAG tools/power/x86/turbostat |tar -x
pushd "$DIR"
if [ "$TURBOSTAT_VERSION"x == ""x ];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")
mv tools/power/x86/turbostat turbostat${TURBOSTAT_VERSION}
git checkout $GIT_TAG arch/x86/include/asm/msr-index.h
git checkout $GIT_TAG arch/x86/include/asm/intel-family.h
cp arch/x86/include/asm/intel-family.h turbostat${TURBOSTAT_VERSION}
cp arch/x86/include/asm/msr-index.h turbostat${TURBOSTAT_VERSION}
tar -cvjf turbostat${TURBOSTAT_VERSION}.tar.bz2 turbostat${TURBOSTAT_VERSION}
popd
mv "$DIR/turbostat${TURBOSTAT_VERSION}".tar.bz2 .
echo turbostat${TURBOSTAT_VERSION}.tar.bz2
}
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
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")
mv tools/power/x86/x86_energy_perf_policy x86_energy_perf_policy${PERF_BIAS_VERSION}
set +x
git checkout $GIT_TAG arch/x86/include/asm/msr-index.h
cp arch/x86/include/asm/msr-index.h x86_energy_perf_policy${PERF_BIAS_VERSION}
tar -cvjf x86_energy_perf_policy${PERF_BIAS_VERSION}.tar.bz2 x86_energy_perf_policy${PERF_BIAS_VERSION}
popd
mv "$DIR/x86_energy_perf_policy${PERF_BIAS_VERSION}".tar.bz2 .
echo x86_energy_perf_policy${PERF_BIAS_VERSION}.tar.bz2
}
parse_args $*
# set -x
DIR=`mktemp -d`
pushd "$DIR"
git archive --format=tar $GIT_TAG tools/power/cpupower |tar -x
mv tools/power/cpupower cpupower${VERSION}
tar -cvjf cpupower${VERSION}.tar.bz2 cpupower${VERSION}
popd
TDIR=`mktemp -d`
pushd "$TDIR"
git archive --format=tar $GIT_TAG tools/power/x86/turbostat |tar -x
if [ "$TURBOSTAT_VERSION"x == ""x ];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/')
pushd $DIR
TOOL="$1"
if [ "$GIT_DIR" = "" ];then
export GIT_DIR=/archteam/trenn/git/linux-2.6/.git
fi
TURBOSTAT_VERSION=$(echo "-$TURBOSTAT_VERSION")
mv tools/power/x86/turbostat turbostat${TURBOSTAT_VERSION}
git checkout $GIT_TAG arch/x86/include/asm/msr-index.h
git checkout $GIT_TAG arch/x86/include/asm/intel-family.h
cp arch/x86/include/asm/intel-family.h turbostat${TURBOSTAT_VERSION}
cp arch/x86/include/asm/msr-index.h turbostat${TURBOSTAT_VERSION}
tar -cvjf turbostat${TURBOSTAT_VERSION}.tar.bz2 turbostat${TURBOSTAT_VERSION}
popd
mv "$DIR/cpupower${VERSION}".tar.bz2 .
rm -rf "$DIR"
mv "$TDIR/turbostat${TURBOSTAT_VERSION}".tar.bz2 .
rm -rf "$TDIR"
# set +x
echo cpupower${VERSION}.tar.bz2
echo turbostat${TURBOSTAT_VERSION}.tar.bz2
case $TOOL in
cpupower)
export_cpupower
;;
turbostat)
export_turbostat
;;
x86_perf_bias)
export_x86_perf_bias
;;
*)
echo "You have to provide the tool you want to export cpupower|turbostat|x86_energy_perf_bias"
usage
rm -rf "$DIR"
exit 1
;;
esac
#rm -rf "$DIR"

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5237f2407c9bff1d9b4a3e516a0a7b877aeb48ad1ffeddb59070565711e55a49
size 17578

View File

@ -0,0 +1,11 @@
Index: x86_energy_perf_policy-17.05.11/Makefile
===================================================================
--- x86_energy_perf_policy-17.05.11.orig/Makefile 2018-01-09 16:59:12.831811429 +0100
+++ x86_energy_perf_policy-17.05.11/Makefile 2018-01-09 16:59:33.133035858 +0100
@@ -24,5 +24,5 @@ install : x86_energy_perf_policy
install -d $(DESTDIR)$(PREFIX)/bin
install $(BUILD_OUTPUT)/x86_energy_perf_policy $(DESTDIR)$(PREFIX)/bin/x86_energy_perf_policy
install -d $(DESTDIR)$(PREFIX)/share/man/man8
- install x86_energy_perf_policy.8 $(DESTDIR)$(PREFIX)/share/man/man8
+ install -m 644 x86_energy_perf_policy.8 $(DESTDIR)$(PREFIX)/share/man/man8

View File

@ -0,0 +1,13 @@
Index: x86_energy_perf_policy-17.05.11/Makefile
===================================================================
--- x86_energy_perf_policy-17.05.11.orig/Makefile 2017-12-21 01:52:01.000000000 +0100
+++ x86_energy_perf_policy-17.05.11/Makefile 2018-01-09 16:17:56.058472491 +0100
@@ -10,7 +10,7 @@ endif
x86_energy_perf_policy : x86_energy_perf_policy.c
CFLAGS += -Wall
-CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
+CFLAGS += -DMSRHEADER='"msr-index.h"'
%: %.c
@mkdir -p $(BUILD_OUTPUT)