linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Steve Muckle <steve.muckle@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Lists linaro-kernel <linaro-kernel@lists.linaro.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Juri Lelli <Juri.Lelli@arm.com>,
	Patrick Bellasi <patrick.bellasi@arm.com>
Subject: Re: [PATCH V2] cpufreq: Disallow ->resolve_freq() for drivers providing ->target_index()
Date: Fri, 22 Jul 2016 08:13:27 -0700	[thread overview]
Message-ID: <20160722151327.GP3122@ubuntu> (raw)
In-Reply-To: <20160722003405.GZ27987@graphite.smuckle.net>

On 21-07-16, 17:34, Steve Muckle wrote:
> On Fri, Jul 22, 2016 at 02:18:54AM +0200, Rafael J. Wysocki wrote:
> > > My thinking was that one of these two would be preferable:
> > >
> > > - Forcing ->target() drivers to install a ->resolve_freq callback,
> > >   enforcing this at cpufreq driver init time.
> > 
> > That would have been possible, but your series didn't do that.
> > 
> > >   My understanding is
> > >   ->target() drivers are deprecated anyway
> > 
> > No, they aren't.
> 
> Ok. I didn't follow Documentation/cpu-freq/cpu-drivers.txt section 1.5
> then - it suggests something about target() is deprecated, perhaps it's
> out of date.

They are kind of deprecated for the new uesrs, but we still have
handful of users of it.

> Sorry, that should've been "check that either ->target_index() or
> ->resolve_freq() is implemented." 
> 
> Implementing resolve_freq for the target() drivers and requiring it at
> driver init time is probably the better way to go though. Perhaps I can
> work on this at some point.

As I said earlier as well in one of the emails, if you are worried
about the extra 'if' check in the hot path, then wouldn't this fix it
for you?

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 3dd4884c6f9e..91d8ec4c8eb7 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -517,7 +517,7 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
                return policy->freq_table[idx].frequency;
        }
 
-       if (cpufreq_driver->resolve_freq)
+       if (likely(cpufreq_driver->resolve_freq))
                return cpufreq_driver->resolve_freq(policy, target_freq);
 
        return target_freq;

-- 
viresh

  reply	other threads:[~2016-07-22 15:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 21:39 [PATCH V2] cpufreq: Disallow ->resolve_freq() for drivers providing ->target_index() Viresh Kumar
2016-07-21 23:22 ` Rafael J. Wysocki
2016-07-21 23:22   ` Steve Muckle
2016-07-21 23:32     ` Rafael J. Wysocki
2016-07-21 23:45       ` Steve Muckle
2016-07-21 23:53         ` Rafael J. Wysocki
2016-07-22  0:09           ` Steve Muckle
2016-07-22  0:18             ` Rafael J. Wysocki
2016-07-22  0:34               ` Steve Muckle
2016-07-22 15:13                 ` Viresh Kumar [this message]
2016-07-22 21:11                   ` Rafael J. Wysocki
2016-07-22 21:09                     ` 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=20160722151327.GP3122@ubuntu \
    --to=viresh.kumar@linaro.org \
    --cc=Juri.Lelli@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=steve.muckle@linaro.org \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).