From: Fabio Baltieri <fabio.baltieri@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
Rickard Andersson <rickard.andersson@stericsson.com>,
linaro-dev@lists.linaro.org
Subject: Re: [PATCH 1/5] cpufreq: handle SW coordinated CPUs
Date: Wed, 30 Jan 2013 10:14:53 +0100 [thread overview]
Message-ID: <20130130091453.GA32315@balto.lan> (raw)
In-Reply-To: <CAOh2x==SG32h-BbrnLN8gwiYNz7bS-REVcmXN67fdYPqFVmCiA@mail.gmail.com>
Hello Viresh,
On Wed, Jan 30, 2013 at 12:33:40PM +0530, Viresh Kumar wrote:
> I am starting to follow cpufreq patches religiously now and so have to come
> back to this old thread due to some crash we got :)
>
> Its still not pushed upstream, so better to get it resolved before 3.9.
Definitely, that's what we have -next for!
> On Thu, Dec 27, 2012 at 8:25 PM, Fabio Baltieri
> <fabio.baltieri@linaro.org> wrote:
>
> > diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
>
> > static inline void dbs_timer_init(struct dbs_data *dbs_data,
> > - struct cpu_dbs_common_info *cdbs, unsigned int sampling_rate)
> > + struct cpu_dbs_common_info *cdbs,
> > + unsigned int sampling_rate,
> > + int cpu)
> > {
> > int delay = delay_for_sampling_rate(sampling_rate);
> > + struct cpu_dbs_common_info *cdbs_local = dbs_data->get_cpu_cdbs(cpu);
>
> I couldn't understand the real need for this, as it should really give
> back the same
> pointer pointed out by: cdbs and hence no need of cpu in params too..
>
> I may be wrong here :)
You are actually right. This comes from the first version of the patch
(I basically rewrote it after the common code rafactoring), and cdbs was
meant to be always the one for the master CPU while cpu should indicate
the one being initialized. Then the thing turned out as:
A - I dropped the code specific for master cdbs here as it was already
there on another code path following the rafactoring.
B - I passed j_cdbs = dbs_data->get_cpu_cdbs(j) in the init cycle while
it was really meant to be get_cpu_cdbs(cpu).
> >
> > - INIT_DEFERRABLE_WORK(&cdbs->work, dbs_data->gov_dbs_timer);
> > - schedule_delayed_work_on(cdbs->cpu, &cdbs->work, delay);
> > + schedule_delayed_work_on(cpu, &cdbs_local->work, delay);
> > }
> >
> > static inline void dbs_timer_exit(struct cpu_dbs_common_info *cdbs)
> > @@ -217,6 +227,10 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data,
> > if (ignore_nice)
> > j_cdbs->prev_cpu_nice =
> > kcpustat_cpu(j).cpustat[CPUTIME_NICE];
> > +
> > + mutex_init(&j_cdbs->timer_mutex);
> > + INIT_DEFERRABLE_WORK(&j_cdbs->work,
> > + dbs_data->gov_dbs_timer);
> > }
> >
> > /*
> > @@ -275,15 +289,33 @@ second_time:
> > }
> > mutex_unlock(&dbs_data->mutex);
> >
> > - mutex_init(&cpu_cdbs->timer_mutex);
> > - dbs_timer_init(dbs_data, cpu_cdbs, *sampling_rate);
> > + if (dbs_sw_coordinated_cpus(cpu_cdbs)) {
> > + for_each_cpu(j, policy->cpus) {
> > + struct cpu_dbs_common_info *j_cdbs;
> > +
> > + j_cdbs = dbs_data->get_cpu_cdbs(j);
> > + dbs_timer_init(dbs_data, j_cdbs,
> > + *sampling_rate, j);
> > + }
> > + } else {
> > + dbs_timer_init(dbs_data, cpu_cdbs, *sampling_rate, cpu);
> > + }
>
> do you really need this else part? In case of uniprocessor systems also, the if
> block should be enough. Isn't it?
Same reason, get_cpu_cdbs(j) was meant to be get_cpu_cdbs(cpu) but
that's not used anymore in the last version of the patch, and the same
for the last hunk.
I'll send a patch to clean this up, thanks for spotting it!
Fabio
> > break;
> >
> > case CPUFREQ_GOV_STOP:
> > if (dbs_data->governor == GOV_CONSERVATIVE)
> > cs_dbs_info->enable = 0;
> >
> > - dbs_timer_exit(cpu_cdbs);
> > + if (dbs_sw_coordinated_cpus(cpu_cdbs)) {
> > + for_each_cpu(j, policy->cpus) {
> > + struct cpu_dbs_common_info *j_cdbs;
> > +
> > + j_cdbs = dbs_data->get_cpu_cdbs(j);
> > + dbs_timer_exit(j_cdbs);
> > + }
> > + } else {
> > + dbs_timer_exit(cpu_cdbs);
> > + }
>
> ditto.
--
Fabio Baltieri
next prev parent reply other threads:[~2013-01-30 9:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-27 14:55 [PATCH v6 0/5] cpufreq: handle SW coordinated CPUs Fabio Baltieri
2012-12-27 14:55 ` [PATCH 1/5] " Fabio Baltieri
2013-01-30 7:03 ` Viresh Kumar
2013-01-30 9:14 ` Fabio Baltieri [this message]
2013-01-30 11:04 ` Fabio Baltieri
2013-01-30 11:17 ` Viresh Kumar
2013-01-30 11:42 ` Fabio Baltieri
2012-12-27 14:55 ` [PATCH 2/5] cpufreq: star/stop cpufreq timers on cpu hotplug Fabio Baltieri
2013-01-30 4:52 ` Viresh Kumar
2013-01-30 5:51 ` Joseph Lo
2013-01-30 10:44 ` Fabio Baltieri
2013-01-30 13:12 ` Rafael J. Wysocki
2012-12-27 14:55 ` [PATCH 3/5] cpufreq: ondemand: call dbs_check_cpu only when necessary Fabio Baltieri
2012-12-27 14:55 ` [PATCH 4/5] cpufreq: conservative: " Fabio Baltieri
2012-12-27 14:55 ` [PATCH 5/5] cpufreq: ondemand: use all CPUs in update_sampling_rate Fabio Baltieri
-- strict thread matches above, loose matches on Subject: below --
2012-11-26 16:39 [PATCH v5 0/5] cpufreq: handle SW coordinated CPUs Fabio Baltieri
2012-11-26 16:39 ` [PATCH 1/5] " Fabio Baltieri
2012-11-27 22:05 ` Rafael J. Wysocki
2012-11-28 10:51 ` Fabio Baltieri
2012-11-28 12:49 ` Rafael J. Wysocki
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=20130130091453.GA32315@balto.lan \
--to=fabio.baltieri@linaro.org \
--cc=cpufreq@vger.kernel.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rickard.andersson@stericsson.com \
--cc=rjw@sisk.pl \
--cc=viresh.kumar@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