提交 b88af994 编写于 作者: L Linus Torvalds

Merge tag 'pm-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix two issues in the Operating Performance Points (OPP)
  framework, one cpufreq driver issue, one problem related to the tasks
  freezer and a few build-related issues in the cpupower utility.

  Specifics:

   - Fix tasks freezer deadlock in de_thread() that occurs if one of its
     sub-threads has been frozen already (Chanho Min).

   - Avoid registering a platform device by the ti-cpufreq driver on
     platforms that cannot use it (Dave Gerlach).

   - Fix a mistake in the ti-opp-supply operating performance points
     (OPP) driver that caused an incorrect reference voltage to be used
     and make it adjust the minimum voltage dynamically to avoid hangs
     or crashes in some cases (Keerthy).

   - Fix issues related to compiler flags in the cpupower utility and
     correct a linking problem in it by renaming a file with a duplicate
     name (Jiri Olsa, Konstantin Khlebnikov)"

* tag 'pm-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  exec: make de_thread() freezable
  cpufreq: ti-cpufreq: Only register platform_device when supported
  opp: ti-opp-supply: Correct the supply in _get_optimal_vdd_voltage call
  opp: ti-opp-supply: Dynamically update u_volt_min
  tools cpupower: Override CFLAGS assignments
  tools cpupower debug: Allow to use outside build flags
  tools/power/cpupower: fix compilation with STATIC=true
