Skip to content

Commit

Permalink
Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/rzhang/linux

Pull thermal fixes from Zhang Rui:
 "Specifics:

   - fix an issue in intel_powerclamp driver that idle injection target
     is not accurately maintained on newer Intel CPUs.  Package C8 to
     C10 states are introduced on these CPUs but they were not included
     in the package c-state residency calculation.  From Jacob Pan.

   - fix a problem that package c-state idle injection was missing on
     Broadwell server, by adding its id to intel_powerclamp driver.
     From Jacob Pan.

   - a couple of small fixes and cleanups from Joe Perches, Mathias
     Krause, Dan Carpenter and Anand Moon"

* 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  tools/thermal: tmon: fixed the 'make install' command
  thermal: rockchip: fix an error code
  thermal/powerclamp: fix missing newer package c-states
  thermal/intel_powerclamp: add id for broadwell server
  thermal/intel_powerclamp: add __init / __exit annotations
  thermal: Use bool function return values of true/false not 1/0
  • Loading branch information
Linus Torvalds committed May 16, 2015
2 parents d70933b + b100e77 commit 7378668
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 51 deletions.
89 changes: 48 additions & 41 deletions drivers/thermal/intel_powerclamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,51 +206,57 @@ static void find_target_mwait(void)

}

struct pkg_cstate_info {
bool skip;
int msr_index;
int cstate_id;
};

#define PKG_CSTATE_INIT(id) { \
.msr_index = MSR_PKG_C##id##_RESIDENCY, \
.cstate_id = id \
}

static struct pkg_cstate_info pkg_cstates[] = {
PKG_CSTATE_INIT(2),
PKG_CSTATE_INIT(3),
PKG_CSTATE_INIT(6),
PKG_CSTATE_INIT(7),
PKG_CSTATE_INIT(8),
PKG_CSTATE_INIT(9),
PKG_CSTATE_INIT(10),
{NULL},
};

static bool has_pkg_state_counter(void)
{
u64 tmp;
return !rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &tmp) ||
!rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &tmp) ||
!rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &tmp) ||
!rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &tmp);
u64 val;
struct pkg_cstate_info *info = pkg_cstates;

/* check if any one of the counter msrs exists */
while (info->msr_index) {
if (!rdmsrl_safe(info->msr_index, &val))
return true;
info++;
}

return false;
}

static u64 pkg_state_counter(void)
{
u64 val;
u64 count = 0;

static bool skip_c2;
static bool skip_c3;
static bool skip_c6;
static bool skip_c7;

if (!skip_c2) {
if (!rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &val))
count += val;
else
skip_c2 = true;
}

if (!skip_c3) {
if (!rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &val))
count += val;
else
skip_c3 = true;
}

if (!skip_c6) {
if (!rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &val))
count += val;
else
skip_c6 = true;
}

if (!skip_c7) {
if (!rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &val))
count += val;
else
skip_c7 = true;
struct pkg_cstate_info *info = pkg_cstates;

while (info->msr_index) {
if (!info->skip) {
if (!rdmsrl_safe(info->msr_index, &val))
count += val;
else
info->skip = true;
}
info++;
}

return count;
Expand Down Expand Up @@ -667,7 +673,7 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = {
};

/* runs on Nehalem and later */
static const struct x86_cpu_id intel_powerclamp_ids[] = {
static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
{ X86_VENDOR_INTEL, 6, 0x1a},
{ X86_VENDOR_INTEL, 6, 0x1c},
{ X86_VENDOR_INTEL, 6, 0x1e},
Expand All @@ -689,12 +695,13 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = {
{ X86_VENDOR_INTEL, 6, 0x46},
{ X86_VENDOR_INTEL, 6, 0x4c},
{ X86_VENDOR_INTEL, 6, 0x4d},
{ X86_VENDOR_INTEL, 6, 0x4f},
{ X86_VENDOR_INTEL, 6, 0x56},
{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);

static int powerclamp_probe(void)
static int __init powerclamp_probe(void)
{
if (!x86_match_cpu(intel_powerclamp_ids)) {
pr_err("Intel powerclamp does not run on family %d model %d\n",
Expand Down Expand Up @@ -760,7 +767,7 @@ static inline void powerclamp_create_debug_files(void)
debugfs_remove_recursive(debug_dir);
}

static int powerclamp_init(void)
static int __init powerclamp_init(void)
{
int retval;
int bitmap_size;
Expand Down Expand Up @@ -809,7 +816,7 @@ static int powerclamp_init(void)
}
module_init(powerclamp_init);

static void powerclamp_exit(void)
static void __exit powerclamp_exit(void)
{
unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
end_power_clamp();
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/rockchip_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)

thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
if (IS_ERR(thermal->pclk)) {
error = PTR_ERR(thermal->clk);
error = PTR_ERR(thermal->pclk);
dev_err(&pdev->dev, "failed to get apb_pclk clock: %d\n",
error);
return error;
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/thermal_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz)
static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz,
int trip)
{
return 0;
return false;
}
static inline const struct thermal_trip *
of_thermal_get_trip_points(struct thermal_zone_device *tz)
Expand Down
8 changes: 0 additions & 8 deletions tools/thermal/tmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ TARGET=tmon
INSTALL_PROGRAM=install -m 755 -p
DEL_FILE=rm -f

INSTALL_CONFIGFILE=install -m 644 -p
CONFIG_FILE=
CONFIG_PATH=

# Static builds might require -ltinfo, for instance
ifneq ($(findstring -static, $(LDFLAGS)),)
STATIC := --static
Expand All @@ -38,13 +34,9 @@ valgrind: tmon
install:
- mkdir -p $(INSTALL_ROOT)/$(BINDIR)
- $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
- mkdir -p $(INSTALL_ROOT)/$(CONFIG_PATH)
- $(INSTALL_CONFIGFILE) "$(CONFIG_FILE)" "$(INSTALL_ROOT)/$(CONFIG_PATH)"

uninstall:
$(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
$(CONFIG_FILE) "$(CONFIG_PATH)"


clean:
find . -name "*.o" | xargs $(DEL_FILE)
Expand Down

0 comments on commit 7378668

Please sign in to comment.