From 8d9c29c3ee1e2db694f2e1148ae83bf98f0cc5a2492d88d60f37d6cfae73c370 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Tue, 9 Jan 2018 16:47:36 +0000 Subject: [PATCH] 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 --- cpupower.changes | 10 ++ cpupower.spec | 20 ++- cpupower_export_tarball_from_git.sh | 176 +++++++++++++++++------- x86_energy_perf_policy-17.05.11.tar.bz2 | 3 + x86_perf_fix_man_permissions.patch | 11 ++ x86_perf_makefile_fix_asm_header.patch | 13 ++ 6 files changed, 178 insertions(+), 55 deletions(-) create mode 100644 x86_energy_perf_policy-17.05.11.tar.bz2 create mode 100644 x86_perf_fix_man_permissions.patch create mode 100644 x86_perf_makefile_fix_asm_header.patch diff --git a/cpupower.changes b/cpupower.changes index 9dd3f5f..3e5ecc0 100644 --- a/cpupower.changes +++ b/cpupower.changes @@ -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 diff --git a/cpupower.spec b/cpupower.spec index b5734c9..54fc2e3 100644 --- a/cpupower.spec +++ b/cpupower.spec @@ -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 # # 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 diff --git a/cpupower_export_tarball_from_git.sh b/cpupower_export_tarball_from_git.sh index c3d95ea..dfa4be2 100644 --- a/cpupower_export_tarball_from_git.sh +++ b/cpupower_export_tarball_from_git.sh @@ -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