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 v8] cpufreq: Add SFI based cpufreq driver support
Date: Fri, 19 Dec 2014 20:38:32 +0530 [thread overview]
Message-ID: <20141219150832.GA21139@intel-desktop> (raw)
In-Reply-To: <CAJvTdKkpsVGoN=v8h_=4uW=MJ=THPL1C4SKAMM9MBrQM4k30FA@mail.gmail.com>
On Fri, Dec 19, 2014 at 02:20:00AM -0500, Len Brown wrote:
> > v8:
> ...
>
> > diff --git a/drivers/cpufreq/sfi-cpufreq.c b/drivers/cpufreq/sfi-cpufreq.c
> > new file mode 100644
> > index 000000000000..f9a913242537
> > --- /dev/null
> > +++ b/drivers/cpufreq/sfi-cpufreq.c
> > @@ -0,0 +1,144 @@
> > +/*
> > + * SFI Performance States Driver
> ...
> > +static int sfi_cpufreq_cpu_init(struct cpufreq_policy *policy)
> > +{
> > + struct cpufreq_frequency_table *freq_table;
> > + unsigned int i, result;
> > +
> > + freq_table = kzalloc(sizeof(*freq_table) *
> > + (num_freq_table_entries + 1), GFP_KERNEL);
> > + if (!freq_table)
> > + return -ENOMEM;
> > +
> > + policy->shared_type = CPUFREQ_SHARED_TYPE_HW;
> > +
> > + policy->cpuinfo.transition_latency = 100000; /* 100us */
>
> It would be better to use CPUFREQ_ETERNAL here
> than to make up a number (100us) asserting that it is valid for all possible
> cores that might run this driver. If we put a real number here, then people
> will argue about how real it is when a different core runs this driver.
> The fact of the matter is that only ondemand *consumes* this number,
> and it compares it to 10,000,000 to see if can load. Then it compares
> MIN_LATENCY_MULTIPLIER (20) * latency, as a floor for min_sampling_rate,
> which would otherwise default to MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000).
>
> ie. all number you give here that are less than
> MICRO_FREQUENCY_MIN_SAMPLE_RATE/MIN_LATENCY_MULTIPLIER = 500us
> are equivalent.
>
> So just use -1 and avoid getting into a debate as to what this number really is.
I don't get your point.
* Why should we say the transition_latency as "unknown" or ETERNAL
knowing the fact that this system always has the latency of 100 us?
* If you set the transition_latency as -1/ETERNAL, then the
interactive and ondemand governors will not load because
the following condition will be true in __cpufreq_governor
and thus fallback to performance.
if (policy->governor->max_transition_latency &&
policy->cpuinfo.transition_latency >
policy->governor->max_transition_latency) {
$cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_transition_latency
4294967295
am i missing something?
>
> > + for (i = 0; i < num_freq_table_entries; i++) {
> > + /* initialize the freq table */
>
> above comment adds no value to the two lines below, so you can remove
> the comment.
>
> > + freq_table[i].driver_data = i;
> > + freq_table[i].frequency = sfi_cpufreq_array[i].freq_mhz * 1000;
> > + }
> > + freq_table[i].frequency = CPUFREQ_TABLE_END;
> > +
> > + result = cpufreq_table_validate_and_show(policy, freq_table);
>
> policy is PER_CPU
> and sfi_cpufreq_cpu_init() will be called for every CPU in the system, yes?
> So here we are kzalloc-ing and initializing an identical freq_table
> for all the CPUs in the system.
>
> But it does not appears that there is any per-cpu-specific data in that table.
>
> As they are identical, can we allocate just one
> and point all cpus to it? We would free that one
> after the last CPU has exited.
Yes, this can be done now as there is no per-cpu specific data.
Srinidhi
next prev parent reply other threads:[~2014-12-19 15:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 8:59 [PATCH v8] cpufreq: Add SFI based cpufreq driver support Srinidhi Kasagar
2014-12-18 9:21 ` Viresh Kumar
2014-12-19 7:20 ` Len Brown
2014-12-19 15:08 ` Kasagar, Srinidhi [this message]
2014-12-19 16:31 ` Len Brown
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=20141219150832.GA21139@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