aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-02-20 08:23:21 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-02-20 08:23:21 -0500
commitad7eec4244a8c6b53a0d38d6fd674e9d2c92897f (patch)
tree1abd598e33f85f049fc07b51132d12370bec965b
parentf6cbe34f52dedd67d156b3d5dd76eb43791ea34a (diff)
parent37efa4b41ffb31dcdfc3beb97d47992bb2a083e5 (diff)
Merge branch 'pm-cpuidle'
* pm-cpuidle: CPU / PM: expose pm_qos_resume_latency for CPUs cpuidle/menu: add per CPU PM QoS resume latency consideration cpuidle/menu: stop seeking deeper idle if current state is deep enough ACPI / idle: small formatting fixes
-rw-r--r--arch/x86/kernel/acpi/cstate.c9
-rw-r--r--drivers/base/cpu.c2
-rw-r--r--drivers/cpuidle/governors/menu.c11
3 files changed, 16 insertions, 6 deletions
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index af15f4444330..8233a630280f 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -12,7 +12,6 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13 13
14#include <acpi/processor.h> 14#include <acpi/processor.h>
15#include <asm/acpi.h>
16#include <asm/mwait.h> 15#include <asm/mwait.h>
17#include <asm/special_insns.h> 16#include <asm/special_insns.h>
18 17
@@ -89,7 +88,8 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
89 retval = 0; 88 retval = 0;
90 /* If the HW does not support any sub-states in this C-state */ 89 /* If the HW does not support any sub-states in this C-state */
91 if (num_cstate_subtype == 0) { 90 if (num_cstate_subtype == 0) {
92 pr_warn(FW_BUG "ACPI MWAIT C-state 0x%x not supported by HW (0x%x)\n", cx->address, edx_part); 91 pr_warn(FW_BUG "ACPI MWAIT C-state 0x%x not supported by HW (0x%x)\n",
92 cx->address, edx_part);
93 retval = -1; 93 retval = -1;
94 goto out; 94 goto out;
95 } 95 }
@@ -104,8 +104,8 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
104 if (!mwait_supported[cstate_type]) { 104 if (!mwait_supported[cstate_type]) {
105 mwait_supported[cstate_type] = 1; 105 mwait_supported[cstate_type] = 1;
106 printk(KERN_DEBUG 106 printk(KERN_DEBUG
107 "Monitor-Mwait will be used to enter C-%d " 107 "Monitor-Mwait will be used to enter C-%d state\n",
108 "state\n", cx->type); 108 cx->type);
109 } 109 }
110 snprintf(cx->desc, 110 snprintf(cx->desc,
111 ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x", 111 ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
@@ -166,6 +166,7 @@ EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_enter);
166static int __init ffh_cstate_init(void) 166static int __init ffh_cstate_init(void)
167{ 167{
168 struct cpuinfo_x86 *c = &boot_cpu_data; 168 struct cpuinfo_x86 *c = &boot_cpu_data;
169
169 if (c->x86_vendor != X86_VENDOR_INTEL) 170 if (c->x86_vendor != X86_VENDOR_INTEL)
170 return -1; 171 return -1;
171 172
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 4c28e1a09786..2c3b359b3536 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -17,6 +17,7 @@
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/cpufeature.h> 18#include <linux/cpufeature.h>
19#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/pm_qos.h>
20 21
21#include "base.h" 22#include "base.h"
22 23
@@ -376,6 +377,7 @@ int register_cpu(struct cpu *cpu, int num)
376 377
377 per_cpu(cpu_sys_devices, num) = &cpu->dev; 378 per_cpu(cpu_sys_devices, num) = &cpu->dev;
378 register_cpu_under_node(num, cpu_to_node(num)); 379 register_cpu_under_node(num, cpu_to_node(num));
380 dev_pm_qos_expose_latency_limit(&cpu->dev, 0);
379 381
380 return 0; 382 return 0;
381} 383}
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index d9b5b9398a0f..8d6d25c38c02 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -19,6 +19,7 @@
19#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/math64.h> 21#include <linux/math64.h>
22#include <linux/cpu.h>
22 23
23/* 24/*
24 * Please note when changing the tuning values: 25 * Please note when changing the tuning values:
@@ -280,17 +281,23 @@ again:
280static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) 281static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
281{ 282{
282 struct menu_device *data = this_cpu_ptr(&menu_devices); 283 struct menu_device *data = this_cpu_ptr(&menu_devices);
284 struct device *device = get_cpu_device(dev->cpu);
283 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); 285 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
284 int i; 286 int i;
285 unsigned int interactivity_req; 287 unsigned int interactivity_req;
286 unsigned int expected_interval; 288 unsigned int expected_interval;
287 unsigned long nr_iowaiters, cpu_load; 289 unsigned long nr_iowaiters, cpu_load;
290 int resume_latency = dev_pm_qos_read_value(device);
288 291
289 if (data->needs_update) { 292 if (data->needs_update) {
290 menu_update(drv, dev); 293 menu_update(drv, dev);
291 data->needs_update = 0; 294 data->needs_update = 0;
292 } 295 }
293 296
297 /* resume_latency is 0 means no restriction */
298 if (resume_latency && resume_latency < latency_req)
299 latency_req = resume_latency;
300
294 /* Special case when user has set very strict latency requirement */ 301 /* Special case when user has set very strict latency requirement */
295 if (unlikely(latency_req == 0)) 302 if (unlikely(latency_req == 0))
296 return 0; 303 return 0;
@@ -357,9 +364,9 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
357 if (s->disabled || su->disable) 364 if (s->disabled || su->disable)
358 continue; 365 continue;
359 if (s->target_residency > data->predicted_us) 366 if (s->target_residency > data->predicted_us)
360 continue; 367 break;
361 if (s->exit_latency > latency_req) 368 if (s->exit_latency > latency_req)
362 continue; 369 break;
363 370
364 data->last_state_idx = i; 371 data->last_state_idx = i;
365 } 372 }