From 4d55f4bee73496652405e68f8268732a0b7f680e Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 1 Jun 2012 19:45:32 -0400 Subject: [PATCH] --- yaml --- r: 318813 b: refs/heads/master c: 6edab08c24f9141d69cfa4683a0a027d86ab303e h: refs/heads/master i: 318811: b4e1e5d30e07c549f29f1010c31c148532a6538d v: v3 --- [refs] | 2 +- trunk/drivers/cpuidle/cpuidle.c | 17 +++++++++------ trunk/drivers/idle/intel_idle.c | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index f48ae303f762..7c851e18531b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1b0a0e9a15b976d91f3b5ae619c6a8964c2818eb +refs/heads/master: 6edab08c24f9141d69cfa4683a0a027d86ab303e diff --git a/trunk/drivers/cpuidle/cpuidle.c b/trunk/drivers/cpuidle/cpuidle.c index 8ffef26ffdcf..2f0083a51a9a 100644 --- a/trunk/drivers/cpuidle/cpuidle.c +++ b/trunk/drivers/cpuidle/cpuidle.c @@ -124,6 +124,15 @@ int cpuidle_idle_call(void) if (!dev || !dev->enabled) return -EBUSY; +#if 0 + /* shows regressions, re-enable for 2.6.29 */ + /* + * run any timers that can be run now, at this point + * before calculating the idle duration etc. + */ + hrtimer_peek_ahead_timers(); +#endif + /* ask the governor for the next state */ next_state = cpuidle_curr_governor->select(drv, dev); if (need_resched()) { @@ -285,9 +294,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev) int ret, i; struct cpuidle_driver *drv = cpuidle_get_driver(); - if (!dev) - return -EINVAL; - if (dev->enabled) return 0; if (!drv || !cpuidle_curr_governor) @@ -372,6 +378,8 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); + if (!dev) + return -EINVAL; if (!try_module_get(cpuidle_driver->owner)) return -EINVAL; @@ -396,9 +404,6 @@ int cpuidle_register_device(struct cpuidle_device *dev) { int ret; - if (!dev) - return -EINVAL; - mutex_lock(&cpuidle_lock); if ((ret = __cpuidle_register_device(dev))) { diff --git a/trunk/drivers/idle/intel_idle.c b/trunk/drivers/idle/intel_idle.c index d0f59c3f87ef..a759a4c4bb0a 100644 --- a/trunk/drivers/idle/intel_idle.c +++ b/trunk/drivers/idle/intel_idle.c @@ -169,6 +169,38 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = { .enter = &intel_idle }, }; +static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = { + { /* MWAIT C0 */ }, + { /* MWAIT C1 */ + .name = "C1-IVB", + .desc = "MWAIT 0x00", + .flags = CPUIDLE_FLAG_TIME_VALID, + .exit_latency = 1, + .target_residency = 1, + .enter = &intel_idle }, + { /* MWAIT C2 */ + .name = "C3-IVB", + .desc = "MWAIT 0x10", + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency = 59, + .target_residency = 156, + .enter = &intel_idle }, + { /* MWAIT C3 */ + .name = "C6-IVB", + .desc = "MWAIT 0x20", + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency = 80, + .target_residency = 300, + .enter = &intel_idle }, + { /* MWAIT C4 */ + .name = "C7-IVB", + .desc = "MWAIT 0x30", + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency = 87, + .target_residency = 300, + .enter = &intel_idle }, +}; + static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { { /* MWAIT C0 */ }, { /* MWAIT C1 */ @@ -347,6 +379,10 @@ static const struct idle_cpu idle_cpu_snb = { .state_table = snb_cstates, }; +static const struct idle_cpu idle_cpu_ivb = { + .state_table = ivb_cstates, +}; + #define ICPU(model, cpu) \ { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } @@ -362,6 +398,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { ICPU(0x2f, idle_cpu_nehalem), ICPU(0x2a, idle_cpu_snb), ICPU(0x2d, idle_cpu_snb), + ICPU(0x3a, idle_cpu_ivb), {} }; MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);