...@@ -201,19 +201,28 @@ static const struct of_device_id ti_cpufreq_of_match[] = { ...@@ -201,19 +201,28 @@ static const struct of_device_id ti_cpufreq_of_match[] = {
{}, {},
}; };
static const struct of_device_id *ti_cpufreq_match_node(void)
{
struct device_node *np;
const struct of_device_id *match;
np = of_find_node_by_path("/");
match = of_match_node(ti_cpufreq_of_match, np);
of_node_put(np);
return match;
}
static int ti_cpufreq_probe(struct platform_device *pdev) static int ti_cpufreq_probe(struct platform_device *pdev)
{ {
u32 version[VERSION_COUNT]; u32 version[VERSION_COUNT];
struct device_node *np;
const struct of_device_id *match; const struct of_device_id *match;
struct opp_table *ti_opp_table; struct opp_table *ti_opp_table;
struct ti_cpufreq_data *opp_data; struct ti_cpufreq_data *opp_data;
const char * const reg_names[] = {"vdd", "vbb"}; const char * const reg_names[] = {"vdd", "vbb"};
int ret; int ret;
np = of_find_node_by_path("/"); match = dev_get_platdata(&pdev->dev);
match = of_match_node(ti_cpufreq_of_match, np);
of_node_put(np);
if (!match) if (!match)
return -ENODEV; return -ENODEV;
...@@ -290,7 +299,14 @@ static int ti_cpufreq_probe(struct platform_device *pdev) ...@@ -290,7 +299,14 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
static int ti_cpufreq_init(void) static int ti_cpufreq_init(void)
{ {
platform_device_register_simple("ti-cpufreq", -1, NULL, 0); const struct of_device_id *match;
/* Check to ensure we are on a compatible platform */
match = ti_cpufreq_match_node();
if (match)
platform_device_register_data(NULL, "ti-cpufreq", -1, match,
sizeof(*match));
return 0; return 0;
} }
module_init(ti_cpufreq_init); module_init(ti_cpufreq_init);
......
...@@ -288,7 +288,10 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data) ...@@ -288,7 +288,10 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data)
int ret; int ret;
vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data, vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data,
new_supply_vbb->u_volt); new_supply_vdd->u_volt);
if (new_supply_vdd->u_volt_min < vdd_uv)
new_supply_vdd->u_volt_min = vdd_uv;
/* Scaling up? Scale voltage before frequency */ /* Scaling up? Scale voltage before frequency */
if (freq > old_freq) { if (freq > old_freq) {
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <linux/oom.h> #include <linux/oom.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/freezer.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
...@@ -1083,7 +1084,7 @@ static int de_thread(struct task_struct *tsk) ...@@ -1083,7 +1084,7 @@ static int de_thread(struct task_struct *tsk)
while (sig->notify_count) { while (sig->notify_count) {
__set_current_state(TASK_KILLABLE); __set_current_state(TASK_KILLABLE);
spin_unlock_irq(lock); spin_unlock_irq(lock);
schedule(); freezable_schedule();
if (unlikely(__fatal_signal_pending(tsk))) if (unlikely(__fatal_signal_pending(tsk)))
goto killed; goto killed;
spin_lock_irq(lock); spin_lock_irq(lock);
...@@ -1111,7 +1112,7 @@ static int de_thread(struct task_struct *tsk) ...@@ -1111,7 +1112,7 @@ static int de_thread(struct task_struct *tsk)
__set_current_state(TASK_KILLABLE); __set_current_state(TASK_KILLABLE);
write_unlock_irq(&tasklist_lock); write_unlock_irq(&tasklist_lock);
cgroup_threadgroup_change_end(tsk); cgroup_threadgroup_change_end(tsk);
schedule(); freezable_schedule();
if (unlikely(__fatal_signal_pending(tsk))) if (unlikely(__fatal_signal_pending(tsk)))
goto killed; goto killed;
} }
......
...@@ -129,7 +129,7 @@ WARNINGS += $(call cc-supports,-Wno-pointer-sign) ...@@ -129,7 +129,7 @@ WARNINGS += $(call cc-supports,-Wno-pointer-sign)
WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
WARNINGS += -Wshadow WARNINGS += -Wshadow
CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \ override CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
-DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE -DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE
UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \ UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \
...@@ -156,12 +156,12 @@ LIB_SRC = lib/cpufreq.c lib/cpupower.c lib/cpuidle.c ...@@ -156,12 +156,12 @@ LIB_SRC = lib/cpufreq.c lib/cpupower.c lib/cpuidle.c
LIB_OBJS = lib/cpufreq.o lib/cpupower.o lib/cpuidle.o LIB_OBJS = lib/cpufreq.o lib/cpupower.o lib/cpuidle.o
LIB_OBJS := $(addprefix $(OUTPUT),$(LIB_OBJS)) LIB_OBJS := $(addprefix $(OUTPUT),$(LIB_OBJS))
CFLAGS += -pipe override CFLAGS += -pipe
ifeq ($(strip $(NLS)),true) ifeq ($(strip $(NLS)),true)
INSTALL_NLS += install-gmo INSTALL_NLS += install-gmo
COMPILE_NLS += create-gmo COMPILE_NLS += create-gmo
CFLAGS += -DNLS override CFLAGS += -DNLS
endif endif
ifeq ($(strip $(CPUFREQ_BENCH)),true) ifeq ($(strip $(CPUFREQ_BENCH)),true)
...@@ -175,7 +175,7 @@ ifeq ($(strip $(STATIC)),true) ...@@ -175,7 +175,7 @@ ifeq ($(strip $(STATIC)),true)
UTIL_SRC += $(LIB_SRC) UTIL_SRC += $(LIB_SRC)
endif endif
CFLAGS += $(WARNINGS) override CFLAGS += $(WARNINGS)
ifeq ($(strip $(V)),false) ifeq ($(strip $(V)),false)
QUIET=@ QUIET=@
...@@ -188,10 +188,10 @@ export QUIET ECHO ...@@ -188,10 +188,10 @@ export QUIET ECHO
# if DEBUG is enabled, then we do not strip or optimize # if DEBUG is enabled, then we do not strip or optimize
ifeq ($(strip $(DEBUG)),true) ifeq ($(strip $(DEBUG)),true)
CFLAGS += -O1 -g -DDEBUG override CFLAGS += -O1 -g -DDEBUG
STRIPCMD = /bin/true -Since_we_are_debugging STRIPCMD = /bin/true -Since_we_are_debugging
else else
CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer override CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
endif endif
......
...@@ -9,7 +9,7 @@ endif ...@@ -9,7 +9,7 @@ endif
ifeq ($(strip $(STATIC)),true) ifeq ($(strip $(STATIC)),true)
LIBS = -L../ -L$(OUTPUT) -lm LIBS = -L../ -L$(OUTPUT) -lm
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \ OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
$(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o
else else
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
......
...@@ -13,10 +13,10 @@ INSTALL = /usr/bin/install ...@@ -13,10 +13,10 @@ INSTALL = /usr/bin/install
default: all default: all
$(OUTPUT)centrino-decode: ../i386/centrino-decode.c $(OUTPUT)centrino-decode: ../i386/centrino-decode.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $<
$(OUTPUT)powernow-k8-decode: ../i386/powernow-k8-decode.c $(OUTPUT)powernow-k8-decode: ../i386/powernow-k8-decode.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $<
all: $(OUTPUT)centrino-decode $(OUTPUT)powernow-k8-decode all: $(OUTPUT)centrino-decode $(OUTPUT)powernow-k8-decode
......
...@@ -28,7 +28,7 @@ static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname, ...@@ -28,7 +28,7 @@ static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname,
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s", snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s",
cpu, fname); cpu, fname);
return sysfs_read_file(path, buf, buflen); return cpupower_read_sysfs(path, buf, buflen);
} }
/* helper function to write a new value to a /sys file */ /* helper function to write a new value to a /sys file */
......
...@@ -319,7 +319,7 @@ static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf, ...@@ -319,7 +319,7 @@ static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf,
snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname); snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname);
return sysfs_read_file(path, buf, buflen); return cpupower_read_sysfs(path, buf, buflen);
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "cpupower.h" #include "cpupower.h"
#include "cpupower_intern.h" #include "cpupower_intern.h"
unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen)
{ {
int fd; int fd;
ssize_t numread; ssize_t numread;
...@@ -95,7 +95,7 @@ static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *re ...@@ -95,7 +95,7 @@ static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *re
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s", snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s",
cpu, fname); cpu, fname);
if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0) if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0)
return -1; return -1;
*result = strtol(linebuf, &endp, 0); *result = strtol(linebuf, &endp, 0);
if (endp == linebuf || errno == ERANGE) if (endp == linebuf || errno == ERANGE)
......
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
#define MAX_LINE_LEN 4096 #define MAX_LINE_LEN 4096
#define SYSFS_PATH_MAX 255 #define SYSFS_PATH_MAX 255
unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen); unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册