Re: [RFC PATCH] cpufreq: cpufreq-cpu0: do not allow transitions with regulators suspended

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12 November 2013 20:41, Nishanth Menon <nm@xxxxxx> wrote:
> On 11/12/2013 12:03 AM, Viresh Kumar wrote:

>> Yes the problem looks real but there are issues with this patch.
>> - It doesn't solve your problem completely, because you returned -EBUSY,
>> your suspend operation failed and we resumed immediately.
>
> Seems like there was an error handling miss somewhere - for some
> reason, it did suspend properly.

Yeah, its missing in cpufreq_cpu_callback()..

>> But I think the problem can/should be solved some other way.. Looking closely,
>> we got to the problem because we called
>>
>> __cpufreq_governor(policy, CPUFREQ_GOV_START)
>>
>> at the first place. This happened because the policy structure had more than
>> one cpu to take care of and after stopping goveronr for CPU1 it has to start it
>> again for CPU0... But this is really not required as anyway we are going to
>> suspend.
>>
>> Can you try attached patch? I will then repost it formally...
>
> I tried a equivalent of this for v3.12 tag:
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 04548f7..9ec243c 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1186,7 +1186,7 @@ static int __cpufreq_remove_dev_prepare(struct
> device *dev,
>                 return -EINVAL;
>         }
>
> -       if (cpufreq_driver->target) {
> +       if (cpufreq_driver->target && (!frozen ||
> policy->governor_enabled)) {
>                 ret = __cpufreq_governor(policy, CPUFREQ_GOV_STOP);
>                 if (ret) {
>                         pr_err("%s: Failed to stop governor\n", __func__);
> @@ -1252,7 +1252,7 @@ static int __cpufreq_remove_dev_finish(struct
> device *dev,
>
>         /* If cpu is last user of policy, free policy */
>         if (cpus == 1) {
> -               if (cpufreq_driver->target) {
> +               if (cpufreq_driver->target && !frozen) {
>                         ret = __cpufreq_governor(policy,
>                                         CPUFREQ_GOV_POLICY_EXIT);

This is not an equivalent of my patch :)

@@ -1282,7 +1282,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
                if (!frozen)
                        cpufreq_policy_free(policy);
        } else {
-               if (has_target()) {
+               if (has_target() && !frozen) {
                        if ((ret = __cpufreq_governor(policy,
CPUFREQ_GOV_START)) ||
                                        (ret =
__cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))) {


> And I see http://pastebin.mozilla.org/3528478
>
> with a WARN patch for generating call stack.

that's why you got it.. I was really surprised to see it just didn't
worked for you
and believe me it took me a lot of time understanding how isn't it
working for u.
Because I simply believed on your equivalent version and didn't looked at it
closely :)

> Finally squelched warnings with a net diff (v3.12) of
> http://pastebin.mozilla.org/3546062

we don't need that stuff in cpufreq_add_policy_cpu()

> However, ondemand is no longer functioning on resume (governor needs a
> start after being unfrozen.. and obviously by avoiding that entirely
> in frozen case.. not sure if I missed any other)..

It would be, try the right code once. :)
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux