Hello community, here is the log from the commit of package cpupower for openSUSE:Factory checked in at 2018-01-13 21:48:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cpupower (Old) and /work/SRC/openSUSE:Factory/.cpupower.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cpupower" Sat Jan 13 21:48:05 2018 rev:35 rq:563663 version:4.15 Changes: -------- --- /work/SRC/openSUSE:Factory/cpupower/cpupower.changes 2018-01-10 23:36:49.299368036 +0100 +++ /work/SRC/openSUSE:Factory/.cpupower.new/cpupower.changes 2018-01-13 21:48:06.792772095 +0100 @@ -1,0 +2,12 @@ +Thu Jan 11 16:00:56 UTC 2018 - [email protected] + +- Update cpupower to latest kernel version (version name 4.15, but + checked out against latest kernel tag 4.15-rc7. There will not + be important changes any more, maybe a fix). +- cpu online/offline fixes +- This is the first cpupower package (with updated version) which + includes x86_energy_perf_policy binary. + This is important for later package dependencies, namely tuned. +A cpupower_exclude_kernel_Makefile.patch + +------------------------------------------------------------------- Old: ---- cpupower-4.11.tar.bz2 New: ---- cpupower-4.15.tar.bz2 cpupower_exclude_kernel_Makefile.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cpupower.spec ++++++ --- /var/tmp/diff_new_pack.wIoK60/_old 2018-01-13 21:48:07.976716898 +0100 +++ /var/tmp/diff_new_pack.wIoK60/_new 2018-01-13 21:48:07.980716712 +0100 @@ -20,7 +20,7 @@ Name: cpupower # Use this as version when things are in mainline kernel %define version %(rpm -q --qf '%VERSION' kernel-source) -Version: 4.11 +Version: 4.15 Release: 0 %define tsversion 17.04.12 %define pbversion 17.05.11 @@ -35,6 +35,7 @@ Patch1: cpupower_rapl.patch Patch2: rapl_monitor.patch +Patch3: cpupower_exclude_kernel_Makefile.patch Patch20: turbostat_fix_man_perm.patch Patch22: turbostat_makefile_fix_asm_header.patch @@ -90,6 +91,8 @@ %setup -D -b 1 -b 3 %patch1 -p1 %patch2 -p1 +%patch3 -p1 + cd ../turbostat-%tsversion %patch20 -p1 %patch22 -p1 @@ -103,7 +106,7 @@ # 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. export SUSE_ASNEEDED=0 -CONF="PACKAGE_BUGREPORT=http://bugs.opensuse.org mandir=%_mandir libdir=%_libdir CPUFRQ_BENCH=true STRIP=true VERSION=%version" +CONF="PACKAGE_BUGREPORT=http://bugs.opensuse.org mandir=%_mandir libdir=%_libdir CPUFRQ_BENCH=true VERSION=%version" export CFLAGS="%optflags -I ." make $CONF %{?_smp_mflags} ++++++ cpupower-4.11.tar.bz2 -> cpupower-4.15.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/.gitignore new/cpupower-4.15/.gitignore --- old/cpupower-4.11/.gitignore 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/.gitignore 2018-01-10 20:18:31.000000000 +0100 @@ -1,7 +1,6 @@ .libs libcpupower.so -libcpupower.so.0 -libcpupower.so.0.0.0 +libcpupower.so.* build/ccdv cpufreq-info cpufreq-set diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/Makefile new/cpupower-4.15/Makefile --- old/cpupower-4.11/Makefile 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/Makefile 2018-01-10 20:18:31.000000000 +0100 @@ -26,10 +26,12 @@ ifneq ($(OUTPUT),) # check that the output directory actually exists -OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) +OUTDIR := $(shell cd $(OUTPUT) && pwd) $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) endif +include ../../scripts/Makefile.arch + # --- CONFIGURATION BEGIN --- # Set the following to `true' to make a unstripped, unoptimized @@ -79,7 +81,11 @@ sbindir ?= /usr/sbin mandir ?= /usr/man includedir ?= /usr/include +ifeq ($(IS_64_BIT), 1) +libdir ?= /usr/lib64 +else libdir ?= /usr/lib +endif localedir ?= /usr/share/locale docdir ?= /usr/share/doc/packages/cpupower confdir ?= /etc/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/bench/Makefile new/cpupower-4.15/bench/Makefile --- old/cpupower-4.11/bench/Makefile 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/bench/Makefile 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 OUTPUT := ./ ifeq ("$(origin O)", "command line") ifneq ($(O),) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/bench/system.c new/cpupower-4.15/bench/system.c --- old/cpupower-4.11/bench/system.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/bench/system.c 2018-01-10 20:18:31.000000000 +0100 @@ -61,7 +61,7 @@ dprintf("set %s as cpufreq governor\n", governor); - if (cpupower_is_cpu_online(cpu) != 0) { + if (cpupower_is_cpu_online(cpu) != 1) { perror("cpufreq_cpu_exists"); fprintf(stderr, "error: cpu %u does not exist\n", cpu); return -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/debug/i386/Makefile new/cpupower-4.15/debug/i386/Makefile --- old/cpupower-4.11/debug/i386/Makefile 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/debug/i386/Makefile 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 OUTPUT=./ ifeq ("$(origin O)", "command line") OUTPUT := $(O)/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/debug/kernel/Makefile new/cpupower-4.15/debug/kernel/Makefile --- old/cpupower-4.11/debug/kernel/Makefile 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/debug/kernel/Makefile 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 obj-m := KDIR := /lib/modules/$(shell uname -r)/build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/debug/x86_64/Makefile new/cpupower-4.15/debug/x86_64/Makefile --- old/cpupower-4.11/debug/x86_64/Makefile 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/debug/x86_64/Makefile 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 OUTPUT=./ ifeq ("$(origin O)", "command line") OUTPUT := $(O)/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/lib/cpuidle.h new/cpupower-4.15/lib/cpuidle.h --- old/cpupower-4.11/lib/cpuidle.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/lib/cpuidle.h 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CPUPOWER_CPUIDLE_H__ #define __CPUPOWER_CPUIDLE_H__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/lib/cpupower.h new/cpupower-4.15/lib/cpupower.h --- old/cpupower-4.11/lib/cpupower.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/lib/cpupower.h 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CPUPOWER_CPUPOWER_H__ #define __CPUPOWER_CPUPOWER_H__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/lib/cpupower_intern.h new/cpupower-4.15/lib/cpupower_intern.h --- old/cpupower-4.11/lib/cpupower_intern.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/lib/cpupower_intern.h 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #define PATH_TO_CPU "/sys/devices/system/cpu/" #define MAX_LINE_LEN 4096 #define SYSFS_PATH_MAX 255 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/builtin.h new/cpupower-4.15/utils/builtin.h --- old/cpupower-4.11/utils/builtin.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/builtin.h 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef BUILTIN_H #define BUILTIN_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/cpufreq-info.c new/cpupower-4.15/utils/cpufreq-info.c --- old/cpupower-4.11/utils/cpufreq-info.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/cpufreq-info.c 2018-01-10 20:18:31.000000000 +0100 @@ -93,8 +93,6 @@ if (speed > 1000000) printf("%u.%06u GHz", ((unsigned int) speed/1000000), ((unsigned int) speed%1000000)); - else if (speed > 100000) - printf("%u MHz", (unsigned int) speed); else if (speed > 1000) printf("%u.%03u MHz", ((unsigned int) speed/1000), (unsigned int) (speed%1000)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/cpuidle-set.c new/cpupower-4.15/utils/cpuidle-set.c --- old/cpupower-4.11/utils/cpuidle-set.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/cpuidle-set.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <unistd.h> #include <stdio.h> #include <errno.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/cpupower.c new/cpupower-4.15/utils/cpupower.c --- old/cpupower-4.11/utils/cpupower.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/cpupower.c 2018-01-10 20:18:31.000000000 +0100 @@ -12,6 +12,7 @@ #include <string.h> #include <unistd.h> #include <errno.h> +#include <sched.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/utsname.h> @@ -31,6 +32,7 @@ */ struct cpupower_cpu_info cpupower_cpu_info; int run_as_root; +int base_cpu; /* Affected cpus chosen by -c/--cpu param */ struct bitmask *cpus_chosen; @@ -174,6 +176,7 @@ unsigned int i, ret; struct stat statbuf; struct utsname uts; + char pathname[32]; cpus_chosen = bitmask_alloc(sysconf(_SC_NPROCESSORS_CONF)); @@ -198,17 +201,23 @@ argv[0] = cmd = "help"; } - get_cpu_info(0, &cpupower_cpu_info); + base_cpu = sched_getcpu(); + if (base_cpu < 0) { + fprintf(stderr, _("No valid cpus found.\n")); + return EXIT_FAILURE; + } + + get_cpu_info(&cpupower_cpu_info); run_as_root = !geteuid(); if (run_as_root) { ret = uname(&uts); + sprintf(pathname, "/dev/cpu/%d/msr", base_cpu); if (!ret && !strcmp(uts.machine, "x86_64") && - stat("/dev/cpu/0/msr", &statbuf) != 0) { + stat(pathname, &statbuf) != 0) { if (system("modprobe msr") == -1) fprintf(stderr, _("MSR access not available.\n")); } } - for (i = 0; i < ARRAY_SIZE(commands); i++) { struct cmd_struct *p = commands + i; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/amd.c new/cpupower-4.15/utils/helpers/amd.c --- old/cpupower-4.11/utils/helpers/amd.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/amd.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #if defined(__i386__) || defined(__x86_64__) #include <unistd.h> #include <errno.h> @@ -26,6 +27,15 @@ unsigned res3:21; unsigned en:1; } bits; + struct { + unsigned fid:8; + unsigned did:6; + unsigned vid:8; + unsigned iddval:8; + unsigned idddiv:2; + unsigned res1:30; + unsigned en:1; + } fam17h_bits; unsigned long long val; }; @@ -35,6 +45,8 @@ if (family == 0x12) t = pstate.val & 0xf; + else if (family == 0x17) + t = pstate.fam17h_bits.did; else t = pstate.bits.did; @@ -44,16 +56,20 @@ static int get_cof(int family, union msr_pstate pstate) { int t; - int fid, did; + int fid, did, cof; did = get_did(family, pstate); - - t = 0x10; - fid = pstate.bits.fid; - if (family == 0x11) - t = 0x8; - - return (100 * (fid + t)) >> did; + if (family == 0x17) { + fid = pstate.fam17h_bits.fid; + cof = 200 * fid / did; + } else { + t = 0x10; + fid = pstate.bits.fid; + if (family == 0x11) + t = 0x8; + cof = (100 * (fid + t)) >> did; + } + return cof; } /* Needs: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/bitmask.c new/cpupower-4.15/utils/helpers/bitmask.c --- old/cpupower-4.11/utils/helpers/bitmask.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/bitmask.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <string.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/bitmask.h new/cpupower-4.15/utils/helpers/bitmask.h --- old/cpupower-4.11/utils/helpers/bitmask.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/bitmask.h 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CPUPOWER_BITMASK__ #define __CPUPOWER_BITMASK__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/cpuid.c new/cpupower-4.15/utils/helpers/cpuid.c --- old/cpupower-4.11/utils/helpers/cpuid.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/cpuid.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <errno.h> #include <string.h> @@ -42,7 +43,7 @@ * * TBD: Should there be a cpuid alternative for this if /proc is not mounted? */ -int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info) +int get_cpu_info(struct cpupower_cpu_info *cpu_info) { FILE *fp; char value[64]; @@ -70,7 +71,7 @@ if (!strncmp(value, "processor\t: ", 12)) sscanf(value, "processor\t: %u", &proc); - if (proc != cpu) + if (proc != (unsigned int)base_cpu) continue; /* Get CPU vendor */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/helpers.h new/cpupower-4.15/utils/helpers/helpers.h --- old/cpupower-4.11/utils/helpers/helpers.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/helpers.h 2018-01-10 20:18:31.000000000 +0100 @@ -34,6 +34,7 @@ /* Internationalization ****************************/ extern int run_as_root; +extern int base_cpu; extern struct bitmask *cpus_chosen; /* Global verbose (-d) stuff *********************************/ @@ -70,6 +71,8 @@ #define CPUPOWER_CAP_IS_SNB 0x00000020 #define CPUPOWER_CAP_INTEL_IDA 0x00000040 +#define CPUPOWER_AMD_CPBDIS 0x02000000 + #define MAX_HW_PSTATES 10 struct cpupower_cpu_info { @@ -85,11 +88,11 @@ * * Extract CPU vendor, family, model, stepping info from /proc/cpuinfo * - * Returns 0 on success or a negativ error code + * Returns 0 on success or a negative error code * Only used on x86, below global's struct values are zero/unknown on * other archs */ -extern int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info); +extern int get_cpu_info(struct cpupower_cpu_info *cpu_info); extern struct cpupower_cpu_info cpupower_cpu_info; /* cpuid and cpuinfo helpers **************************/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/misc.c new/cpupower-4.15/utils/helpers/misc.c --- old/cpupower-4.11/utils/helpers/misc.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/misc.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,25 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 #if defined(__i386__) || defined(__x86_64__) #include "helpers/helpers.h" +#define MSR_AMD_HWCR 0xc0010015 + int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int *states) { struct cpupower_cpu_info cpu_info; int ret; + unsigned long long val; *support = *active = *states = 0; - ret = get_cpu_info(0, &cpu_info); + ret = get_cpu_info(&cpu_info); if (ret) return ret; if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) { *support = 1; - amd_pci_get_num_boost_states(active, states); - if (ret <= 0) - return ret; - *support = 1; + + /* AMD Family 0x17 does not utilize PCI D18F4 like prior + * families and has no fixed discrete boost states but + * has Hardware determined variable increments instead. + */ + + if (cpu_info.family == 0x17) { + if (!read_msr(cpu, MSR_AMD_HWCR, &val)) { + if (!(val & CPUPOWER_AMD_CPBDIS)) + *active = 1; + } + } else { + ret = amd_pci_get_num_boost_states(active, states); + if (ret) + return ret; + } } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) *support = *active = 1; return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/msr.c new/cpupower-4.15/utils/helpers/msr.c --- old/cpupower-4.11/utils/helpers/msr.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/msr.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #if defined(__i386__) || defined(__x86_64__) #include <fcntl.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/pci.c new/cpupower-4.15/utils/helpers/pci.c --- old/cpupower-4.11/utils/helpers/pci.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/pci.c 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #if defined(__i386__) || defined(__x86_64__) #include <helpers/helpers.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/helpers/sysfs.h new/cpupower-4.15/utils/helpers/sysfs.h --- old/cpupower-4.11/utils/helpers/sysfs.h 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/helpers/sysfs.h 2018-01-10 20:18:31.000000000 +0100 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CPUPOWER_HELPERS_SYSFS_H__ #define __CPUPOWER_HELPERS_SYSFS_H__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/idle_monitor/cpuidle_sysfs.c new/cpupower-4.15/utils/idle_monitor/cpuidle_sysfs.c --- old/cpupower-4.11/utils/idle_monitor/cpuidle_sysfs.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/idle_monitor/cpuidle_sysfs.c 2018-01-10 20:18:31.000000000 +0100 @@ -130,15 +130,18 @@ { int num; char *tmp; + int this_cpu; + + this_cpu = sched_getcpu(); /* Assume idle state count is the same for all CPUs */ - cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(0); + cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(this_cpu); if (cpuidle_sysfs_monitor.hw_states_num <= 0) return NULL; for (num = 0; num < cpuidle_sysfs_monitor.hw_states_num; num++) { - tmp = cpuidle_state_name(0, num); + tmp = cpuidle_state_name(this_cpu, num); if (tmp == NULL) continue; @@ -146,7 +149,7 @@ strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1); free(tmp); - tmp = cpuidle_state_desc(0, num); + tmp = cpuidle_state_desc(this_cpu, num); if (tmp == NULL) continue; strncpy(cpuidle_cstates[num].desc, tmp, CSTATE_DESC_LEN - 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/idle_monitor/hsw_ext_idle.c new/cpupower-4.15/utils/idle_monitor/hsw_ext_idle.c --- old/cpupower-4.11/utils/idle_monitor/hsw_ext_idle.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/idle_monitor/hsw_ext_idle.c 2018-01-10 20:18:31.000000000 +0100 @@ -123,7 +123,7 @@ previous_count[num][cpu] = val; } } - hsw_ext_get_count(TSC, &tsc_at_measure_start, 0); + hsw_ext_get_count(TSC, &tsc_at_measure_start, base_cpu); return 0; } @@ -132,7 +132,7 @@ unsigned long long val; int num, cpu; - hsw_ext_get_count(TSC, &tsc_at_measure_end, 0); + hsw_ext_get_count(TSC, &tsc_at_measure_end, base_cpu); for (num = 0; num < HSW_EXT_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/idle_monitor/mperf_monitor.c new/cpupower-4.15/utils/idle_monitor/mperf_monitor.c --- old/cpupower-4.11/utils/idle_monitor/mperf_monitor.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/idle_monitor/mperf_monitor.c 2018-01-10 20:18:31.000000000 +0100 @@ -80,7 +80,8 @@ static int mperf_get_tsc(unsigned long long *tsc) { int ret; - ret = read_msr(0, MSR_TSC, tsc); + + ret = read_msr(base_cpu, MSR_TSC, tsc); if (ret) dprint("Reading TSC MSR failed, returning %llu\n", *tsc); return ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/idle_monitor/nhm_idle.c new/cpupower-4.15/utils/idle_monitor/nhm_idle.c --- old/cpupower-4.11/utils/idle_monitor/nhm_idle.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/idle_monitor/nhm_idle.c 2018-01-10 20:18:31.000000000 +0100 @@ -129,7 +129,7 @@ int num, cpu; unsigned long long dbg, val; - nhm_get_count(TSC, &tsc_at_measure_start, 0); + nhm_get_count(TSC, &tsc_at_measure_start, base_cpu); for (num = 0; num < NHM_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { @@ -137,7 +137,7 @@ previous_count[num][cpu] = val; } } - nhm_get_count(TSC, &dbg, 0); + nhm_get_count(TSC, &dbg, base_cpu); dprint("TSC diff: %llu\n", dbg - tsc_at_measure_start); return 0; } @@ -148,7 +148,7 @@ unsigned long long dbg; int num, cpu; - nhm_get_count(TSC, &tsc_at_measure_end, 0); + nhm_get_count(TSC, &tsc_at_measure_end, base_cpu); for (num = 0; num < NHM_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { @@ -156,7 +156,7 @@ current_count[num][cpu] = val; } } - nhm_get_count(TSC, &dbg, 0); + nhm_get_count(TSC, &dbg, base_cpu); dprint("TSC diff: %llu\n", dbg - tsc_at_measure_end); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/idle_monitor/snb_idle.c new/cpupower-4.15/utils/idle_monitor/snb_idle.c --- old/cpupower-4.11/utils/idle_monitor/snb_idle.c 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/idle_monitor/snb_idle.c 2018-01-10 20:18:31.000000000 +0100 @@ -120,7 +120,7 @@ previous_count[num][cpu] = val; } } - snb_get_count(TSC, &tsc_at_measure_start, 0); + snb_get_count(TSC, &tsc_at_measure_start, base_cpu); return 0; } @@ -129,7 +129,7 @@ unsigned long long val; int num, cpu; - snb_get_count(TSC, &tsc_at_measure_end, 0); + snb_get_count(TSC, &tsc_at_measure_end, base_cpu); for (num = 0; num < SNB_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpupower-4.11/utils/version-gen.sh new/cpupower-4.15/utils/version-gen.sh --- old/cpupower-4.11/utils/version-gen.sh 2017-04-25 23:07:24.000000000 +0200 +++ new/cpupower-4.15/utils/version-gen.sh 2018-01-10 20:18:31.000000000 +0100 @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 # # Script which prints out the version to use for building cpupowerutils. # Must be called from tools/power/cpupower/ ++++++ cpupower_exclude_kernel_Makefile.patch ++++++ Index: cpupower-4.15/Makefile =================================================================== --- cpupower-4.15.orig/Makefile 2018-01-11 16:49:23.619489210 +0100 +++ cpupower-4.15/Makefile 2018-01-11 16:50:32.263630773 +0100 @@ -30,8 +30,6 @@ OUTDIR := $(shell cd $(OUTPUT) && pwd) $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) endif -include ../../scripts/Makefile.arch - # --- CONFIGURATION BEGIN --- # Set the following to `true' to make a unstripped, unoptimized ++++++ cpupower_export_tarball_from_git.sh ++++++ --- /var/tmp/diff_new_pack.wIoK60/_old 2018-01-13 21:48:08.144709066 +0100 +++ /var/tmp/diff_new_pack.wIoK60/_new 2018-01-13 21:48:08.148708880 +0100 @@ -6,9 +6,10 @@ GIT_TAG=HEAD 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 " 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" @@ -34,7 +35,10 @@ GIT_TAG="$OPTARG" ;; t) - TOOL="$OPTARG" + echo XXXXXXXXX + TOOL="$OPTARG" + echo $TOOL + echo YYYYYYYY ;; ?|h) usage @@ -70,19 +74,17 @@ # --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} + 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 + 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/') @@ -123,13 +125,14 @@ DIR=`mktemp -d` pushd $DIR -TOOL="$1" + if [ "$GIT_DIR" = "" ];then export GIT_DIR=/archteam/trenn/git/linux-2.6/.git fi case $TOOL in cpupower) + echo XXX export_cpupower ;; turbostat) ++++++ cpupower_rapl.patch ++++++ --- /var/tmp/diff_new_pack.wIoK60/_old 2018-01-13 21:48:08.156708507 +0100 +++ /var/tmp/diff_new_pack.wIoK60/_new 2018-01-13 21:48:08.160708320 +0100 @@ -25,11 +25,11 @@ Signed-off-by: Thomas Renninger <[email protected]> -Index: cpupower-4.10/Makefile +Index: cpupower-4.15/Makefile =================================================================== ---- cpupower-4.10.orig/Makefile 2017-03-31 18:14:02.031075768 +0200 -+++ cpupower-4.10/Makefile 2017-03-31 18:35:37.412218184 +0200 -@@ -135,7 +135,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/h +--- cpupower-4.15.orig/Makefile 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/Makefile 2018-01-11 16:49:11.946784841 +0100 +@@ -141,7 +141,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 \ utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \ @@ -38,7 +38,7 @@ UTIL_SRC := $(UTIL_OBJS:.o=.c) -@@ -145,9 +145,9 @@ UTIL_HEADERS = utils/helpers/helpers.h u +@@ -151,9 +151,9 @@ UTIL_HEADERS = utils/helpers/helpers.h u utils/helpers/bitmask.h \ utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def @@ -51,7 +51,7 @@ LIB_OBJS := $(addprefix $(OUTPUT),$(LIB_OBJS)) CFLAGS += -pipe -@@ -278,6 +278,7 @@ install-lib: +@@ -284,6 +284,7 @@ install-lib: $(INSTALL) -d $(DESTDIR)${includedir} $(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h $(INSTALL_DATA) lib/cpuidle.h $(DESTDIR)${includedir}/cpuidle.h @@ -59,7 +59,7 @@ install-tools: $(INSTALL) -d $(DESTDIR)${bindir} -@@ -292,6 +293,7 @@ install-man: +@@ -298,6 +299,7 @@ install-man: $(INSTALL_DATA) -D man/cpupower-set.1 $(DESTDIR)${mandir}/man1/cpupower-set.1 $(INSTALL_DATA) -D man/cpupower-info.1 $(DESTDIR)${mandir}/man1/cpupower-info.1 $(INSTALL_DATA) -D man/cpupower-monitor.1 $(DESTDIR)${mandir}/man1/cpupower-monitor.1 @@ -67,7 +67,7 @@ install-gmo: $(INSTALL) -d $(DESTDIR)${localedir} -@@ -321,6 +323,7 @@ uninstall: +@@ -327,6 +329,7 @@ uninstall: - rm -f $(DESTDIR)${mandir}/man1/cpupower-set.1 - rm -f $(DESTDIR)${mandir}/man1/cpupower-info.1 - rm -f $(DESTDIR)${mandir}/man1/cpupower-monitor.1 @@ -75,11 +75,11 @@ - for HLANG in $(LANGUAGES); do \ rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \ done; -Index: cpupower-4.10/bench/Makefile +Index: cpupower-4.15/bench/Makefile =================================================================== ---- cpupower-4.10.orig/bench/Makefile 2017-03-31 18:14:02.035075995 +0200 -+++ cpupower-4.10/bench/Makefile 2017-03-31 18:14:16.675904015 +0200 -@@ -8,7 +8,7 @@ endif +--- cpupower-4.15.orig/bench/Makefile 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/bench/Makefile 2018-01-11 16:49:11.946784841 +0100 +@@ -9,7 +9,7 @@ endif ifeq ($(strip $(STATIC)),true) LIBS = -L../ -L$(OUTPUT) -lm OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \ @@ -88,10 +88,10 @@ else LIBS = -L../ -L$(OUTPUT) -lm -lcpupower OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o -Index: cpupower-4.10/lib/powercap.c +Index: cpupower-4.15/lib/powercap.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-4.10/lib/powercap.c 2017-03-31 18:37:15.529756175 +0200 ++++ cpupower-4.15/lib/powercap.c 2018-01-11 16:49:11.950785082 +0100 @@ -0,0 +1,290 @@ +/* + * (C) 2016 Thomas Renninger <[email protected]> @@ -383,10 +383,10 @@ + } + return 0; +} -Index: cpupower-4.10/lib/powercap.h +Index: cpupower-4.15/lib/powercap.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-4.10/lib/powercap.h 2017-03-31 18:14:16.675904015 +0200 ++++ cpupower-4.15/lib/powercap.h 2018-01-11 16:49:11.950785082 +0100 @@ -0,0 +1,54 @@ +/* + * (C) 2016 Thomas Renninger <[email protected]> @@ -442,11 +442,11 @@ + + +#endif /* __CPUPOWER_RAPL_H__ */ -Index: cpupower-4.10/utils/builtin.h +Index: cpupower-4.15/utils/builtin.h =================================================================== ---- cpupower-4.10.orig/utils/builtin.h 2017-03-31 18:14:02.035075995 +0200 -+++ cpupower-4.10/utils/builtin.h 2017-03-31 18:14:16.675904015 +0200 -@@ -7,6 +7,8 @@ extern int cmd_freq_set(int argc, const +--- cpupower-4.15.orig/utils/builtin.h 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/utils/builtin.h 2018-01-11 16:49:11.950785082 +0100 +@@ -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); extern int cmd_idle_info(int argc, const char **argv); @@ -455,11 +455,11 @@ extern int cmd_monitor(int argc, const char **argv); #endif -Index: cpupower-4.10/utils/cpupower.c +Index: cpupower-4.15/utils/cpupower.c =================================================================== ---- cpupower-4.10.orig/utils/cpupower.c 2017-03-31 18:14:02.035075995 +0200 -+++ cpupower-4.10/utils/cpupower.c 2017-03-31 18:14:16.675904015 +0200 -@@ -51,6 +51,7 @@ static struct cmd_struct commands[] = { +--- cpupower-4.15.orig/utils/cpupower.c 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/utils/cpupower.c 2018-01-11 16:49:11.954785323 +0100 +@@ -53,6 +53,7 @@ static struct cmd_struct commands[] = { { "frequency-set", cmd_freq_set, 1 }, { "idle-info", cmd_idle_info, 0 }, { "idle-set", cmd_idle_set, 1 }, @@ -467,10 +467,10 @@ { "set", cmd_set, 1 }, { "info", cmd_info, 0 }, { "monitor", cmd_monitor, 0 }, -Index: cpupower-4.10/utils/powercap-info.c +Index: cpupower-4.15/utils/powercap-info.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-4.10/utils/powercap-info.c 2017-03-31 18:14:16.675904015 +0200 ++++ cpupower-4.15/utils/powercap-info.c 2018-01-11 16:49:11.954785323 +0100 @@ -0,0 +1,113 @@ +#include <unistd.h> +#include <stdio.h> @@ -585,10 +585,10 @@ + powercap_show(); + return 0; +} -Index: cpupower-4.10/utils/helpers/sysfs.c +Index: cpupower-4.15/utils/helpers/sysfs.c =================================================================== ---- cpupower-4.10.orig/utils/helpers/sysfs.c 2017-03-31 18:14:02.035075995 +0200 -+++ cpupower-4.10/utils/helpers/sysfs.c 2017-03-31 18:14:16.675904015 +0200 +--- cpupower-4.15.orig/utils/helpers/sysfs.c 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/utils/helpers/sysfs.c 2018-01-11 16:49:11.954785323 +0100 @@ -18,7 +18,7 @@ unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) @@ -615,10 +615,10 @@ buf[numread] = '\0'; close(fd); -Index: cpupower-4.10/man/cpupower-powercap-info.1 +Index: cpupower-4.15/man/cpupower-powercap-info.1 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ cpupower-4.10/man/cpupower-powercap-info.1 2017-03-31 18:14:16.679904240 +0200 ++++ cpupower-4.15/man/cpupower-powercap-info.1 2018-01-11 16:49:11.958785565 +0100 @@ -0,0 +1,25 @@ +.TH CPUPOWER\-POWERCAP\-INFO "1" "05/08/2016" "" "cpupower Manual" +.SH NAME ++++++ rapl_monitor.patch ++++++ --- /var/tmp/diff_new_pack.wIoK60/_old 2018-01-13 21:48:08.168707947 +0100 +++ /var/tmp/diff_new_pack.wIoK60/_new 2018-01-13 21:48:08.168707947 +0100 @@ -3,11 +3,11 @@ Signed-off-by: Thomas Renninger <[email protected]> -diff --git a/Makefile b/Makefile -index bf968ec..9e746be 100644 ---- a/Makefile -+++ b/Makefile -@@ -136,6 +136,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \ +Index: cpupower-4.15/Makefile +=================================================================== +--- cpupower-4.15.orig/Makefile 2018-01-11 16:49:11.946784841 +0100 ++++ cpupower-4.15/Makefile 2018-01-11 16:49:23.619489210 +0100 +@@ -139,6 +139,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/h utils/idle_monitor/hsw_ext_idle.o \ utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o \ utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ @@ -15,10 +15,10 @@ utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \ utils/cpuidle-set.o utils/powercap-info.o -diff --git a/utils/idle_monitor/cpupower-monitor.c b/utils/idle_monitor/cpupower-monitor.c -index 05f953f..da1857a 100644 ---- a/utils/idle_monitor/cpupower-monitor.c -+++ b/utils/idle_monitor/cpupower-monitor.c +Index: cpupower-4.15/utils/idle_monitor/cpupower-monitor.c +=================================================================== +--- cpupower-4.15.orig/utils/idle_monitor/cpupower-monitor.c 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/utils/idle_monitor/cpupower-monitor.c 2018-01-11 16:49:23.619489210 +0100 @@ -454,9 +454,10 @@ int cmd_monitor(int argc, char **argv) print_results(1, cpu); } @@ -33,10 +33,10 @@ cpu_topology_release(cpu_top); return 0; } -diff --git a/utils/idle_monitor/idle_monitors.def b/utils/idle_monitor/idle_monitors.def -index 0d6ba4d..7c926e9 100644 ---- a/utils/idle_monitor/idle_monitors.def -+++ b/utils/idle_monitor/idle_monitors.def +Index: cpupower-4.15/utils/idle_monitor/idle_monitors.def +=================================================================== +--- cpupower-4.15.orig/utils/idle_monitor/idle_monitors.def 2018-01-10 20:18:31.000000000 +0100 ++++ cpupower-4.15/utils/idle_monitor/idle_monitors.def 2018-01-11 16:49:23.619489210 +0100 @@ -4,5 +4,6 @@ DEF(intel_nhm) DEF(intel_snb) DEF(intel_hsw_ext) @@ -44,11 +44,10 @@ +DEF(rapl) #endif DEF(cpuidle_sysfs) -diff --git a/utils/idle_monitor/rapl_monitor.c b/utils/idle_monitor/rapl_monitor.c -new file mode 100644 -index 0000000..2b02b21 ---- /dev/null -+++ b/utils/idle_monitor/rapl_monitor.c +Index: cpupower-4.15/utils/idle_monitor/rapl_monitor.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cpupower-4.15/utils/idle_monitor/rapl_monitor.c 2018-01-11 16:49:23.623489452 +0100 @@ -0,0 +1,141 @@ +/* + * (C) 2016 Thomas Renninger <[email protected]>
