All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH Resend] cpufreq: remove sysfs files for CPU which failed to come back after resume
Date: Mon, 23 Dec 2013 12:42:31 +0100	[thread overview]
Message-ID: <87pponx07s.fsf@nemi.mork.no> (raw)
In-Reply-To: <CAKohpon7nn5cpJVNZzzXxbYUkACEsFgyPR20kSSMMsShw0=HVA@mail.gmail.com> (Viresh Kumar's message of "Mon, 23 Dec 2013 16:43:26 +0530")

Viresh Kumar <viresh.kumar@linaro.org> writes:
> On 23 December 2013 16:27, Bjørn Mork <bjorn@mork.no> wrote:
>> I could be missing something, but I haven't noticed any attempt to
>> preserve anything except the sysfs files.
>
> What do you mean by sysfs here? Doesn't the below files mentioned
> by you also come in sysfs?

My apologies here.  I see that you *do* try to preserve the policy over
the suspend.  So I guess it should have worked...

>> I tried modifying the max frequency, using
>>
>>  echo 800000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
>>  echo 800000 >/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
>>
>> After supend + resume the boot CPU still had the modifed maximum, while
>> the non-boot core was reset to the default value.
>
> This is all we were doing. i.e. not removing or putting the kobject which has
> all these files and so shouldn't get reallocated at all..
>
> So, has resumed passed on the first go only? As it was failing for the first
> time in your case and hence this thread. In that case we are going to get
> new files and so all values will be restored to default values.
>
> Otherwise I don't see why we should loose any values here..

Looking at the code I don't see it either.  But the value is reset.
This is with both your patches:

  cpufreq: remove sysfs files for CPUs which failed to come back after resume
  cpufreq: try to resume policies which failed on last resume

applied on top of v3.13-rc5.  I.e. also including Jason's

  cpufreq: Use CONFIG_CPU_FREQ_DEFAULT_* to set initial policy for setpolicy drivers

since -rc4.  I don't know if that confuses the picture or not.  But
these are the results:

 nemi:/tmp# ls -l /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 12:00 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 11:59 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:1401000
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:1401000
 nemi:/tmp# echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 nemi:/tmp# echo 800000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:800000
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:800000
 nemi:/tmp# s2ram 
 KMS graphics driver is in use, skipping quirks.

 ### resume, and then:

 nemi:/tmp# ls -l /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 12:33 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 12:33 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:800000
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:1401000


The driver and governor is

 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_{driver,governor}
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:acpi-cpufreq
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver:acpi-cpufreq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:ondemand
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:ondemand


>>  I changed the gid of
>> both files too, verifying that they were saved and restored as expected.
>> But the value will change to default.
>
> For both boot and non-boot CPUs? I am asking because things should
> be very plain for boot CPU atleast as that is never hot unplugged..
>
> Have you tested this with the latest patches I gave?

See above.  Yes, this is tested with both the two patches in flight and
without any failures on suspend. The non-boot CPU have its settings
reset to default.  The boot CPU keeps the modified values.

>> IMHO it would still be a lot better if this was handled as a true
>> hotplug event, allowing userspace to reset values/modes/owners on
>> resume. Hiding the hotplug event and saving part of the userspace
>> controlled environment is worse than not doing anything at all.
>
> We should be saving everything correctly with the current code,
> with the patches I have sent.. And so things should work as far
> as I can comment.
>
> If you can confirm that these happened despite of latest patches
> then probably I need to test that again on my thinkpad.

That would be great.  This could be just me.  I am quite good at
breaking stuff.


> But I was quite sure this worked :)

Sorry for breaking the illusion :-)



Bjørn

WARNING: multiple messages have this Message-ID (diff)
From: "Bjørn Mork" <bjorn@mork.no>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"cpufreq\@vger.kernel.org" <cpufreq@vger.kernel.org>,
	"linux-pm\@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH Resend] cpufreq: remove sysfs files for CPU which failed to come back after resume
