Commit c1e3b377 authored by Zhao Yakui's avatar Zhao Yakui Committed by Andi Kleen

ACPI: Create "idle=halt" bootparam

"idle=halt" limits the idle loop to using
the halt instruction.  No MWAIT, no IO accesses,
no C-states deeper than C1.

If something is broken in the idle code,
"idle=halt" is a less severe workaround
than "idle=poll" which disables all power savings.
Signed-off-by: default avatarZhao Yakui <yakui.zhao@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
parent 5b53496a
...@@ -818,7 +818,7 @@ and is between 256 and 4096 characters. It is defined in the file ...@@ -818,7 +818,7 @@ and is between 256 and 4096 characters. It is defined in the file
See Documentation/ide/ide.txt. See Documentation/ide/ide.txt.
idle= [X86] idle= [X86]
Format: idle=poll or idle=mwait Format: idle=poll or idle=mwait, idle=halt
Poll forces a polling idle loop that can slightly improves the performance Poll forces a polling idle loop that can slightly improves the performance
of waking up a idle CPU, but will use a lot of power and make the system of waking up a idle CPU, but will use a lot of power and make the system
run hot. Not recommended. run hot. Not recommended.
...@@ -826,6 +826,8 @@ and is between 256 and 4096 characters. It is defined in the file ...@@ -826,6 +826,8 @@ and is between 256 and 4096 characters. It is defined in the file
to not use it because it doesn't save as much power as a normal idle to not use it because it doesn't save as much power as a normal idle
loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same
as idle=poll. as idle=poll.
idle=halt. Halt is forced to be used for CPU idle.
In such case C2/C3 won't be used again.
ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem
Claim all unknown PCI IDE storage controllers. Claim all unknown PCI IDE storage controllers.
......
...@@ -55,6 +55,8 @@ void (*ia64_mark_idle)(int); ...@@ -55,6 +55,8 @@ void (*ia64_mark_idle)(int);
unsigned long boot_option_idle_override = 0; unsigned long boot_option_idle_override = 0;
EXPORT_SYMBOL(boot_option_idle_override); EXPORT_SYMBOL(boot_option_idle_override);
unsigned long idle_halt;
EXPORT_SYMBOL(idle_halt);
void void
ia64_do_show_stack (struct unw_frame_info *info, void *arg) ia64_do_show_stack (struct unw_frame_info *info, void *arg)
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <asm/system.h>
unsigned long idle_halt;
EXPORT_SYMBOL(idle_halt);
struct kmem_cache *task_xstate_cachep; struct kmem_cache *task_xstate_cachep;
...@@ -325,7 +329,18 @@ static int __init idle_setup(char *str) ...@@ -325,7 +329,18 @@ static int __init idle_setup(char *str)
pm_idle = poll_idle; pm_idle = poll_idle;
} else if (!strcmp(str, "mwait")) } else if (!strcmp(str, "mwait"))
force_mwait = 1; force_mwait = 1;
else 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
* won't be used again.
* To continue to load the CPU idle driver, don't touch
* the boot_option_idle_override.
*/
pm_idle = default_idle;
idle_halt = 1;
return 0;
} else
return -1; return -1;
boot_option_idle_override = 1; boot_option_idle_override = 1;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/pm_qos_params.h> #include <linux/pm_qos_params.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/cpuidle.h> #include <linux/cpuidle.h>
#include <linux/cpuidle.h>
/* /*
* Include the apic definitions for x86 to have the APIC timer related defines * Include the apic definitions for x86 to have the APIC timer related defines
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/processor.h> #include <acpi/processor.h>
#include <asm/processor.h>
#define ACPI_PROCESSOR_COMPONENT 0x01000000 #define ACPI_PROCESSOR_COMPONENT 0x01000000
#define ACPI_PROCESSOR_CLASS "processor" #define ACPI_PROCESSOR_CLASS "processor"
...@@ -955,6 +957,17 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -955,6 +957,17 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
} else { } else {
continue; continue;
} }
if (cx.type == ACPI_STATE_C1 && idle_halt) {
/*
* In most cases the C1 space_id obtained from
* _CST object is FIXED_HARDWARE access mode.
* But when the option of idle=halt is added,
* the entry_method type should be changed from
* CSTATE_FFH to CSTATE_HALT.
*/
cx.entry_method = ACPI_CSTATE_HALT;
snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
}
} else { } else {
snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x", snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
cx.address); cx.address);
...@@ -1780,6 +1793,15 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, ...@@ -1780,6 +1793,15 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
return 0; return 0;
if (!first_run) { 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); dmi_check_system(processor_power_dmi_table);
max_cstate = acpi_processor_cstate_check(max_cstate); max_cstate = acpi_processor_cstate_check(max_cstate);
if (max_cstate < ACPI_C_STATES_MAX) if (max_cstate < ACPI_C_STATES_MAX)
......
...@@ -763,6 +763,7 @@ prefetchw (const void *x) ...@@ -763,6 +763,7 @@ prefetchw (const void *x)
#define spin_lock_prefetch(x) prefetchw(x) #define spin_lock_prefetch(x) prefetchw(x)
extern unsigned long boot_option_idle_override; extern unsigned long boot_option_idle_override;
extern unsigned long idle_halt;
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
......
...@@ -727,6 +727,7 @@ extern int force_mwait; ...@@ -727,6 +727,7 @@ extern int force_mwait;
extern void select_idle_routine(const struct cpuinfo_x86 *c); extern void select_idle_routine(const struct cpuinfo_x86 *c);
extern unsigned long boot_option_idle_override; extern unsigned long boot_option_idle_override;
extern unsigned long idle_halt;
extern void enable_sep_cpu(void); extern void enable_sep_cpu(void);
extern int sysenter_setup(void); extern int sysenter_setup(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment