Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+71 -17
-10
drivers/cpuidle/cpuidle.c
··· 359 359 int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, 360 360 bool *stop_tick) 361 361 { 362 - /* 363 - * If there is only a single idle state (or none), there is nothing 364 - * meaningful for the governor to choose. Skip the governor and 365 - * always use state 0 with the tick running. 366 - */ 367 - if (drv->state_count <= 1) { 368 - *stop_tick = false; 369 - return 0; 370 - } 371 - 372 362 return cpuidle_curr_governor->select(drv, dev, stop_tick); 373 363 } 374 364
+10 -1
kernel/sched/idle.c
··· 221 221 222 222 next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns); 223 223 call_cpuidle(drv, dev, next_state); 224 - } else { 224 + } else if (drv->state_count > 1) { 225 225 bool stop_tick = true; 226 226 227 227 /* ··· 239 239 * Give the governor an opportunity to reflect on the outcome 240 240 */ 241 241 cpuidle_reflect(dev, entered_state); 242 + } else { 243 + tick_nohz_idle_retain_tick(); 244 + 245 + /* 246 + * If there is only a single idle state (or none), there is 247 + * nothing meaningful for the governor to choose. Skip the 248 + * governor and always use state 0. 249 + */ 250 + call_cpuidle(drv, dev, 0); 242 251 } 243 252 244 253 exit_idle:
+5
tools/power/cpupower/cpupower-service.conf
··· 30 30 # its policy for the relative importance of performance versus energy savings to 31 31 # the processor. See man CPUPOWER-SET(1) for additional details 32 32 #PERF_BIAS= 33 + 34 + # Set the Energy Performance Preference 35 + # Available options can be read from 36 + # /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences 37 + #EPP=
+6
tools/power/cpupower/cpupower.sh
··· 23 23 cpupower set -b "$PERF_BIAS" > /dev/null || ESTATUS=1 24 24 fi 25 25 26 + # apply Energy Performance Preference 27 + if test -n "$EPP" 28 + then 29 + cpupower set -e "$EPP" > /dev/null || ESTATUS=1 30 + fi 31 + 26 32 exit $ESTATUS
+5 -1
tools/power/cpupower/utils/cpupower-set.c
··· 124 124 } 125 125 126 126 if (params.turbo_boost) { 127 - ret = cpupower_set_turbo_boost(turbo_boost); 127 + if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL) 128 + ret = cpupower_set_intel_turbo_boost(turbo_boost); 129 + else 130 + ret = cpupower_set_generic_turbo_boost(turbo_boost); 131 + 128 132 if (ret) 129 133 fprintf(stderr, "Error setting turbo-boost\n"); 130 134 }
+4 -1
tools/power/cpupower/utils/helpers/helpers.h
··· 104 104 /* cpuid and cpuinfo helpers **************************/ 105 105 106 106 int cpufreq_has_generic_boost_support(bool *active); 107 - int cpupower_set_turbo_boost(int turbo_boost); 107 + int cpupower_set_generic_turbo_boost(int turbo_boost); 108 108 109 109 /* X86 ONLY ****************************************/ 110 110 #if defined(__i386__) || defined(__x86_64__) ··· 143 143 144 144 int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, 145 145 int *active, int *states); 146 + int cpupower_set_intel_turbo_boost(int turbo_boost); 146 147 147 148 /* AMD P-State stuff **************************/ 148 149 bool cpupower_amd_pstate_enabled(void); ··· 189 188 190 189 static inline int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, 191 190 int *active, int *states) 191 + { return -1; } 192 + static inline int cpupower_set_intel_turbo_boost(int turbo_boost) 192 193 { return -1; } 193 194 194 195 static inline bool cpupower_amd_pstate_enabled(void)
+39 -2
tools/power/cpupower/utils/helpers/misc.c
··· 19 19 { 20 20 int ret; 21 21 unsigned long long val; 22 + char linebuf[MAX_LINE_LEN]; 23 + char path[SYSFS_PATH_MAX]; 24 + char *endp; 22 25 23 26 *support = *active = *states = 0; 24 27 ··· 45 42 } 46 43 } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) { 47 44 amd_pstate_boost_init(cpu, support, active); 48 - } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) 45 + } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) { 49 46 *support = *active = 1; 47 + 48 + snprintf(path, sizeof(path), PATH_TO_CPU "intel_pstate/no_turbo"); 49 + 50 + if (!is_valid_path(path)) 51 + return 0; 52 + 53 + if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0) 54 + return -1; 55 + 56 + val = strtol(linebuf, &endp, 0); 57 + if (endp == linebuf || errno == ERANGE) 58 + return -1; 59 + 60 + *active = !val; 61 + } 62 + return 0; 63 + } 64 + 65 + int cpupower_set_intel_turbo_boost(int turbo_boost) 66 + { 67 + char path[SYSFS_PATH_MAX]; 68 + char linebuf[2] = {}; 69 + 70 + snprintf(path, sizeof(path), PATH_TO_CPU "intel_pstate/no_turbo"); 71 + 72 + /* Fallback to generic solution when intel_pstate driver not running */ 73 + if (!is_valid_path(path)) 74 + return cpupower_set_generic_turbo_boost(turbo_boost); 75 + 76 + snprintf(linebuf, sizeof(linebuf), "%d", !turbo_boost); 77 + 78 + if (cpupower_write_sysfs(path, linebuf, 2) <= 0) 79 + return -1; 80 + 50 81 return 0; 51 82 } 52 83 ··· 311 274 } 312 275 } 313 276 314 - int cpupower_set_turbo_boost(int turbo_boost) 277 + int cpupower_set_generic_turbo_boost(int turbo_boost) 315 278 { 316 279 char path[SYSFS_PATH_MAX]; 317 280 char linebuf[2] = {};
+2 -2
tools/power/cpupower/utils/powercap-info.c
··· 38 38 printf(" (%s)\n", mode ? "enabled" : "disabled"); 39 39 40 40 if (zone->has_power_uw) 41 - printf(_("%sPower can be monitored in micro Jules\n"), 41 + printf(_("%sPower can be monitored in micro Watts\n"), 42 42 pr_prefix); 43 43 44 44 if (zone->has_energy_uj) 45 - printf(_("%sPower can be monitored in micro Watts\n"), 45 + printf(_("%sPower can be monitored in micro Jules\n"), 46 46 pr_prefix); 47 47 48 48 printf("\n");