From: "Kasagar, Srinidhi" <srinidhi.kasagar@intel.com>
To: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
"Brown, Len" <len.brown@intel.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Linux PM list <linux-pm@vger.kernel.org>,
vishwesh.m.rudramuni@intel.com, srinidhi.kasagar@intel.com
Subject: Re: [PATCH v6] cpufreq: Add SFI based cpufreq driver support
Date: Tue, 9 Dec 2014 16:46:53 +0530 [thread overview]
Message-ID: <20141209111652.GA26691@intel-desktop> (raw)
In-Reply-To: <CAJvTdKku-ioem5iP0xz=uFkom2XMsKMrRHQ7k8vD5FFKt33P9A@mail.gmail.com>
On Wed, Dec 03, 2014 at 10:21:57PM -0500, Len Brown wrote:
> I like this trend:
..and the trend will continue in the next version
as well :) Thank you and Viresh..
>
> drivers/cpufreq/sfi-cpufreq.c | 529 +++++++++++++++++++++++++++++++++++++++++
> v1: drivers/cpufreq/sfi-cpufreq.c | 426
> +++++++++++++++++++++++++++++++++++++++++
> v2: drivers/cpufreq/sfi-cpufreq.c | 332
> +++++++++++++++++++++++++++++++++++++++++
> v3: drivers/cpufreq/sfi-cpufreq.c | 326
> +++++++++++++++++++++++++++++++++++++++++
> v4: drivers/cpufreq/sfi-cpufreq.c | 317
> +++++++++++++++++++++++++++++++++++++++++
> v5: drivers/cpufreq/sfi-cpufreq.c | 238
> +++++++++++++++++++++++++++++++++
> v6: drivers/cpufreq/sfi-cpufreq.c | 230
> +++++++++++++++++++++++++++++++++
>
>
>
> On Tue, Nov 25, 2014 at 12:42 AM, Srinidhi Kasagar
> <srinidhi.kasagar@intel.com> wrote:
>
> > +++ b/drivers/cpufreq/sfi-cpufreq.c
>
> > +#define SFI_FREQ_MASK 0xff00
> > +
> > +static DEFINE_PER_CPU(struct sfi_cpufreq_data *, drv_data);
> > +static DEFINE_MUTEX(performance_mutex);
>
> I'm not sure that cpufreq is able to call driver init's in parallel,
> so I'm not sure that the driver init needs to lock against other
> invocations of itself.
> But even if called in parallel, what data does performance_mutex
> actually protect?
hmm..I can drop this mutex stuff then..
[...]
> > +static int parse_freq(struct sfi_table_header *table)
> > +{
> > + struct sfi_table_simple *sb;
> > +
> > + sb = (struct sfi_table_simple *)table;
> > +
> > + sfi_cpufreq_num = SFI_GET_NUM_ENTRIES(sb, struct sfi_freq_table_entry);
> > + f_entry = (struct sfi_freq_table_entry *)sb->pentry;
>
> are we sure that this pointer will still be valid after
> sfi_table_parse() returns?
> sfi_table_parse() appears to do an sfi_table_put() at the end...
That's why there used to be a memcpy earlier. I checked the instances
of sfi_table_parse and they mostly keep memcpy if that's global
and in our case, it is. So, I will retain that memcpy..
[...]
> > +static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
> > +{
> > + u32 lo, hi, sfi_ctrl;
> > + struct cpufreq_frequency_table *pos;
> > + struct sfi_cpufreq_data *data = per_cpu(drv_data, cpu);
> > +
> > + rdmsr_on_cpu(cpu, MSR_IA32_PERF_CTL, &lo, &hi);
> > + lo &= SFI_FREQ_MASK;
> > +
> > + cpufreq_for_each_entry(pos, data->freq_table) {
> > + sfi_ctrl = data->sfi_data->states[pos->driver_data].ctrl_val
> > + & SFI_FREQ_MASK;
> > + if (sfi_ctrl == lo)
> > + return pos->frequency;
> > + }
> > + return data->freq_table[0].frequency;
> > +}
>
> Not obvious (to me) that this in-accurate return value is more useful
> to the caller than simply returning data->freq_table[state].frequency.
>
> Unless the caller is taking into account for hardware coordination
> of multiple PERF_CTRL MSR's, then it is garbage-in/garbage-out,
> not to mention that by the time this value is used, it may have changed...
>
> I'm curious what breaks in your Android setup if you don't supply
> a get_cur_freq() at all...
Hmm..I do not think there is any mandate that the driver
should provide ->get callbacks to the core. However i'm
not sure if any library tools like libcpupower needs this.
I don't mind dropping this ->get callback, the driver still
works and I'm happy with the scaling_setspeed.
Srinidhi
prev parent reply other threads:[~2014-12-09 11:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-25 5:42 [PATCH v6] cpufreq: Add SFI based cpufreq driver support Srinidhi Kasagar
2014-11-25 11:14 ` Viresh Kumar
2014-12-04 3:21 ` Len Brown
2014-12-04 3:35 ` Viresh Kumar
2014-12-09 11:16 ` Kasagar, Srinidhi [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=20141209111652.GA26691@intel-desktop \
--to=srinidhi.kasagar@intel.com \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=viresh.kumar@linaro.org \
--cc=vishwesh.m.rudramuni@intel.com \
/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).