Date: Mon, 23 Dec 2013 12:42:31 +0100	[thread overview]
Message-ID: <87pponx07s.fsf@nemi.mork.no> (raw)
In-Reply-To: <CAKohpon7nn5cpJVNZzzXxbYUkACEsFgyPR20kSSMMsShw0=HVA@mail.gmail.com> (Viresh Kumar's message of "Mon, 23 Dec 2013 16:43:26 +0530")

Viresh Kumar <viresh.kumar@linaro.org> writes:
> On 23 December 2013 16:27, Bjørn Mork <bjorn@mork.no> wrote:
>> I could be missing something, but I haven't noticed any attempt to
>> preserve anything except the sysfs files.
>
> What do you mean by sysfs here? Doesn't the below files mentioned
> by you also come in sysfs?

My apologies here.  I see that you *do* try to preserve the policy over
the suspend.  So I guess it should have worked...

>> I tried modifying the max frequency, using
>>
>>  echo 800000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
>>  echo 800000 >/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
>>
>> After supend + resume the boot CPU still had the modifed maximum, while
>> the non-boot core was reset to the default value.
>
> This is all we were doing. i.e. not removing or putting the kobject which has
> all these files and so shouldn't get reallocated at all..
>
> So, has resumed passed on the first go only? As it was failing for the first
> time in your case and hence this thread. In that case we are going to get
> new files and so all values will be restored to default values.
>
> Otherwise I don't see why we should loose any values here..

Looking at the code I don't see it either.  But the value is reset.
This is with both your patches:

  cpufreq: remove sysfs files for CPUs which failed to come back after resume
  cpufreq: try to resume policies which failed on last resume

applied on top of v3.13-rc5.  I.e. also including Jason's

  cpufreq: Use CONFIG_CPU_FREQ_DEFAULT_* to set initial policy for setpolicy drivers

since -rc4.  I don't know if that confuses the picture or not.  But
these are the results:

 nemi:/tmp# ls -l /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 12:00 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 11:59 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:1401000
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:1401000
 nemi:/tmp# echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 nemi:/tmp# echo 800000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:800000
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:800000
 nemi:/tmp# s2ram 
 KMS graphics driver is in use, skipping quirks.

 ### resume, and then:

 nemi:/tmp# ls -l /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 12:33 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 -rw-rw-r-- 1 root bjorn 4096 Dec 23 12:33 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:800000
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:1401000


The driver and governor is

 nemi:/tmp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_{driver,governor}
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:acpi-cpufreq
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver:acpi-cpufreq
 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:ondemand
 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:ondemand


>>  I changed the gid of
>> both files too, verifying that they were saved and restored as expected.
>> But the value will change to default.
>
> For both boot and non-boot CPUs? I am asking because things should
> be very plain for boot CPU atleast as that is never hot unplugged..
>
> Have you tested this with the latest patches I gave?

See above.  Yes, this is tested with both the two patches in flight and
without any failures on suspend. The non-boot CPU have its settings
reset to default.  The boot CPU keeps the modified values.

>> IMHO it would still be a lot better if this was handled as a true
>> hotplug event, allowing userspace to reset values/modes/owners on
>> resume. Hiding the hotplug event and saving part of the userspace
>> controlled environment is worse than not doing anything at all.
>
> We should be saving everything correctly with the current code,
> with the patches I have sent.. And so things should work as far
> as I can comment.
>
> If you can confirm that these happened despite of latest patches
> then probably I need to test that again on my thinkpad.

That would be great.  This could be just me.  I am quite good at
breaking stuff.


> But I was quite sure this worked :)

Sorry for breaking the illusion :-)



Bjørn

  reply	other threads:[~2013-12-23 11:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 15:56 [PATCH Resend] cpufreq: remove sysfs files for CPU which failed to come back after resume Viresh Kumar
2013-12-20 15:56 ` Viresh Kumar
2013-12-22  1:00 ` Rafael J. Wysocki
2013-12-22  1:00   ` Rafael J. Wysocki
2013-12-23  5:55   ` Bjørn Mork
2013-12-23  5:55     ` Bjørn Mork
2013-12-23  6:02     ` Viresh Kumar
2013-12-23  6:55       ` Bjørn Mork
2013-12-23  6:55         ` Bjørn Mork
2013-12-23  7:55         ` viresh kumar
2013-12-23  9:23           ` Bjørn Mork
2013-12-23  9:23             ` Bjørn Mork
2013-12-23 10:45             ` Viresh Kumar
2013-12-23 10:57               ` Bjørn Mork
2013-12-23 10:57                 ` Bjørn Mork
2013-12-23 11:13                 ` Viresh Kumar
2013-12-23 11:42                   ` Bjørn Mork [this message]
2013-12-23 11:42                     ` Bjørn Mork
2013-12-23 15:45                     ` viresh kumar
2013-12-23 15:45                       ` viresh kumar
2013-12-24  0:35                       ` Rafael J. Wysocki
2013-12-24  0:35                         ` Rafael J. Wysocki
2013-12-24  0:27                         ` Viresh Kumar
2013-12-24  0:43                           ` 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=87pponx07s.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.