diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2008-06-24 06:01:09 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2008-07-16 17:27:05 -0400 |
commit | da5e09a1b3e5a9fc0b15a3feb64e921ccc55ba74 (patch) | |
tree | 382a75c1180e458df826ef4efbc191f3f71275c1 | |
parent | c1e3b377ad48febba6f91b8ae42c44ee4d4ab45e (diff) |
ACPI : Create "idle=nomwait" bootparam
"idle=nomwait" disables the use of the MWAIT
instruction from both C1 (C1_FFH) and deeper (C2C3_FFH)
C-states.
When MWAIT is unavailable, the BIOS and OS generally
negotiate to use the HALT instruction for C1,
and use IO accesses for deeper C-states.
This option is useful for power and performance
comparisons, and also to work around BIOS bugs
where broken MWAIT support is advertised.
http://bugzilla.kernel.org/show_bug.cgi?id=10807
http://bugzilla.kernel.org/show_bug.cgi?id=10914
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Li Shaohua <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | Documentation/kernel-parameters.txt | 3 | ||||
-rw-r--r-- | arch/ia64/kernel/process.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/process.c | 11 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 13 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 6 | ||||
-rw-r--r-- | include/asm-ia64/processor.h | 1 | ||||
-rw-r--r-- | include/asm-x86/processor.h | 1 |
7 files changed, 35 insertions, 2 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 65db7f4711aa..5e497d16fb51 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -818,7 +818,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
818 | See Documentation/ide/ide.txt. | 818 | See Documentation/ide/ide.txt. |
819 | 819 | ||
820 | idle= [X86] | 820 | idle= [X86] |
821 | Format: idle=poll or idle=mwait, idle=halt | 821 | Format: idle=poll or idle=mwait, idle=halt, idle=nomwait |
822 | Poll forces a polling idle loop that can slightly improves the performance | 822 | Poll forces a polling idle loop that can slightly improves the performance |
823 | of waking up a idle CPU, but will use a lot of power and make the system | 823 | of waking up a idle CPU, but will use a lot of power and make the system |
824 | run hot. Not recommended. | 824 | run hot. Not recommended. |
@@ -828,6 +828,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
828 | as idle=poll. | 828 | as idle=poll. |
829 | idle=halt. Halt is forced to be used for CPU idle. | 829 | idle=halt. Halt is forced to be used for CPU idle. |
830 | In such case C2/C3 won't be used again. | 830 | In such case C2/C3 won't be used again. |
831 | idle=nomwait. Disable mwait for CPU C-states | ||
831 | 832 | ||
832 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem | 833 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem |
833 | Claim all unknown PCI IDE storage controllers. | 834 | Claim all unknown PCI IDE storage controllers. |
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 612b3c4a0603..3ab8373103ec 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -57,6 +57,8 @@ unsigned long boot_option_idle_override = 0; | |||
57 | EXPORT_SYMBOL(boot_option_idle_override); | 57 | EXPORT_SYMBOL(boot_option_idle_override); |
58 | unsigned long idle_halt; | 58 | unsigned long idle_halt; |
59 | EXPORT_SYMBOL(idle_halt); | 59 | EXPORT_SYMBOL(idle_halt); |
60 | unsigned long idle_nomwait; | ||
61 | EXPORT_SYMBOL(idle_nomwait); | ||
60 | 62 | ||
61 | void | 63 | void |
62 | ia64_do_show_stack (struct unw_frame_info *info, void *arg) | 64 | ia64_do_show_stack (struct unw_frame_info *info, void *arg) |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 7fc729498760..4d629c62f4f8 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | unsigned long idle_halt; | 12 | unsigned long idle_halt; |
13 | EXPORT_SYMBOL(idle_halt); | 13 | EXPORT_SYMBOL(idle_halt); |
14 | unsigned long idle_nomwait; | ||
15 | EXPORT_SYMBOL(idle_nomwait); | ||
14 | 16 | ||
15 | struct kmem_cache *task_xstate_cachep; | 17 | struct kmem_cache *task_xstate_cachep; |
16 | 18 | ||
@@ -340,6 +342,15 @@ static int __init idle_setup(char *str) | |||
340 | pm_idle = default_idle; | 342 | pm_idle = default_idle; |
341 | idle_halt = 1; | 343 | idle_halt = 1; |
342 | return 0; | 344 | return 0; |
345 | } else if (!strcmp(str, "nomwait")) { | ||
346 | /* | ||
347 | * If the boot option of "idle=nomwait" is added, | ||
348 | * it means that mwait will be disabled for CPU C2/C3 | ||
349 | * states. In such case it won't touch the variable | ||
350 | * of boot_option_idle_override. | ||
351 | */ | ||
352 | idle_nomwait = 1; | ||
353 | return 0; | ||
343 | } else | 354 | } else |
344 | return -1; | 355 | return -1; |
345 | 356 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 9a803f85ccfe..4e1bb89fd6c3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -265,7 +265,20 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) | |||
265 | 265 | ||
266 | if (!pdc_in) | 266 | if (!pdc_in) |
267 | return status; | 267 | return status; |
268 | if (idle_nomwait) { | ||
269 | /* | ||
270 | * If mwait is disabled for CPU C-states, the C2C3_FFH access | ||
271 | * mode will be disabled in the parameter of _PDC object. | ||
272 | * Of course C1_FFH access mode will also be disabled. | ||
273 | */ | ||
274 | union acpi_object *obj; | ||
275 | u32 *buffer = NULL; | ||
268 | 276 | ||
277 | obj = pdc_in->pointer; | ||
278 | buffer = (u32 *)(obj->buffer.pointer); | ||
279 | buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); | ||
280 | |||
281 | } | ||
269 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); | 282 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); |
270 | 283 | ||
271 | if (ACPI_FAILURE(status)) | 284 | if (ACPI_FAILURE(status)) |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index c75c7ace8c13..d592dbb1d12a 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -957,13 +957,17 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
957 | } else { | 957 | } else { |
958 | continue; | 958 | continue; |
959 | } | 959 | } |
960 | if (cx.type == ACPI_STATE_C1 && idle_halt) { | 960 | if (cx.type == ACPI_STATE_C1 && |
961 | (idle_halt || idle_nomwait)) { | ||
961 | /* | 962 | /* |
962 | * In most cases the C1 space_id obtained from | 963 | * In most cases the C1 space_id obtained from |
963 | * _CST object is FIXED_HARDWARE access mode. | 964 | * _CST object is FIXED_HARDWARE access mode. |
964 | * But when the option of idle=halt is added, | 965 | * But when the option of idle=halt is added, |
965 | * the entry_method type should be changed from | 966 | * the entry_method type should be changed from |
966 | * CSTATE_FFH to CSTATE_HALT. | 967 | * CSTATE_FFH to CSTATE_HALT. |
968 | * When the option of idle=nomwait is added, | ||
969 | * the C1 entry_method type should be | ||
970 | * CSTATE_HALT. | ||
967 | */ | 971 | */ |
968 | cx.entry_method = ACPI_CSTATE_HALT; | 972 | cx.entry_method = ACPI_CSTATE_HALT; |
969 | snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT"); | 973 | snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT"); |
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index f36e28a5f61e..f88fa054d01d 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h | |||
@@ -764,6 +764,7 @@ prefetchw (const void *x) | |||
764 | 764 | ||
765 | extern unsigned long boot_option_idle_override; | 765 | extern unsigned long boot_option_idle_override; |
766 | extern unsigned long idle_halt; | 766 | extern unsigned long idle_halt; |
767 | extern unsigned long idle_nomwait; | ||
767 | 768 | ||
768 | #endif /* !__ASSEMBLY__ */ | 769 | #endif /* !__ASSEMBLY__ */ |
769 | 770 | ||
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index bc221623248e..55402d2ab938 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
@@ -728,6 +728,7 @@ extern void select_idle_routine(const struct cpuinfo_x86 *c); | |||
728 | 728 | ||
729 | extern unsigned long boot_option_idle_override; | 729 | extern unsigned long boot_option_idle_override; |
730 | extern unsigned long idle_halt; | 730 | extern unsigned long idle_halt; |
731 | extern unsigned long idle_nomwait; | ||
731 | 732 | ||
732 | extern void enable_sep_cpu(void); | 733 | extern void enable_sep_cpu(void); |
733 | extern int sysenter_setup(void); | 734 | extern int sysenter_setup(void); |