Skip to content

Commit

Permalink
Merge branches 'pm-avs', 'pm-clk', 'powercap' and 'pm-tools'
Browse files Browse the repository at this point in the history
* pm-avs:
  PM / AVS: rockchip-io: make io-domains a child of the GRF

* pm-clk:
  PM / clk: ensure we don't allocate a -ve size of count clks

* powercap:
  powercap/intel_rapl: Add support for Kabylake

* pm-tools:
  cpupower: fix potential memory leak
  cpupower: Add cpuidle parts into library
  cpupowerutils: bench: trivial fix of spelling mistake on "average"
  Fix cpupower manpages "NAME" section
  cpupower: bench: parse.c: fix several resource leaks
  Honour user's LDFLAGS
  • Loading branch information
Rafael J. Wysocki committed May 16, 2016
5 parents aa24781 + bc19b9a + 0b26985 + 6c51cc0 + 0b81561 commit 27c4a1c
Show file tree
Hide file tree
Showing 29 changed files with 1,280 additions and 947 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ Required properties:
- "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains
- "rockchip,rk3399-io-voltage-domain" for rk3399
- "rockchip,rk3399-pmu-io-voltage-domain" for rk3399 pmu-domains
- rockchip,grf: phandle to the syscon managing the "general register files"

Deprecated properties:
- rockchip,grf: phandle to the syscon managing the "general register files"
Systems should move the io-domains to a sub-node of the grf simple-mfd.

You specify supplies using the standard regulator bindings by including
a phandle the relevant regulator. All specified supplies must be able
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/power/clock_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int of_pm_clk_add_clks(struct device *dev)

count = of_count_phandle_with_args(dev->of_node, "clocks",
"#clock-cells");
if (count == 0)
if (count <= 0)
return -ENODEV;

clks = kcalloc(count, sizeof(*clks), GFP_KERNEL);
Expand Down
10 changes: 9 additions & 1 deletion drivers/power/avs/rockchip-io-domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
const struct of_device_id *match;
struct rockchip_iodomain *iod;
struct device *parent;
int i, ret = 0;

if (!np)
Expand All @@ -351,7 +352,14 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
match = of_match_node(rockchip_iodomain_match, np);
iod->soc_data = (struct rockchip_iodomain_soc_data *)match->data;

iod->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
parent = pdev->dev.parent;
if (parent && parent->of_node) {
iod->grf = syscon_node_to_regmap(parent->of_node);
} else {
dev_dbg(&pdev->dev, "falling back to old binding\n");
iod->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
}

if (IS_ERR(iod->grf)) {
dev_err(&pdev->dev, "couldn't find grf regmap\n");
return PTR_ERR(iod->grf);
Expand Down
2 changes: 2 additions & 0 deletions drivers/powercap/intel_rapl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,8 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
RAPL_CPU(0X5C, rapl_defaults_core),/* Broxton */
RAPL_CPU(0x5E, rapl_defaults_core),/* Skylake-H/S */
RAPL_CPU(0x57, rapl_defaults_hsw_server),/* Knights Landing */
RAPL_CPU(0x8E, rapl_defaults_core),/* Kabylake */
RAPL_CPU(0x9E, rapl_defaults_core),/* Kabylake */
{}
};
MODULE_DEVICE_TABLE(x86cpu, rapl_ids);
Expand Down
12 changes: 7 additions & 5 deletions tools/power/cpupower/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ DESTDIR ?=
# and _should_ modify the PACKAGE_BUGREPORT definition

VERSION= $(shell ./utils/version-gen.sh)
LIB_MAJ= 0.0.0
LIB_MAJ= 0.0.1
LIB_MIN= 0

PACKAGE = cpupower
Expand Down Expand Up @@ -129,7 +129,7 @@ WARNINGS += -Wshadow
CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
-DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE

UTIL_OBJS = utils/helpers/amd.o utils/helpers/topology.o utils/helpers/msr.o \
UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \
utils/helpers/sysfs.o utils/helpers/misc.o utils/helpers/cpuid.o \
utils/helpers/pci.o utils/helpers/bitmask.o \
utils/idle_monitor/nhm_idle.o utils/idle_monitor/snb_idle.o \
Expand All @@ -148,9 +148,9 @@ UTIL_HEADERS = utils/helpers/helpers.h utils/idle_monitor/cpupower-monitor.h \
utils/helpers/bitmask.h \
utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def

LIB_HEADERS = lib/cpufreq.h lib/sysfs.h
LIB_SRC = lib/cpufreq.c lib/sysfs.c
LIB_OBJS = lib/cpufreq.o lib/sysfs.o
LIB_HEADERS = lib/cpufreq.h lib/cpupower.h lib/cpuidle.h
LIB_SRC = lib/cpufreq.c lib/cpupower.c lib/cpuidle.c
LIB_OBJS = lib/cpufreq.o lib/cpupower.o lib/cpuidle.o
LIB_OBJS := $(addprefix $(OUTPUT),$(LIB_OBJS))

CFLAGS += -pipe
Expand Down Expand Up @@ -280,6 +280,7 @@ install-lib:
$(CP) $(OUTPUT)libcpupower.so* $(DESTDIR)${libdir}/
$(INSTALL) -d $(DESTDIR)${includedir}
$(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h
$(INSTALL_DATA) lib/cpuidle.h $(DESTDIR)${includedir}/cpuidle.h

install-tools:
$(INSTALL) -d $(DESTDIR)${bindir}
Expand Down Expand Up @@ -315,6 +316,7 @@ endif
uninstall:
- rm -f $(DESTDIR)${libdir}/libcpupower.*
- rm -f $(DESTDIR)${includedir}/cpufreq.h
- rm -f $(DESTDIR)${includedir}/cpuidle.h
- rm -f $(DESTDIR)${bindir}/utils/cpupower
- rm -f $(DESTDIR)${mandir}/man1/cpupower.1
- rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1
Expand Down
2 changes: 1 addition & 1 deletion tools/power/cpupower/bench/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(OUTPUT)%.o : %.c

$(OUTPUT)cpufreq-bench: $(OBJS)
$(ECHO) " CC " $@
$(QUIET) $(CC) -o $@ $(CFLAGS) $(OBJS) $(LIBS)
$(QUIET) $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)

all: $(OUTPUT)cpufreq-bench

Expand Down
2 changes: 1 addition & 1 deletion tools/power/cpupower/bench/README-BENCH
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ cpufreq-bench Command Usage
-c, --cpu=<unsigned int> CPU Number to use, starting at 0
-p, --prio=<priority> scheduler priority, HIGH, LOW or DEFAULT
-g, --governor=<governor> cpufreq governor to test
-n, --cycles=<int> load/sleep cycles to get an avarage value to compare
-n, --cycles=<int> load/sleep cycles to get an average value to compare
-r, --rounds<int> load/sleep rounds
-f, --file=<configfile> config file to use
-o, --output=<dir> output dir, must exist
Expand Down
4 changes: 2 additions & 2 deletions tools/power/cpupower/bench/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void start_benchmark(struct config *config)
_round, load_time, sleep_time);

if (config->verbose)
printf("avarage: %lius, rps:%li\n",
printf("average: %lius, rps:%li\n",
load_time / calculations,
1000000 * calculations / load_time);

Expand Down Expand Up @@ -177,7 +177,7 @@ void start_benchmark(struct config *config)

progress_time += sleep_time + load_time;

/* compare the avarage sleep/load cycles */
/* compare the average sleep/load cycles */
fprintf(config->output, "%li ",
powersave_time / config->cycles);
fprintf(config->output, "%.3f\n",
Expand Down
20 changes: 15 additions & 5 deletions tools/power/cpupower/bench/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ FILE *prepare_output(const char *dirname)
{
FILE *output = NULL;
int len;
char *filename;
char *filename, *filename_tmp;
struct utsname sysdata;
DIR *dir;

Expand All @@ -81,16 +81,22 @@ FILE *prepare_output(const char *dirname)

len = strlen(dirname) + 30;
filename = malloc(sizeof(char) * len);
if (!filename) {
perror("malloc");
goto out_dir;
}

if (uname(&sysdata) == 0) {
len += strlen(sysdata.nodename) + strlen(sysdata.release);
filename = realloc(filename, sizeof(char) * len);
filename_tmp = realloc(filename, sizeof(*filename) * len);

if (filename == NULL) {
if (filename_tmp == NULL) {
free(filename);
perror("realloc");
return NULL;
goto out_dir;
}

filename = filename_tmp;
snprintf(filename, len - 1, "%s/benchmark_%s_%s_%li.log",
dirname, sysdata.nodename, sysdata.release, time(NULL));
} else {
Expand All @@ -104,12 +110,16 @@ FILE *prepare_output(const char *dirname)
if (output == NULL) {
perror("fopen");
fprintf(stderr, "error: unable to open logfile\n");
goto out;
}

fprintf(stdout, "Logfile: %s\n", filename);

free(filename);
fprintf(output, "#round load sleep performance powersave percentage\n");
out:
free(filename);
out_dir:
closedir(dir);
return output;
}

Expand Down
3 changes: 2 additions & 1 deletion tools/power/cpupower/bench/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <sched.h>

#include <cpufreq.h>
#include <cpupower.h>

#include "config.h"
#include "system.h"
Expand Down Expand Up @@ -60,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu)

dprintf("set %s as cpufreq governor\n", governor);

if (cpufreq_cpu_exists(cpu) != 0) {
if (cpupower_is_cpu_online(cpu) != 0) {
perror("cpufreq_cpu_exists");
fprintf(stderr, "error: cpu %u does not exist\n", cpu);
return -1;
Expand Down
Loading

0 comments on commit 27c4a1c

Please sign in to comment.