Skip to contentSkip to conversation

Exit ACPI processor module gracefully if acpi is disabled

PATCH Applied [email protected] 3 participants 5 messages Feb 6, 2007 – Mar 8, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 4/13 Exit ACPI processor module gracefully if acpi is disabled

From: Thomas Renninger <[email protected]>

---

 drivers/acpi/processor_core.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled +9 -4
diff -puN drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled drivers/acpi/processor_core.c
@@ -994,6 +994,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered;
+
 static int __init acpi_processor_init(void)
 {
 	int result = 0;
@@ -1019,6 +1021,8 @@ static int __init acpi_processor_init(vo
 		return result;
 	}
 
+	processor_driver_registered = 1;
+
 	acpi_processor_install_hotplug_notify();
 
 	acpi_thermal_cpufreq_init();
@@ -1035,12 +1039,13 @@ static void __exit acpi_processor_exit(v
 
 	acpi_thermal_cpufreq_exit();
 
-	acpi_processor_uninstall_hotplug_notify();
-
-	acpi_bus_unregister_driver(&acpi_processor_driver);
+	if (processor_driver_registered) {
+		acpi_processor_uninstall_hotplug_notify();
 
-	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		acpi_bus_unregister_driver(&acpi_processor_driver);
 
+		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	}
 	return;
 }
 

_

reviewer
#1 lore raw

Why not simply check acpi_disabled, like other drivers do?

thanks,
-Len

Quoted 55 lines · On Monday 05 February 2007 19:09, [email protected] wrote:

From: Thomas Renninger <[email protected]>

---

 drivers/acpi/processor_core.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff -puN drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled drivers/acpi/processor_core.c

drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled +9 -4
@@ -994,6 +994,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered;
+
 static int __init acpi_processor_init(void)
 {
 	int result = 0;
@@ -1019,6 +1021,8 @@ static int __init acpi_processor_init(vo
 		return result;
 	}
 
+	processor_driver_registered = 1;
+
 	acpi_processor_install_hotplug_notify();
 
 	acpi_thermal_cpufreq_init();
@@ -1035,12 +1039,13 @@ static void __exit acpi_processor_exit(v
 
 	acpi_thermal_cpufreq_exit();
 
-	acpi_processor_uninstall_hotplug_notify();
-
-	acpi_bus_unregister_driver(&acpi_processor_driver);
+	if (processor_driver_registered) {
+		acpi_processor_uninstall_hotplug_notify();
 
-	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		acpi_bus_unregister_driver(&acpi_processor_driver);
 
+		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	}
 	return;
 }
 

_
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 2 lines · Len Brown

Why not simply check acpi_disabled, like other drivers do?

See comment from Dominik when I sent something similar some time ago:
http://marc.theaimsgroup.com/?l=linux-acpi&m=114563882012355&w=2

Thomas

Quoted 59 lines

thanks,
-Len

Quoted 55 lines · On Monday 05 February 2007 19:09, [email protected] wrote:

From: Thomas Renninger <[email protected]>

---

 drivers/acpi/processor_core.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff -puN drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled drivers/acpi/processor_core.c

drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled +9 -4
@@ -994,6 +994,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered;
+
 static int __init acpi_processor_init(void)
 {
 	int result = 0;
@@ -1019,6 +1021,8 @@ static int __init acpi_processor_init(vo
 		return result;
 	}
 
+	processor_driver_registered = 1;
+
 	acpi_processor_install_hotplug_notify();
 
 	acpi_thermal_cpufreq_init();
@@ -1035,12 +1039,13 @@ static void __exit acpi_processor_exit(v
 
 	acpi_thermal_cpufreq_exit();
 
-	acpi_processor_uninstall_hotplug_notify();
-
-	acpi_bus_unregister_driver(&acpi_processor_driver);
+	if (processor_driver_registered) {
+		acpi_processor_uninstall_hotplug_notify();
 
-	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		acpi_bus_unregister_driver(&acpi_processor_driver);
 
+		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	}
 	return;
 }
 

_
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

reviewer
#3 lore raw
Quoted 5 lines · Thomas Renninger
Quoted 2 lines · Len Brown

Why not simply check acpi_disabled, like other drivers do?

See comment from Dominik when I sent something similar some time ago:
http://marc.theaimsgroup.com/?l=linux-acpi&m=114563882012355&w=2

Dominik is right right driver registration should fail w/o a check for acpi_disabled. However, we use acpi_disabled all over the place already when that is not sufficient, so if we need it here, we can use it..

Quoted 5 lines
Quoted 5 lines

[Dominik wrote]
No. For example powernow-k8 and speedstep-centrino do have a dependency on a function which is exported by processor_perflib.c. THis means you cannot load these modules (which can run without ACPI support) if loading the processor module fails. Therefore its init function must not fail.

Blech, so the drivers that can be either native or ACPI can't link in native mode unless their ACPI processor driver symbols resolve?

Hmmm. Perhaps we should delete the ACPI part of speedstep_centrino now that it is deprecated by acpi-cpufreq? That way it can be just a native driver for folks who want to run
with hard-coded tables and no ACPI.
Or perhaps at this point we should delete speedstep_centrino entirely?

Looks like powernow-k7.c and powernow-k8.c have the same issue -- acpi_processor_register_performance() ain't gonna resolve if the acpi processor driver isn't present. Perhaps they can be split into native and ACPI drivers?

-Len

Quoted 62 lines
Quoted 50 lines · On Monday 05 February 2007 19:09, [email protected] wrote:
Quoted 49 lines

From: Thomas Renninger <[email protected]>

---

 drivers/acpi/processor_core.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff -puN drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled drivers/acpi/processor_core.c

drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled +9 -4
@@ -994,6 +994,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered;
+
 static int __init acpi_processor_init(void)
 {
 	int result = 0;
@@ -1019,6 +1021,8 @@ static int __init acpi_processor_init(vo
 		return result;
 	}
 
+	processor_driver_registered = 1;
+
 	acpi_processor_install_hotplug_notify();
 
 	acpi_thermal_cpufreq_init();
@@ -1035,12 +1039,13 @@ static void __exit acpi_processor_exit(v
 
 	acpi_thermal_cpufreq_exit();
 
-	acpi_processor_uninstall_hotplug_notify();
-
-	acpi_bus_unregister_driver(&acpi_processor_driver);
+	if (processor_driver_registered) {
+		acpi_processor_uninstall_hotplug_notify();
 
-	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		acpi_bus_unregister_driver(&acpi_processor_driver);
 
+		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	}
 	return;
 }
 
Quoted 6 lines
Quoted 6 lines

_
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 27 lines · Len Brown
Quoted 5 lines · Thomas Renninger
Quoted 2 lines · Len Brown

Why not simply check acpi_disabled, like other drivers do?

See comment from Dominik when I sent something similar some time ago:
http://marc.theaimsgroup.com/?l=linux-acpi&m=114563882012355&w=2

Dominik is right right driver registration should fail w/o a check for acpi_disabled. However, we use acpi_disabled all over the place already when that is not sufficient, so if we need it here, we can use it..

Quoted 5 lines
Quoted 5 lines

[Dominik wrote]
No. For example powernow-k8 and speedstep-centrino do have a dependency on a function which is exported by processor_perflib.c. THis means you cannot load these modules (which can run without ACPI support) if loading the processor module fails. Therefore its init function must not fail.

Blech, so the drivers that can be either native or ACPI can't link in native mode unless their ACPI processor driver symbols resolve?

Hmmm. Perhaps we should delete the ACPI part of speedstep_centrino now that it is deprecated by acpi-cpufreq? That way it can be just a native driver for folks who want to run
with hard-coded tables and no ACPI.
Or perhaps at this point we should delete speedstep_centrino entirely?

Quoted 3 lines

Looks like powernow-k7.c and powernow-k8.c have the same issue -- acpi_processor_register_performance() ain't gonna resolve if the acpi processor driver isn't present. Perhaps they can be split into native and ACPI drivers?

But all this sounds like a lot work?
Can you just add the patch for now, to solve the "oops or whatever bad happened when booted without acpi and processor module gets unloaded"?

Thanks,

Thomas

Quoted 69 lines

-Len

Quoted 50 lines
Quoted 50 lines · On Monday 05 February 2007 19:09, [email protected] wrote:
Quoted 49 lines

From: Thomas Renninger <[email protected]>

---

 drivers/acpi/processor_core.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff -puN drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled drivers/acpi/processor_core.c

drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c~exit-acpi-processor-module-gracefully-if-acpi-is-disabled +9 -4
@@ -994,6 +994,8 @@ void acpi_processor_uninstall_hotplug_no
  * ACPI, but needs symbols from this driver
  */
 
+static int processor_driver_registered;
+
 static int __init acpi_processor_init(void)
 {
 	int result = 0;
@@ -1019,6 +1021,8 @@ static int __init acpi_processor_init(vo
 		return result;
 	}
 
+	processor_driver_registered = 1;
+
 	acpi_processor_install_hotplug_notify();
 
 	acpi_thermal_cpufreq_init();
@@ -1035,12 +1039,13 @@ static void __exit acpi_processor_exit(v
 
 	acpi_thermal_cpufreq_exit();
 
-	acpi_processor_uninstall_hotplug_notify();
-
-	acpi_bus_unregister_driver(&acpi_processor_driver);
+	if (processor_driver_registered) {
+		acpi_processor_uninstall_hotplug_notify();
 
-	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		acpi_bus_unregister_driver(&acpi_processor_driver);
 
+		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+	}
 	return;
 }
 
Quoted 12 lines
Quoted 6 lines
Quoted 6 lines

_
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 14 lines
Thomas Renninger

Research and Developement Departement
SUSE LINUX Products GmbH,
Maxfeldstr. 5, D - 90409 Nürnberg
Phone: +49 (0)911 - 740 53 675
e-mail: [email protected]

SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html