Message ID | 4923C2DE085EEB4FAB1D375DD09D0BA6100CF170@sausexdag04.amd.com (mailing list archive) |
---|---|
State | RFC, archived |
Headers | show |
On Fri, Jan 11, 2013 at 07:03:35PM +0000, Gopalakrishnan, Aravind wrote: > So, I had tried out the case when acpi-cpufreq was compiled into the > kernel and looked at the return values from request_module(); it > returns a positive value (255) both when acpi-cpufreq was compiled-in > and when not compiled-in. (Please do let me know if I am missing > something here...) (This was the case Andreas had mentioned in the bug > report too) > > It was due to this that I had decided to just check the CONFIG option > and print out a warning to the user. Well, when both are built-in, I get -2 from request_module which is most probably the retval of modprobe with a missing module (I delved deep into the do_execve bowels but didn't go deep enough). So, handoff to acpi-cpufreq still has some issues. When both are built-in, the module_init functions turn into normal initcalls and in that case, they're executed in link order and it can happen that powernowk8_init() runs before acpi_cpufreq_init(). In that case, we get -2 (-ENOENT, see above) and even though there's an error, acpi-cpufreq gets loaded so the error is bogus: [ 2.225413] powernow-k8: This CPU is now supported by acpi-cpufreq, loading it. [ 2.227266] powernow-k8: Error(-2) loading acpi-cpufreq, make sure you have it enabled, else you won't have any Pstates support on this CPU! [ 2.227868] acpi-cpufreq: overriding BIOS provided _PSD data I still need to think hard about this case and how to fix it. In the meantime, here's fix for Andreas' issue (as a reply to this message). Rafael, the patch is trivial, you might want to send it now and for stable. Thanks.
On Thu, Jan 17, 2013 at 12:54:37PM +0100, Borislav Petkov wrote: > So, handoff to acpi-cpufreq still has some issues. When both are > built-in, the module_init functions turn into normal initcalls and > in that case, they're executed in link order and it can happen that > powernowk8_init() runs before acpi_cpufreq_init(). Just flip the link order? It's only the way it is because in the past we wanted to try hardware-specific drivers before more generic ones, and I don't think that's a concern in this case now.
On Fri, Jan 18, 2013 at 04:23:47PM +0000, Matthew Garrett wrote: > On Thu, Jan 17, 2013 at 12:54:37PM +0100, Borislav Petkov wrote: > > > So, handoff to acpi-cpufreq still has some issues. When both are > > built-in, the module_init functions turn into normal initcalls and > > in that case, they're executed in link order and it can happen that > > powernowk8_init() runs before acpi_cpufreq_init(). > > Just flip the link order? It's only the way it is because in the past we > wanted to try hardware-specific drivers before more generic ones, and I > don't think that's a concern in this case now. Yeah, I heard that the acpi-idle and intel-idle drivers do that and also heard that it was a hack. It doesn't look too ugly IMHO: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=2671717265ae6e720a9ba5f13fbec3a718983b65
On Fri, Jan 18, 2013 at 06:07:55PM +0100, Borislav Petkov wrote: > > Just flip the link order? It's only the way it is because in the > > past we wanted to try hardware-specific drivers before more generic > > ones, and I don't think that's a concern in this case now. > > Yeah, I heard that the acpi-idle and intel-idle drivers do that and also > heard that it was a hack. It doesn't look too ugly IMHO: > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=2671717265ae6e720a9ba5f13fbec3a718983b65 Haha, this turns into one of those chicken-or-the-egg problems: From <drivers/cpufreq/Makefile>: ################################################################################## # x86 drivers. # Link order matters. K8 is preferred to ACPI because of firmware bugs in early # K8 systems. ... Great. :(
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 index 934854ae5eb4..7227cd734042 100644 --- a/drivers/cpufreq/Kconfig.x86 +++ b/drivers/cpufreq/Kconfig.x86 @@ -106,7 +106,7 @@ config X86_POWERNOW_K7_ACPI config X86_POWERNOW_K8 tristate "AMD Opteron/Athlon64 PowerNow!" select CPU_FREQ_TABLE - depends on ACPI && ACPI_PROCESSOR + depends on ACPI && ACPI_PROCESSOR && X86_ACPI_CPUFREQ help This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors. Support for K10 and newer processors is now in acpi-cpufreq. diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 056faf6af1a9..1adbe86d0d3b 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -1256,8 +1256,12 @@ static int __cpuinit powernowk8_init(void) int rv; if (static_cpu_has(X86_FEATURE_HW_PSTATE)) { - pr_warn(PFX "this CPU is not supported anymore, using acpi-cpufreq instead.\n"); - request_module("acpi-cpufreq"); + pr_warn(PFX "This CPU is now supported by acpi-cpufreq, loading +it.\n"); + + if (request_module("acpi-cpufreq")) + pr_warn(PFX "Error loading acpi-cpufreq, make sure you " + "have it enabled, else you won't have any " + "Pstates support on this CPU!\n"); return -ENODEV; }