Re: [PATCH] drivers/cpufreq: Warn user when powernow-k8 tries to fall back to acpi-cpufreq and it is unavailable.

Borislav Petkov
2013-01-17T11:54:37Z

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.