linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix acpi_processor_idle and idle= boot parameter interaction
@ 2008-04-29 22:57 Venki Pallipadi
  2008-05-01  2:12 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Venki Pallipadi @ 2008-04-29 22:57 UTC (permalink / raw)
  To: Len Brown; +Cc: Len Brown, linux-acpi



acpi_processor_idle and "idle=" boot parameter interaction is broken.
The problem is that, at boot time acpi driver is checking for "idle=" boot
option and not registering the acpi idle handler. But, when there is a CST
changed callback (typically when switching AC <-> battery or suspend-resume)
there are no checks for boot_option_idle_override and acpi idle handler tries
to get installed with nasty side effects.

With CPU_IDLE configured this issue causes results in a nasty oops on CST
change callback and without CPU_IDLE there is no oops, but boot option
of "idle=" gets ignored and acpi idle handler gets installed.

Change the behavior to not do anything in acpi idle handler when there is a
"idle=" boot option.

Note that the problem is only there when "idle=" boot option is used.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

---
 drivers/acpi/processor_idle.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/processor_idle.c
===================================================================
--- linux-2.6.orig/drivers/acpi/processor_idle.c	2008-04-29 14:28:06.000000000 -0700
+++ linux-2.6/drivers/acpi/processor_idle.c	2008-04-29 14:28:13.000000000 -0700
@@ -1295,6 +1295,8 @@ int acpi_processor_cst_has_changed(struc
 {
 	int result = 0;
 
+	if (boot_option_idle_override)
+		return 0;
 
 	if (!pr)
 		return -EINVAL;
@@ -1734,6 +1736,9 @@ int acpi_processor_cst_has_changed(struc
 {
 	int ret;
 
+	if (boot_option_idle_override)
+		return 0;
+
 	if (!pr)
 		return -EINVAL;
 
@@ -1764,6 +1769,8 @@ int __cpuinit acpi_processor_power_init(
 	struct proc_dir_entry *entry = NULL;
 	unsigned int i;
 
+	if (boot_option_idle_override)
+		return 0;
 
 	if (!first_run) {
 		dmi_check_system(processor_power_dmi_table);
@@ -1799,7 +1806,7 @@ int __cpuinit acpi_processor_power_init(
 	 * Note that we use previously set idle handler will be used on
 	 * platforms that only support C1.
 	 */
-	if ((pr->flags.power) && (!boot_option_idle_override)) {
+	if (pr->flags.power) {
 #ifdef CONFIG_CPU_IDLE
 		acpi_processor_setup_cpuidle(pr);
 		pr->power.dev.cpu = pr->id;
@@ -1835,8 +1842,11 @@ int __cpuinit acpi_processor_power_init(
 int acpi_processor_power_exit(struct acpi_processor *pr,
 			      struct acpi_device *device)
 {
+	if (boot_option_idle_override)
+		return 0;
+
 #ifdef CONFIG_CPU_IDLE
-	if ((pr->flags.power) && (!boot_option_idle_override))
+	if (pr->flags.power)
 		cpuidle_unregister_device(&pr->power.dev);
 #endif
 	pr->flags.power_setup_done = 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix acpi_processor_idle and idle= boot parameter interaction
  2008-04-29 22:57 [PATCH] Fix acpi_processor_idle and idle= boot parameter interaction Venki Pallipadi
@ 2008-05-01  2:12 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2008-05-01  2:12 UTC (permalink / raw)
  To: Venki Pallipadi; +Cc: linux-acpi

This is upstream now.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=36a913586597cab1cd565e9bf348d037f0df955b

thanks,
-Len

On Tuesday 29 April 2008, Venki Pallipadi wrote:
> 
> acpi_processor_idle and "idle=" boot parameter interaction is broken.
> The problem is that, at boot time acpi driver is checking for "idle=" boot
> option and not registering the acpi idle handler. But, when there is a CST
> changed callback (typically when switching AC <-> battery or suspend-resume)
> there are no checks for boot_option_idle_override and acpi idle handler tries
> to get installed with nasty side effects.
> 
> With CPU_IDLE configured this issue causes results in a nasty oops on CST
> change callback and without CPU_IDLE there is no oops, but boot option
> of "idle=" gets ignored and acpi idle handler gets installed.
> 
> Change the behavior to not do anything in acpi idle handler when there is a
> "idle=" boot option.
> 
> Note that the problem is only there when "idle=" boot option is used.
> 
> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> 
> ---
>  drivers/acpi/processor_idle.c |   14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/drivers/acpi/processor_idle.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/processor_idle.c	2008-04-29 14:28:06.000000000 -0700
> +++ linux-2.6/drivers/acpi/processor_idle.c	2008-04-29 14:28:13.000000000 -0700
> @@ -1295,6 +1295,8 @@ int acpi_processor_cst_has_changed(struc
>  {
>  	int result = 0;
>  
> +	if (boot_option_idle_override)
> +		return 0;
>  
>  	if (!pr)
>  		return -EINVAL;
> @@ -1734,6 +1736,9 @@ int acpi_processor_cst_has_changed(struc
>  {
>  	int ret;
>  
> +	if (boot_option_idle_override)
> +		return 0;
> +
>  	if (!pr)
>  		return -EINVAL;
>  
> @@ -1764,6 +1769,8 @@ int __cpuinit acpi_processor_power_init(
>  	struct proc_dir_entry *entry = NULL;
>  	unsigned int i;
>  
> +	if (boot_option_idle_override)
> +		return 0;
>  
>  	if (!first_run) {
>  		dmi_check_system(processor_power_dmi_table);
> @@ -1799,7 +1806,7 @@ int __cpuinit acpi_processor_power_init(
>  	 * Note that we use previously set idle handler will be used on
>  	 * platforms that only support C1.
>  	 */
> -	if ((pr->flags.power) && (!boot_option_idle_override)) {
> +	if (pr->flags.power) {
>  #ifdef CONFIG_CPU_IDLE
>  		acpi_processor_setup_cpuidle(pr);
>  		pr->power.dev.cpu = pr->id;
> @@ -1835,8 +1842,11 @@ int __cpuinit acpi_processor_power_init(
>  int acpi_processor_power_exit(struct acpi_processor *pr,
>  			      struct acpi_device *device)
>  {
> +	if (boot_option_idle_override)
> +		return 0;
> +
>  #ifdef CONFIG_CPU_IDLE
> -	if ((pr->flags.power) && (!boot_option_idle_override))
> +	if (pr->flags.power)
>  		cpuidle_unregister_device(&pr->power.dev);
>  #endif
>  	pr->flags.power_setup_done = 0;
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-01  2:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29 22:57 [PATCH] Fix acpi_processor_idle and idle= boot parameter interaction Venki Pallipadi
2008-05-01  2:12 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).