Blob Blame History Raw
From: Thomas Renninger <trenn@suse.de>
Subject: X86 acpi_cpufreq: Do not use request_module for autoloading
Patch-Mainline: not yet, submitted
References: bnc#756085

The idea to check for needed cpufreq functions in ACPI processor object is
a good (perfect) one, but using request_module in processor.ko
has bad side-effects:
It opens a hidden dependency: acpi-cpufreq.ko must be accessable when
processor.ko is loaded (which is not the case if the latter gets loaded
in initrd where the other one might not be present).
Also I guess calling modprobe userspace from inside the kernel
(comments indicate that is what happens), is considered an ugly workaround
if nothing else works.

Therefore try to load acpi-cpufreq on all CPUs with EST (Enhanced Speed Step)
cpu feature flag.
This may result in trying to load acpi-cpufreq on some machines which do
not have cpufreq ACPI functions (which should be a BIOS bug then), but this
does not hurt. acpi-cpufreq should always be the preferred cpufreq driver
for EST capable CPUs.
I am not 100% sure about VIA machines also exposing ACPI cpufreq functions.
I could imagine they also have this CPU id feature set and everything is fine.
In fact I have such a CPU at home, but trying it out is time intensive.
As autoloading is a new feature, there cannot be regressions and if a non
Intel CPU shows up that needs this driver as well, it can easily be added by
another matching X86 model/family/feature line.

References: https://bugzilla.novell.com/show_bug.cgi?id=756085

Signed-off-by: Thomas Renninger <trenn@suse.de>
Tested-by: tittiatcoke@gmail.com

---
 drivers/acpi/processor_driver.c |    1 -
 drivers/cpufreq/acpi-cpufreq.c  |    7 +++++++
 include/acpi/processor.h        |    1 -
 3 files changed, 7 insertions(+), 2 deletions(-)

Index: linux-3.4-rc6-master/drivers/acpi/processor_driver.c
===================================================================
--- linux-3.4-rc6-master.orig/drivers/acpi/processor_driver.c
+++ linux-3.4-rc6-master/drivers/acpi/processor_driver.c
@@ -474,7 +474,6 @@ static __ref int acpi_processor_start(st
 
 #ifdef CONFIG_CPU_FREQ
 	acpi_processor_ppc_has_changed(pr, 0);
-	acpi_processor_load_module(pr);
 #endif
 	acpi_processor_get_throttling_info(pr);
 	acpi_processor_get_limit_info(pr);
Index: linux-3.4-rc6-master/include/acpi/processor.h
===================================================================
--- linux-3.4-rc6-master.orig/include/acpi/processor.h
+++ linux-3.4-rc6-master/include/acpi/processor.h
@@ -225,7 +225,6 @@ struct acpi_processor_errata {
 	} piix4;
 };
 
-extern void acpi_processor_load_module(struct acpi_processor *pr);
 extern int acpi_processor_preregister_performance(struct
 						  acpi_processor_performance
 						  __percpu *performance);
Index: linux-3.4-rc6-master/drivers/cpufreq/acpi-cpufreq.c
===================================================================
--- linux-3.4-rc6-master.orig/drivers/cpufreq/acpi-cpufreq.c
+++ linux-3.4-rc6-master/drivers/cpufreq/acpi-cpufreq.c
@@ -66,6 +66,13 @@ struct acpi_cpufreq_data {
 	unsigned int cpu_feature;
 };
 
+static const struct x86_cpu_id acpi_cpufreq_ids[] = {
+	/* Enhanced Speed Step */
+	X86_FEATURE_MATCH(X86_FEATURE_EST),
+	{}
+};
+MODULE_DEVICE_TABLE(x86cpu, acpi_cpufreq_ids);
+
 static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data);
 
 /* acpi_perf_data is a pointer to percpu data. */