mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: linux-kernel@vger.kernel.org, davej@redhat.com, x86@kernel.org,
	cpufreq@vger.kernel.org, bp@alien8.de, andre.przywara@amd.com,
	Mark.Langsdorf@amd.com, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com
Subject: Re: [PATCH] [CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect or there is no freq for it.
Date: Thu, 16 Jun 2011 19:06:11 +0200	[thread overview]
Message-ID: <20110616170611.GA18407@gere.osrc.amd.com> (raw)
In-Reply-To: <20110616142829.GB5576@dumpdata.com>

On Thu, Jun 16, 2011 at 10:28:29AM -0400, Konrad Rzeszutek Wilk wrote:
> 
> And as mentioned, the other patch that just deals with pstates.
> 
> From 0f3bc30b6bc7dad62e3b77063b69df44ca9a9f8e Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Wed, 15 Jun 2011 11:08:02 -0400
> Subject: [PATCH] [CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect or there is no freq for it.
> 
> This patch auguments the pstate transition code to error out

	     augments

> (instead of returning 0) when a incorrect pstate is provided.

				an

> It also checks whether the frequency for the pstate is
> incorrect and if so errors out.
> 
> Suggested-by: Borislav Petkov <bp@alien8.de>
> CC: andre.przywara@amd.com
> CC: Mark.Langsdorf@amd.com
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.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 fe53572..047c7b11 100644
> --- a/drivers/cpufreq/powernow-k8.c
> +++ b/drivers/cpufreq/powernow-k8.c
> @@ -1103,11 +1103,15 @@ static int transition_frequency_pstate(struct powernow_k8_data *data,
>  	/* get MSR index for hardware pstate transition */
>  	pstate = index & HW_PSTATE_MASK;
>  	if (pstate > data->max_hw_pstate)
> -		return 0;
> +		return -EINVAL;
> +

Hehe, this was a bug, actually, good catch!

powernowk8_target is actually considering ret = 0 a success and ret != 0
a failure but we were returning a 0 when our target pstate is bogus.

>  	freqs.old = find_khz_freq_from_pstate(data->powernow_table,
>  			data->currpstate);
>  	freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
>  
> +	if (freqs.new == CPUFREQ_ENTRY_INVALID)
> +		return -EINVAL;
> +

No need for that since freqs.new is determined from pstate and you're
checking pstate above.

>  	for_each_cpu(i, data->available_cores) {
>  		freqs.cpu = i;
>  		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

      reply	other threads:[~2011-06-16 17:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 19:01 [PATCH] cpufreq bug fixes (stable/cpufreq.bugfixes) for 3.0 (or 3.1) Konrad Rzeszutek Wilk
2011-06-15 19:01 ` [PATCH 1/2] [CPUFREQ] powernow-k8: Don't notify of successful transition if we failed Konrad Rzeszutek Wilk
2011-06-15 22:16   ` Borislav Petkov
2011-06-15 22:26     ` Konrad Rzeszutek Wilk
2011-06-16 14:24       ` Konrad Rzeszutek Wilk
2011-06-16 15:45         ` Borislav Petkov
2011-06-15 19:02 ` [PATCH 2/2] [CPUFREQ]: Don't set stat->last_index to -1 if the pol->cur has incorrect value Konrad Rzeszutek Wilk
2011-06-15 19:26 ` [PATCH] cpufreq bug fixes (stable/cpufreq.bugfixes) for 3.0 (or 3.1) Dave Jones
2011-06-15 21:13   ` Konrad Rzeszutek Wilk
2011-06-16 14:28 ` [PATCH] [CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect or there is no freq for it Konrad Rzeszutek Wilk
2011-06-16 17:06   ` Borislav Petkov [this message]

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=20110616170611.GA18407@gere.osrc.amd.com \
    --to=bp@amd64.org \
    --cc=Mark.Langsdorf@amd.com \
    --cc=andre.przywara@amd.com \
    --cc=bp@alien8.de \
    --cc=cpufreq@vger.kernel.org \
    --cc=davej@redhat.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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

all inboxes | Powered by JetHome®