public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Andre Przywara <andre.przywara@amd.com>
Cc: cpufreq@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Matthew Garrett <mjg@redhat.com>,
	Andreas Herrmann <andreas.herrmann3@amd.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] cpufreq: Add compatibility hack to powernow-k8
Date: Wed, 22 Aug 2012 02:48:05 +0200	[thread overview]
Message-ID: <201208220248.05674.trenn@suse.de> (raw)
In-Reply-To: <1343305724-2809-4-git-send-email-andre.przywara@amd.com>

On Thursday 26 July 2012 14:28:39 Andre Przywara wrote:
> From: Matthew Garrett <mjg@redhat.com>
> 
> cpufreq modules are often loaded from init scripts that assume that all
> recent AMD systems will use powernow-k8, so we should ensure that loading
> it triggers a load of acpi-cpufreq if the latter is built as a module.
> This avoids the problem of users ending up without any cpufreq support
> after the transition.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> Signed-off-by: Andre Przywara <andre.przywara@amd.com>
> ---
>  drivers/cpufreq/powernow-k8.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
> index c0e8164..6e35ed2 100644
> --- a/drivers/cpufreq/powernow-k8.c
> +++ b/drivers/cpufreq/powernow-k8.c
> @@ -1567,8 +1567,12 @@ static int __cpuinit powernowk8_init(void)
>  			supported_cpus++;
>  	}
>  
> -	if (supported_cpus != num_online_cpus())
> +	if (supported_cpus != num_online_cpus()) {
> +		if (static_cpu_has(X86_FEATURE_HW_PSTATE))
> +			request_module("acpi_cpufreq");
> +
>  		return -ENODEV;
> +	}
>  
This is bad/wrong and the patch should simply be left out.
cpufreq modules are autoloaded since some kernel versions and init
scripts loading cpufreq drivers are not needed anymore. This is done
by udev now.

Also request_module can have side effects and should get avoided if
possible.

I also wonder whether it's better to have the request_module() call,
that loads acpi-cpufreq from processor module, get removed. I sent
a patch a while ago to do that:
[PATCH] X86 acpi_cpufreq: Do not use request_module for autoloading

Two reasons:
  1) request_module (at least if called from another module) introduces
     dependencies.
     For example: We have fan.ko, thermal.ko and processor.ko in the initrd,
     as some laptops needed CPU thermal management as early as possible.
     If cpufreq acpi functions are available, it calls request_module(), but
     acpi-cpufreq is not in the initrd and does never get loaded.
  2) Most platforms with missing ACPI cpufreq functions for
     processors with these X86 features:
        X86_FEATURE_HW_PSTATE (AMD)
        X86_FEATURE_EST (Intel)
     can be considered to have buggy BIOSes.
     Especially for AMD it helped people a lot to mention that they should
     upgrade their BIOS in this case.

If 2. is not relevant anymore, request_module() could stay in processor driver,
but one should keep 1. in mind and best compile the processor driver into the
kernel then.

In any way, this patch should be left out, while the rest still works
as expected.

   Thomas

  reply	other threads:[~2012-08-22  0:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 12:28 [PATCH 0/8] acpi-cpufreq: Move modern AMD cpufreq support to acpi-cpufreq Andre Przywara
2012-07-26 12:28 ` [PATCH 1/8] acpi-cpufreq: Add support for modern AMD CPUs Andre Przywara
2012-07-26 12:28 ` [PATCH 2/8] acpi-cpufreq: Add quirk to disable _PSD usage on all " Andre Przywara
2012-07-26 12:28 ` [PATCH 3/8] cpufreq: Add compatibility hack to powernow-k8 Andre Przywara
2012-08-22  0:48   ` Thomas Renninger [this message]
2012-07-26 12:28 ` [PATCH 4/8] ACPI: Add fixups for AMD P-state figures Andre Przywara
2012-07-26 12:28 ` [PATCH 5/8] acpi-cpufreq: Add support for disabling dynamic overclocking Andre Przywara
2012-08-05 21:26   ` Rafael J. Wysocki
2012-07-26 12:28 ` [PATCH 6/8] acpi-cpufreq: Add compatibility for legacy AMD cpb sysfs knob Andre Przywara
2012-08-05 21:29   ` Rafael J. Wysocki
2012-07-26 12:28 ` [PATCH 7/8] cpufreq: Remove support for hardware P-state chips from powernow-k8 Andre Przywara
2012-08-05 21:33   ` Rafael J. Wysocki
2012-08-20 13:00     ` Andre Przywara
2012-08-20 20:49       ` Rafael J. Wysocki
2012-08-22  1:00         ` Thomas Renninger
2012-08-22 13:39           ` Andre Przywara
2012-08-22 14:34             ` Thomas Renninger
2012-07-26 12:28 ` [PATCH 8/8] Documentation: Add documentation for boost control switch Andre Przywara
2012-08-05 21:34   ` Rafael J. Wysocki
2012-07-26 14:01 ` [PATCH 0/8] acpi-cpufreq: Move modern AMD cpufreq support to acpi-cpufreq Thomas Renninger
2012-07-26 19:58   ` Rafael J. Wysocki
2012-08-05 21:20 ` Rafael J. Wysocki
2012-08-05 23:39   ` H. Peter Anvin
2012-08-06  8:20     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201208220248.05674.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=andre.przywara@amd.com \
    --cc=andreas.herrmann3@amd.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox