public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	"Jarzmik, Robert" <robert.jarzmik@intel.com>,
	"R, Durgadoss" <durgadoss.r@intel.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: S3, SMP non boot cpus and /sys/devices/system/cpu[1-9]/cpufreq/scaling_max_freq
Date: Wed, 15 May 2013 12:00:49 +0530	[thread overview]
Message-ID: <51932B99.403@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAKohpomxpPGtLU6ud816CqZtH=aFEK88FZSPL4aUNbusGiomvQ@mail.gmail.com>

On 05/15/2013 11:46 AM, Viresh Kumar wrote:
> On 14 May 2013 19:24, Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> wrote:
>> From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
>> Subject: [PATCH v2] cpufreq: Preserve sysfs file permissions across suspend/resume
>>
>> The file permissions of cpufreq per-cpu sysfs files are not preserved across
>> suspend/resume because we internally go through the CPU Hotplug path which
>> reinitializes the file permissions on CPU online.
>>
>> But the user is not supposed to know that we are using CPU hotplug
>> internally within suspend/resume (IOW, the kernel should not silently wreck
>> the user-set file permissions across a suspend cycle). Therefore, we need to
>> preserve the file permissions as it is, across suspend/resume.
>>
>> The simplest way to achieve that is to just not touch the sysfs files at
>> all - ie., just ignore the CPU hotplug events in the suspend/resume path
>> (_FROZEN) in the cpufreq hotplug callback.
>>
>> Reported-by: Robert Jarzmik <robert.jarzmik@intel.com>
>> Reported-by: Durgadoss R <durgadoss.r@intel.com>
>> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
>> ---
>> v2: Use UP_CANCELED_FROZEN notification to delete the sysfs files if the
>> CPUs don't come up during resume.
> 
> Is it also possible that more cpus come up after resume? i.e. we had 2 cpus
> at suspend and 3 at resume?

Nope. That's not possible. While suspending we note down the online non-boot
CPUs we have, in a cpumask, and take them offline. On resume, we try to online
the CPUs in that cpumask. So there is no chance for more CPUs to come up during
resume.

> 
>>  drivers/cpufreq/cpufreq.c       |    4 +---
>>  drivers/cpufreq/cpufreq_stats.c |    7 ++++---
>>  2 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 1b8a48e..284ba63 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1832,15 +1832,13 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
>>         if (dev) {
>>                 switch (action) {
>>                 case CPU_ONLINE: 
>> -               case CPU_ONLINE_FROZEN:
>>                         cpufreq_add_dev(dev, NULL);
>>                         break;
>>                 case CPU_DOWN_PREPARE:
>> -               case CPU_DOWN_PREPARE_FROZEN:
>> +               case CPU_UP_CANCELED_FROZEN:
>>                         __cpufreq_remove_dev(dev, NULL);
>>                         break;
>>                 case CPU_DOWN_FAILED:
>> -               case CPU_DOWN_FAILED_FROZEN:
>>                         cpufreq_add_dev(dev, NULL);
>>                         break;
> 
> I have forgotten meaning of these flags now :(

Take a quick peek at kernel/cpu.c and include/linux/cpu.h and all those
memories will come rushing back ;-)

> So, CPU_ONLINE, CPU_DOWN_PREPARE and CPU_DOWN_FAILED
> are called when cpus are added/removed (but not for cpu_down in suspend
> resume)? and _FROZEN ones are only used for s2r/s2d?
> 

Yes, that's right. For the suspend/resume and hibernate/restore case, all
the notifiers use the _FROZEN flags. The regular hotplug notifications use
the flags without the _FROZEN suffix.

Regards,
Srivatsa S. Bhat


  reply	other threads:[~2013-05-15  6:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 13:01 S3, SMP non boot cpus and /sys/devices/system/cpu[1-9]/cpufreq/scaling_max_freq Jarzmik, Robert
2013-05-13 20:40 ` Srivatsa S. Bhat
2013-05-13 23:32   ` Rafael J. Wysocki
2013-05-14  9:06     ` Jarzmik, Robert
2013-05-14 10:09       ` Srivatsa S. Bhat
2013-05-14 10:22         ` Viresh Kumar
2013-05-14 10:27           ` Srivatsa S. Bhat
2013-05-14 11:22             ` Rafael J. Wysocki
2013-05-14 11:20               ` R, Durgadoss
2013-05-14 11:33                 ` Rafael J. Wysocki
2013-05-14 11:36                   ` R, Durgadoss
2013-05-14 11:54                     ` Jarzmik, Robert
2013-05-14 12:34                       ` Srivatsa S. Bhat
2013-05-14 13:00                         ` Rafael J. Wysocki
2013-05-14 13:54                           ` Srivatsa S. Bhat
2013-05-14 20:22                             ` Rafael J. Wysocki
2013-05-15  8:24                               ` Jarzmik, Robert
2013-05-15  8:37                               ` R, Durgadoss
2013-05-15  6:16                             ` Viresh Kumar
2013-05-15  6:30                               ` Srivatsa S. Bhat [this message]
2013-05-15  6:45                             ` Viresh Kumar
2013-05-15  7:33                               ` Srivatsa S. Bhat
2013-05-15  7:44                                 ` Viresh Kumar
2013-05-15  8:18                                   ` Srivatsa S. Bhat
2013-05-15 20:50                             ` Rafael J. Wysocki
2013-05-14 12:58                       ` Rafael J. Wysocki
2013-05-14 14:01                         ` Jarzmik, Robert
2013-05-14 14:16                           ` Srivatsa S. Bhat
2013-05-14 14:05                       ` Alan Stern
2013-05-15  9:20                         ` Jarzmik, Robert
2013-05-15 14:15                           ` Alan Stern

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=51932B99.403@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=durgadoss.r@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=robert.jarzmik@intel.com \
    --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