linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v4 1/5] cpufreq: Don't wait for CPU to going offline to restart governor
@ 2014-08-07  8:54 Viresh Kumar
  2014-08-11 22:11 ` Saravana Kannan
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2014-08-07  8:54 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Rafael J . Wysocki, Todd Poynor, Srivatsa S . Bhat,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Stephen Boyd

Sorry for the really long delay this time around. I am used to replying within a
day normally, and this time it just took so much time.

For next time please rebase on latest updates in pm/linux-next as there are
few updates there.

On 25 July 2014 06:37, Saravana Kannan <skannan@codeaurora.org> wrote:
> There's no need to wait for the CPU going down to fully go offline to
> restart the governor. We can stop the governor, change policy->cpus and
> immediately restart the governor. This should reduce the time without any
> CPUfreq monitoring and also help future patches with simplifying the code.

I agree with the idea here, though the $subject can be improved a bit
here..

> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
> ---
>  drivers/cpufreq/cpufreq.c | 33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 62259d2..ee0eb7b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1390,6 +1390,21 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>                 cpufreq_driver->stop_cpu(policy);
>         }
>
> +       down_write(&policy->rwsem);
> +       cpumask_clear_cpu(cpu, policy->cpus);
> +       up_write(&policy->rwsem);

There is a down_read() present early in this routine and we better update this
at that place only.

> +       if (cpus > 1 && has_target()) {

We already have a if (cpus > 1) block, move this there.

> +               ret = __cpufreq_governor(policy, CPUFREQ_GOV_START);
> +               if (!ret)
> +                       ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
> +
> +               if (ret) {
> +                       pr_err("%s: Failed to start governor\n", __func__);
> +                       return ret;
> +               }
> +       }
> +
>         return 0;
>  }
>
> @@ -1410,15 +1425,12 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
>                 return -EINVAL;
>         }
>
> -       down_write(&policy->rwsem);
> +       down_read(&policy->rwsem);
>         cpus = cpumask_weight(policy->cpus);
> -
> -       if (cpus > 1)
> -               cpumask_clear_cpu(cpu, policy->cpus);
> -       up_write(&policy->rwsem);
> +       up_read(&policy->rwsem);
>
>         /* If cpu is last user of policy, free policy */
> -       if (cpus == 1) {
> +       if (cpus == 0) {
>                 if (has_target()) {
>                         ret = __cpufreq_governor(policy,
>                                         CPUFREQ_GOV_POLICY_EXIT);
> @@ -1447,15 +1459,6 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
>
>                 if (!cpufreq_suspended)
>                         cpufreq_policy_free(policy);
> -       } else if (has_target()) {
> -               ret = __cpufreq_governor(policy, CPUFREQ_GOV_START);
> -               if (!ret)
> -                       ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
> -
> -               if (ret) {
> -                       pr_err("%s: Failed to start governor\n", __func__);
> -                       return ret;
> -               }
>         }

Also, you must mention in the log about an important change you are making.
Don't know if there are any side effects...

You are emptying policy->cpus on removal of last CPU of a policy, which wasn't
the case earlier.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/5] cpufreq: Don't wait for CPU to going offline to restart governor
@ 2014-08-12  4:40 Viresh Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2014-08-12  4:40 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Rafael J . Wysocki, Todd Poynor, Srivatsa S . Bhat,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Stephen Boyd

On 12 August 2014 03:41, Saravana Kannan <skannan@codeaurora.org> wrote:

> Suggestions welcome. I think the current one explains the main point of this change.

Atleast we need a s/going/go

>> There is a down_read() present early in this routine and we better update this
>> at that place only.
>
>
> I would rather not. My v1 patch series was super refactored to allow a lot of reuse, etc. But you guys complained about the diffs being confusing (which was a valid point).
>
> Also, if we are talking about refactoring this, there's room for much better refactor at the end of the series. I will add a patch to the series to do the refactoring.

The kind of change I am suggesting you can be done in the original
patch only. What we told you in the earlier reviews was to break patches
into meaningful sections instead of doing everything in a single patch.

> That only runs if cpu != policy->cpu. This needs to run irrespective of that.

Oh yes, correct.

> You mean the log in the cover letter? Will do.

Coverletter isn't the right place for mentioning such important things
as it never gets commited. I was talking about the commit log.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH v4 0/5] Simplify hotplug/suspend handling
@ 2014-07-25  1:07 Saravana Kannan
  2014-07-25  1:07 ` [PATCH v4 1/5] cpufreq: Don't wait for CPU to going offline to restart governor Saravana Kannan
  0 siblings, 1 reply; 5+ messages in thread
From: Saravana Kannan @ 2014-07-25  1:07 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Todd Poynor, Srivatsa S . Bhat
  Cc: linux-pm, linux-kernel, linux-arm-msm, linux-arm-kernel,
	Saravana Kannan, Stephen Boyd

Series of patchs to simplify policy/sysfs/kobj/locking handling across
suspend/resume

The following have been tested so far on a 2x2 cluster environment:
- Boot with 2 cpus and no cpufreq driver.
- mod probe driver and see cpufreq sysfs files show up only for the 1st cluster.
- Online the rest of the 2 CPUs and have files show up correctly.
- rmmod the driver and see the files go away.
- modprobe again (or back and forth multiples times) and see it work.
- suspend/resume works as expected.
- When a cluster is offline, all read/writes to its sysfs files return an error

v4
- Split it up into smaller patches
- Will handle physical CPU removal correctly
- Fixed earlier mistake of deleting code under !recover_policy
- Dropped some code refactor that reuses a lot of code between add/remove
- Dropped fix for exiting hotplug race with cpufreq driver probe/rmmod
- Dropped changes will come later once this series is acked.


Saravana Kannan (5):
  cpufreq: Don't wait for CPU to going offline to restart governor
  cpufreq: Keep track of which CPU owns the kobj/sysfs nodes separately
  cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend
  cpufreq: Properly handle physical CPU hot-add/hot-remove
  cpufreq: Delete dead code related to policy save/restore

 drivers/cpufreq/cpufreq.c | 238 ++++++++++++++++++----------------------------
 include/linux/cpufreq.h   |   1 +
 2 files changed, 93 insertions(+), 146 deletions(-)

-- 
1.8.2.1

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-12  4:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07  8:54 [PATCH v4 1/5] cpufreq: Don't wait for CPU to going offline to restart governor Viresh Kumar
2014-08-11 22:11 ` Saravana Kannan
  -- strict thread matches above, loose matches on Subject: below --
2014-08-12  4:40 Viresh Kumar
2014-07-25  1:07 [PATCH v4 0/5] Simplify hotplug/suspend handling Saravana Kannan
2014-07-25  1:07 ` [PATCH v4 1/5] cpufreq: Don't wait for CPU to going offline to restart governor Saravana Kannan
2014-07-31 20:47   ` Saravana Kannan

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).