mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
Merge tag 'pm-7.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: - Make the idle loop skip the cpuidle governor .reflect() callback after it has skipped the .select() one (Rafael Wysocki) - Fix swapped power/energy unit labels in cpupower (Kaushlendra Kumar) - Add support for setting EPP via systemd service and intel_pstate turbo boost support to cpupower (Jan Kiszka, Zhang Rui) * tag 'pm-7.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: sched: idle: Make skipping governor callbacks more consistent cpupower: Add intel_pstate turbo boost support for Intel platforms cpupower: Add support for setting EPP via systemd service cpupower: fix swapped power/energy unit labels
This commit is contained in:
@@ -359,16 +359,6 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
|
||||
int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
|
||||
bool *stop_tick)
|
||||
{
|
||||
/*
|
||||
* If there is only a single idle state (or none), there is nothing
|
||||
* meaningful for the governor to choose. Skip the governor and
|
||||
* always use state 0 with the tick running.
|
||||
*/
|
||||
if (drv->state_count <= 1) {
|
||||
*stop_tick = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cpuidle_curr_governor->select(drv, dev, stop_tick);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ static void cpuidle_idle_call(void)
|
||||
|
||||
next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns);
|
||||
call_cpuidle(drv, dev, next_state);
|
||||
} else {
|
||||
} else if (drv->state_count > 1) {
|
||||
bool stop_tick = true;
|
||||
|
||||
/*
|
||||
@@ -239,6 +239,15 @@ static void cpuidle_idle_call(void)
|
||||
* Give the governor an opportunity to reflect on the outcome
|
||||
*/
|
||||
cpuidle_reflect(dev, entered_state);
|
||||
} else {
|
||||
tick_nohz_idle_retain_tick();
|
||||
|
||||
/*
|
||||
* If there is only a single idle state (or none), there is
|
||||
* nothing meaningful for the governor to choose. Skip the
|
||||
* governor and always use state 0.
|
||||
*/
|
||||
call_cpuidle(drv, dev, 0);
|
||||
}
|
||||
|
||||
exit_idle:
|
||||
|
||||
@@ -30,3 +30,8 @@
|
||||
# its policy for the relative importance of performance versus energy savings to
|
||||
# the processor. See man CPUPOWER-SET(1) for additional details
|
||||
#PERF_BIAS=
|
||||
|
||||
# Set the Energy Performance Preference
|
||||
# Available options can be read from
|
||||
# /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences
|
||||
#EPP=
|
||||
|
||||
@@ -23,4 +23,10 @@ then
|
||||
cpupower set -b "$PERF_BIAS" > /dev/null || ESTATUS=1
|
||||
fi
|
||||
|
||||
# apply Energy Performance Preference
|
||||
if test -n "$EPP"
|
||||
then
|
||||
cpupower set -e "$EPP" > /dev/null || ESTATUS=1
|
||||
fi
|
||||
|
||||
exit $ESTATUS
|
||||
|
||||
@@ -124,7 +124,11 @@ int cmd_set(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (params.turbo_boost) {
|
||||
ret = cpupower_set_turbo_boost(turbo_boost);
|
||||
if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL)
|
||||
ret = cpupower_set_intel_turbo_boost(turbo_boost);
|
||||
else
|
||||
ret = cpupower_set_generic_turbo_boost(turbo_boost);
|
||||
|
||||
if (ret)
|
||||
fprintf(stderr, "Error setting turbo-boost\n");
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ extern struct cpupower_cpu_info cpupower_cpu_info;
|
||||
/* cpuid and cpuinfo helpers **************************/
|
||||
|
||||
int cpufreq_has_generic_boost_support(bool *active);
|
||||
int cpupower_set_turbo_boost(int turbo_boost);
|
||||
int cpupower_set_generic_turbo_boost(int turbo_boost);
|
||||
|
||||
/* X86 ONLY ****************************************/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
@@ -143,6 +143,7 @@ extern int decode_pstates(unsigned int cpu, int boost_states,
|
||||
|
||||
int cpufreq_has_x86_boost_support(unsigned int cpu, int *support,
|
||||
int *active, int *states);
|
||||
int cpupower_set_intel_turbo_boost(int turbo_boost);
|
||||
|
||||
/* AMD P-State stuff **************************/
|
||||
bool cpupower_amd_pstate_enabled(void);
|
||||
@@ -189,6 +190,8 @@ static inline int cpupower_set_amd_pstate_mode(char *mode)
|
||||
static inline int cpufreq_has_x86_boost_support(unsigned int cpu, int *support,
|
||||
int *active, int *states)
|
||||
{ return -1; }
|
||||
static inline int cpupower_set_intel_turbo_boost(int turbo_boost)
|
||||
{ return -1; }
|
||||
|
||||
static inline bool cpupower_amd_pstate_enabled(void)
|
||||
{ return false; }
|
||||
|
||||
@@ -19,6 +19,9 @@ int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, int *active,
|
||||
{
|
||||
int ret;
|
||||
unsigned long long val;
|
||||
char linebuf[MAX_LINE_LEN];
|
||||
char path[SYSFS_PATH_MAX];
|
||||
char *endp;
|
||||
|
||||
*support = *active = *states = 0;
|
||||
|
||||
@@ -42,8 +45,42 @@ int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, int *active,
|
||||
}
|
||||
} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) {
|
||||
amd_pstate_boost_init(cpu, support, active);
|
||||
} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA)
|
||||
} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) {
|
||||
*support = *active = 1;
|
||||
|
||||
snprintf(path, sizeof(path), PATH_TO_CPU "intel_pstate/no_turbo");
|
||||
|
||||
if (!is_valid_path(path))
|
||||
return 0;
|
||||
|
||||
if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0)
|
||||
return -1;
|
||||
|
||||
val = strtol(linebuf, &endp, 0);
|
||||
if (endp == linebuf || errno == ERANGE)
|
||||
return -1;
|
||||
|
||||
*active = !val;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpupower_set_intel_turbo_boost(int turbo_boost)
|
||||
{
|
||||
char path[SYSFS_PATH_MAX];
|
||||
char linebuf[2] = {};
|
||||
|
||||
snprintf(path, sizeof(path), PATH_TO_CPU "intel_pstate/no_turbo");
|
||||
|
||||
/* Fallback to generic solution when intel_pstate driver not running */
|
||||
if (!is_valid_path(path))
|
||||
return cpupower_set_generic_turbo_boost(turbo_boost);
|
||||
|
||||
snprintf(linebuf, sizeof(linebuf), "%d", !turbo_boost);
|
||||
|
||||
if (cpupower_write_sysfs(path, linebuf, 2) <= 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -274,7 +311,7 @@ void print_speed(unsigned long speed, int no_rounding)
|
||||
}
|
||||
}
|
||||
|
||||
int cpupower_set_turbo_boost(int turbo_boost)
|
||||
int cpupower_set_generic_turbo_boost(int turbo_boost)
|
||||
{
|
||||
char path[SYSFS_PATH_MAX];
|
||||
char linebuf[2] = {};
|
||||
|
||||
@@ -38,11 +38,11 @@ static int powercap_print_one_zone(struct powercap_zone *zone)
|
||||
printf(" (%s)\n", mode ? "enabled" : "disabled");
|
||||
|
||||
if (zone->has_power_uw)
|
||||
printf(_("%sPower can be monitored in micro Jules\n"),
|
||||
printf(_("%sPower can be monitored in micro Watts\n"),
|
||||
pr_prefix);
|
||||
|
||||
if (zone->has_energy_uj)
|
||||
printf(_("%sPower can be monitored in micro Watts\n"),
|
||||
printf(_("%sPower can be monitored in micro Jules\n"),
|
||||
pr_prefix);
|
||||
|
||||
printf("\n");
|
||||
|
||||
Reference in New Issue
Block a user