From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Lan Tianyu" <lantianyu1986@gmail.com>,
"Toralf Förster" <toralf.foerster@gmx.de>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
cpufreq@vger.kernel.org,
"Linux PM list" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Jarzmik, Robert" <robert.jarzmik@intel.com>,
"R, Durgadoss" <durgadoss.r@intel.com>,
"Dirk Brandewie" <dirk.brandewie@gmail.com>,
tianyu.lan@intel.com
Subject: Re: [PATCH] cpufreq: Fix cpufreq regression after suspend/resume
Date: Thu, 11 Jul 2013 20:08:54 +0530 [thread overview]
Message-ID: <51DEC37E.2070500@linux.vnet.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1307111010180.1276-100000@iolanthe.rowland.org>
On 07/11/2013 07:53 PM, Alan Stern wrote:
> On Thu, 11 Jul 2013, Srivatsa S. Bhat wrote:
>
>> Oops! You are right. Hmm, this looks quite difficult to get right :(
>> There are multiple challenges here:
>>
>> 1. The sysfs files must not be removed during cpu_down, and not initialized
>>
>> during cpu_up. That would help us preserve the file permissions.
>> 2. But we should ensure that we really do the cpufreq-core parts of the cpu
>> initialization during cpu_up. If we fail to free some of the data-structures
>> during cpu_down, the cpu_up callback will think that a full-init is not
>> required and not do its job. That will make cpufreq behave erratically after
>> suspend/resume and take us back to square one.
>>
>> 3. A full re-init in the cpu_up callback also involves memory allocations.
>> So if we don't release the memory in the cpu_down callback, we'll end up
>> in a memory leak.
>>
>> I tried to address all these in this patch, but you found yet another serious
>> loop-hole. I guess I'm out of ideas now... if anybody has any thoughts on how
>> to get this right, then I'm all ears. Else, we'll just revert the original
>> commit like Rafael suggested and leave it upto userspace to save and restore
>> the permissions across suspend/resume if it wants ;-(
>
> Asking as a naive outsider who is completely unfamiliar with the code,
> why are any of these things at all troublesome?
>
> Can't cpu_up tell the difference between activating a brand-new
> CPU and reactivating one that was present before but was
> temporarily disabled?
>
> Doesn't cpu_up know which data structures get freed when an
> active CPU is temporarily deactivated?
>
> Doesn't cpu_down know what memory gets allocated in cpu_up?
> Can't it deallocate just the right parts for the type of
> transition it is doing?
>
> It sounds like you're really asking how to make sure that cpu_up and
> cpu_down both know what the other is doing, so that each can do the
> opposite of the other. That doesn't sound hard.
>
It would not have been hard if the code had been already structured that
way. Currently, the code is quite a bit entangled, and it doesn't distinguish
the "temporarily deactivated" and the "fully torn-down" cases. To add to the
mess, the code is generously sprinkled with notifiers that are invoked every
now and then (which depend on previous init steps etc).
But the bottomline is that this is purely a code-reorganization issue,
nothing more than that. And hopefully we'll be able to separate out the
"temporarily deactivated" and the "fully down" cases reasonably well, such
that we can preserve the sysfs file permissions easily across suspend/resume.
That's the code reorganization I'm working on at the moment; I'll post it
out as soon as I'm done.
Regards,
Srivatsa S. Bhat
next prev parent reply other threads:[~2013-07-11 14:42 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51C08370.4050906@gmx.de>
[not found] ` <1778593.ufLkNuJuaY@vostro.rjw.lan>
[not found] ` <51CB34A2.7090404@gmx.de>
2013-06-26 19:12 ` 3.10-rcX: cpu governor ondemand doesn't scale well after s2ram Rafael J. Wysocki
2013-06-27 4:10 ` Viresh Kumar
2013-06-27 18:00 ` Toralf Förster
2013-06-28 3:44 ` Viresh Kumar
2013-06-28 15:25 ` Toralf Förster
2013-06-29 13:30 ` Viresh Kumar
2013-06-29 17:50 ` Toralf Förster
2013-06-30 14:22 ` Rafael J. Wysocki
2013-06-30 15:15 ` Viresh Kumar
2013-06-30 16:20 ` Toralf Förster
2013-06-30 16:21 ` Toralf Förster
2013-06-30 16:33 ` Srivatsa S. Bhat
2013-06-30 17:05 ` Toralf Förster
2013-06-30 18:52 ` [PATCH] cpufreq: Fix cpufreq regression after suspend/resume Srivatsa S. Bhat
2013-06-30 22:46 ` Rafael J. Wysocki
2013-07-10 20:50 ` Toralf Förster
2013-07-10 22:29 ` Srivatsa S. Bhat
2013-07-11 5:40 ` Lan Tianyu
2013-07-11 6:23 ` Srivatsa S. Bhat
2013-07-11 14:03 ` Lan Tianyu
2013-07-11 14:24 ` Srivatsa S. Bhat
2013-07-11 14:23 ` Alan Stern
2013-07-11 14:38 ` Srivatsa S. Bhat [this message]
2013-07-13 10:16 ` Paul Bolle
2013-07-13 12:52 ` Paul Bolle
2013-07-15 6:13 ` Srivatsa S. Bhat
2013-07-03 19:46 ` 3.10-rcX: cpu governor ondemand doesn't scale well after s2ram Toralf Förster
2013-07-04 6:55 ` Srivatsa S. Bhat
2013-07-04 7:01 ` Viresh Kumar
2013-07-04 7:08 ` Srivatsa S. Bhat
2013-07-04 7:58 ` Viresh Kumar
2013-07-10 19:31 ` Toralf Förster
2013-07-04 8:04 ` Viresh Kumar
2013-07-04 8:23 ` Viresh Kumar
2013-07-04 16:42 ` Toralf Förster
2013-07-05 4:35 ` Viresh Kumar
2013-07-05 14:06 ` Toralf Förster
2013-06-28 17:17 ` Toralf Förster
2013-06-28 18:56 ` Rafael J. Wysocki
2013-06-28 18:51 ` Toralf Förster
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=51DEC37E.2070500@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=cpufreq@vger.kernel.org \
--cc=dirk.brandewie@gmail.com \
--cc=durgadoss.r@intel.com \
--cc=lantianyu1986@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=robert.jarzmik@intel.com \
--cc=stern@rowland.harvard.edu \
--cc=tianyu.lan@intel.com \
--cc=toralf.foerster@gmx.de \
--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;
as well as URLs for NNTP newsgroup(s).