Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230879
b: refs/heads/master
c: f77cfe4
h: refs/heads/master
i:
  230877: 631aa2f
  230875: 984e956
  230871: 4511527
  230863: 390f686
  230847: cfd36f9
v: v3
  • Loading branch information
Thomas Renninger authored and Len Brown committed Jan 12, 2011
1 parent 32149a3 commit 0c7d7d0
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 150 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56dbed129df3fdd4caf9018b6e7599ee258a5420
refs/heads/master: f77cfe4ea21760268c0277fa3e4b02dfd2a2c2f4
2 changes: 0 additions & 2 deletions trunk/arch/arm/mach-omap2/cpuidle34xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@

#define OMAP3_STATE_MAX OMAP3_STATE_C7

#define CPUIDLE_FLAG_CHECK_BM 0x10000 /* use omap3_enter_idle_bm() */

struct omap3_processor_cx {
u8 valid;
u8 type;
Expand Down
5 changes: 2 additions & 3 deletions trunk/arch/ia64/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,8 @@ prefetchw (const void *x)
#define spin_lock_prefetch(x) prefetchw(x)

extern unsigned long boot_option_idle_override;

enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT,
IDLE_NOMWAIT, IDLE_POLL};
extern unsigned long idle_halt;
extern unsigned long idle_nomwait;

#endif /* !__ASSEMBLY__ */

Expand Down
6 changes: 5 additions & 1 deletion trunk/arch/ia64/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@

void (*ia64_mark_idle)(int);

unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
unsigned long boot_option_idle_override = 0;
EXPORT_SYMBOL(boot_option_idle_override);
unsigned long idle_halt;
EXPORT_SYMBOL(idle_halt);
unsigned long idle_nomwait;
EXPORT_SYMBOL(idle_nomwait);
void (*pm_idle) (void);
EXPORT_SYMBOL(pm_idle);
void (*pm_power_off) (void);
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/sh/kernel/cpu/shmobile/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ void sh_mobile_setup_cpuidle(void)
state->target_residency = 1 * 2;
state->power_usage = 3;
state->flags = 0;
state->flags |= CPUIDLE_FLAG_SHALLOW;
state->flags |= CPUIDLE_FLAG_TIME_VALID;
state->enter = cpuidle_sleep_enter;

Expand Down
5 changes: 2 additions & 3 deletions trunk/arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,10 @@ extern void select_idle_routine(const struct cpuinfo_x86 *c);
extern void init_c1e_mask(void);

extern unsigned long boot_option_idle_override;
extern unsigned long idle_halt;
extern unsigned long idle_nomwait;
extern bool c1e_detected;

enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT,
IDLE_POLL, IDLE_FORCE_MWAIT};

extern void enable_sep_cpu(void);
extern int sysenter_setup(void);

Expand Down
30 changes: 20 additions & 10 deletions trunk/arch/x86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#include <asm/i387.h>
#include <asm/debugreg.h>

unsigned long idle_halt;
EXPORT_SYMBOL(idle_halt);
unsigned long idle_nomwait;
EXPORT_SYMBOL(idle_nomwait);

struct kmem_cache *task_xstate_cachep;
EXPORT_SYMBOL_GPL(task_xstate_cachep);

Expand Down Expand Up @@ -322,7 +327,7 @@ long sys_execve(const char __user *name,
/*
* Idle related variables and functions
*/
unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
unsigned long boot_option_idle_override = 0;
EXPORT_SYMBOL(boot_option_idle_override);

/*
Expand Down Expand Up @@ -381,6 +386,8 @@ void default_idle(void)
else
local_irq_enable();
current_thread_info()->status |= TS_POLLING;
trace_power_end(smp_processor_id());
trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
} else {
local_irq_enable();
/* loop is done by the caller */
Expand Down Expand Up @@ -438,8 +445,6 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
*/
void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
{
trace_power_start(POWER_CSTATE, (ax>>4)+1, smp_processor_id());
trace_cpu_idle((ax>>4)+1, smp_processor_id());
if (!need_resched()) {
if (cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_CLFLUSH_MONITOR))
clflush((void *)&current_thread_info()->flags);
Expand All @@ -466,6 +471,8 @@ static void mwait_idle(void)
__sti_mwait(0, 0);
else
local_irq_enable();
trace_power_end(smp_processor_id());
trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
} else
local_irq_enable();
}
Expand Down Expand Up @@ -498,6 +505,7 @@ static void poll_idle(void)
*
* idle=mwait overrides this decision and forces the usage of mwait.
*/
static int __cpuinitdata force_mwait;

#define MWAIT_INFO 0x05
#define MWAIT_ECX_EXTENDED_INFO 0x01
Expand All @@ -507,7 +515,7 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
{
u32 eax, ebx, ecx, edx;

if (boot_option_idle_override == IDLE_FORCE_MWAIT)
if (force_mwait)
return 1;

if (c->cpuid_level < MWAIT_INFO)
Expand Down Expand Up @@ -627,10 +635,9 @@ static int __init idle_setup(char *str)
if (!strcmp(str, "poll")) {
printk("using polling idle threads.\n");
pm_idle = poll_idle;
boot_option_idle_override = IDLE_POLL;
} else if (!strcmp(str, "mwait")) {
boot_option_idle_override = IDLE_FORCE_MWAIT;
} else if (!strcmp(str, "halt")) {
} else if (!strcmp(str, "mwait"))
force_mwait = 1;
else if (!strcmp(str, "halt")) {
/*
* When the boot option of idle=halt is added, halt is
* forced to be used for CPU idle. In such case CPU C2/C3
Expand All @@ -639,18 +646,21 @@ static int __init idle_setup(char *str)
* the boot_option_idle_override.
*/
pm_idle = default_idle;
boot_option_idle_override = IDLE_HALT;
idle_halt = 1;
return 0;
} else if (!strcmp(str, "nomwait")) {
/*
* If the boot option of "idle=nomwait" is added,
* it means that mwait will be disabled for CPU C2/C3
* states. In such case it won't touch the variable
* of boot_option_idle_override.
*/
boot_option_idle_override = IDLE_NOMWAIT;
idle_nomwait = 1;
return 0;
} else
return -1;

boot_option_idle_override = 1;
return 0;
}
early_param("idle", idle_setup);
Expand Down
4 changes: 0 additions & 4 deletions trunk/arch/x86/kernel/process_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
#include <asm/syscalls.h>
#include <asm/debugreg.h>

#include <trace/events/power.h>

asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");

/*
Expand Down Expand Up @@ -113,8 +111,6 @@ void cpu_idle(void)
stop_critical_timings();
pm_idle();
start_critical_timings();
trace_power_end(smp_processor_id());
trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
}
tick_nohz_restart_sched_tick();
preempt_enable_no_resched();
Expand Down
6 changes: 0 additions & 6 deletions trunk/arch/x86/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
#include <asm/syscalls.h>
#include <asm/debugreg.h>

#include <trace/events/power.h>

asmlinkage extern void ret_from_fork(void);

DEFINE_PER_CPU(unsigned long, old_rsp);
Expand Down Expand Up @@ -141,10 +139,6 @@ void cpu_idle(void)
pm_idle();
start_critical_timings();

trace_power_end(smp_processor_id());
trace_cpu_idle(PWR_EVENT_EXIT,
smp_processor_id());

/* In many cases the interrupt that ended idle
has already called exit_idle. But some idle
loops can be woken up without interrupt. */
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static int set_no_mwait(const struct dmi_system_id *id)
{
printk(KERN_NOTICE PREFIX "%s detected - "
"disabling mwait for CPU C-states\n", id->ident);
boot_option_idle_override = IDLE_NOMWAIT;
idle_nomwait = 1;
return 0;
}

Expand Down Expand Up @@ -283,7 +283,7 @@ acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
{
acpi_status status = AE_OK;

if (boot_option_idle_override == IDLE_NOMWAIT) {
if (idle_nomwait) {
/*
* If mwait is disabled for CPU C-states, the C2C3_FFH access
* mode will be disabled in the parameter of _PDC object.
Expand Down
28 changes: 17 additions & 11 deletions trunk/drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ module_param(bm_check_disable, uint, 0000);
static unsigned int latency_factor __read_mostly = 2;
module_param(latency_factor, uint, 0644);

static int disabled_by_idle_boot_param(void)
{
return boot_option_idle_override == IDLE_POLL ||
boot_option_idle_override == IDLE_FORCE_MWAIT ||
boot_option_idle_override == IDLE_HALT;
}

/*
* IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
* For now disable this. Probably a bug somewhere else.
Expand Down Expand Up @@ -462,7 +455,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
continue;
}
if (cx.type == ACPI_STATE_C1 &&
(boot_option_idle_override == IDLE_NOMWAIT)) {
(idle_halt || idle_nomwait)) {
/*
* In most cases the C1 space_id obtained from
* _CST object is FIXED_HARDWARE access mode.
Expand Down Expand Up @@ -1023,6 +1016,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
state->flags = 0;
switch (cx->type) {
case ACPI_STATE_C1:
state->flags |= CPUIDLE_FLAG_SHALLOW;
if (cx->entry_method == ACPI_CSTATE_FFH)
state->flags |= CPUIDLE_FLAG_TIME_VALID;

Expand All @@ -1031,13 +1025,16 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
break;

case ACPI_STATE_C2:
state->flags |= CPUIDLE_FLAG_BALANCED;
state->flags |= CPUIDLE_FLAG_TIME_VALID;
state->enter = acpi_idle_enter_simple;
dev->safe_state = state;
break;

case ACPI_STATE_C3:
state->flags |= CPUIDLE_FLAG_DEEP;
state->flags |= CPUIDLE_FLAG_TIME_VALID;
state->flags |= CPUIDLE_FLAG_CHECK_BM;
state->enter = pr->flags.bm_check ?
acpi_idle_enter_bm :
acpi_idle_enter_simple;
Expand All @@ -1061,7 +1058,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
{
int ret = 0;

if (disabled_by_idle_boot_param())
if (boot_option_idle_override)
return 0;

if (!pr)
Expand Down Expand Up @@ -1092,10 +1089,19 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
acpi_status status = 0;
static int first_run;

if (disabled_by_idle_boot_param())
if (boot_option_idle_override)
return 0;

if (!first_run) {
if (idle_halt) {
/*
* When the boot option of "idle=halt" is added, halt
* is used for CPU IDLE.
* In such case C2/C3 is meaningless. So the max_cstate
* is set to one.
*/
max_cstate = 1;
}
dmi_check_system(processor_power_dmi_table);
max_cstate = acpi_processor_cstate_check(max_cstate);
if (max_cstate < ACPI_C_STATES_MAX)
Expand Down Expand Up @@ -1136,7 +1142,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
int acpi_processor_power_exit(struct acpi_processor *pr,
struct acpi_device *device)
{
if (disabled_by_idle_boot_param())
if (boot_option_idle_override)
return 0;

cpuidle_unregister_device(&pr->power.dev);
Expand Down
Loading

0 comments on commit 0c7d7d0

Please sign in to comment.