public inbox for cpufreq@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: dirk.brandewie@gmail.com
Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
	Dirk Brandewie <dirk.j.brandewie@intel.com>
Subject: Re: [PATCH] cpufreq/intel_pstate: Add function to check that all MSR's are valid
Date: Wed, 20 Mar 2013 19:28:43 +0100	[thread overview]
Message-ID: <5818534.Fj7AtdhPq1@vostro.rjw.lan> (raw)
In-Reply-To: <1363796244-6658-1-git-send-email-dirk.brandewie@gmail.com>

On Wednesday, March 20, 2013 09:17:24 AM dirk.brandewie@gmail.com wrote:
> From: Dirk Brandewie <dirk.brandewie@gmail.com>
> 
> Some VMs seem to try to implement some MSRs but not all the registers
> the driver needs.  Check to make sure all the MSR that we need are
> available. If any of the required MSRs are not available refuse to
> load.
> 
> Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>

Is this needed for v3.9?  Any pointers to bug reports etc.?

Rafael


> ---
>  drivers/cpufreq/intel_pstate.c |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index f6dd1e7..cd9c5f4 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -752,6 +752,29 @@ static struct cpufreq_driver intel_pstate_driver = {
>  
>  static int __initdata no_load;
>  
> +static int intel_pstate_msrs_not_valid(void)
> +{
> +	/* Check that all the msr's we are using are valid. */
> +	u64 aperf, mperf, tmp;
> +
> +	rdmsrl(MSR_IA32_APERF, aperf);
> +	rdmsrl(MSR_IA32_MPERF, mperf);
> +
> +	if (!intel_pstate_min_pstate() ||
> +		!intel_pstate_max_pstate() ||
> +		!intel_pstate_turbo_pstate())
> +		return -ENODEV;
> +
> +	rdmsrl(MSR_IA32_APERF, tmp);
> +	if (!(tmp - aperf))
> +		return -ENODEV;
> +
> +	rdmsrl(MSR_IA32_MPERF, tmp);
> +	if (!(tmp - mperf))
> +		return -ENODEV;
> +
> +	return 0;
> +}
>  static int __init intel_pstate_init(void)
>  {
>  	int cpu, rc = 0;
> @@ -764,6 +787,9 @@ static int __init intel_pstate_init(void)
>  	if (!id)
>  		return -ENODEV;
>  
> +	if (intel_pstate_msrs_not_valid())
> +		return -ENODEV;
> +
>  	pr_info("Intel P-state driver initializing.\n");
>  
>  	all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus());
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-03-20 18:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 16:17 [PATCH] cpufreq/intel_pstate: Add function to check that all MSR's are valid dirk.brandewie
2013-03-20 18:28 ` Rafael J. Wysocki [this message]
2013-03-20 18:28   ` Dirk Brandewie
2013-03-21  0:08     ` Rafael J. Wysocki
2013-03-22  0:40       ` Rafael J. Wysocki
2013-03-22 15:06         ` Dave Jones
2013-03-23  0:06           ` Rafael J. Wysocki
2013-03-21  3:20 ` Viresh Kumar

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=5818534.Fj7AtdhPq1@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=cpufreq@vger.kernel.org \
    --cc=dirk.brandewie@gmail.com \
    --cc=dirk.j.brandewie@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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