linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa@MIT.EDU>
To: Saravana Kannan <skannan@codeaurora.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Todd Poynor <toddpoynor@google.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Stephen Boyd <sboyd@codeaurora.org>
Subject: Re: [PATCH v2] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend
Date: Tue, 15 Jul 2014 12:28:54 +0530	[thread overview]
Message-ID: <53C4D12E.3040807@mit.edu> (raw)
In-Reply-To: <53C4BDFB.70707@codeaurora.org>

On 07/15/2014 11:06 AM, Saravana Kannan wrote:
> On 07/14/2014 09:35 PM, Viresh Kumar wrote:
>> On 15 July 2014 00:38, Saravana Kannan <skannan@codeaurora.org> wrote:
>>> Yeah, it definitely crashes if policy->cpu if an offline cpu. Because
>>> the
>>> mutex would be uninitialized if it's stopped after boot or it would
>>> never
>>> have been initialized (depending on how you fix policy->cpu at boot).
>>>
>>> Look at this snippet on the actual tree and it should be pretty evident.
>>
>> Yeah, I missed it. So the problem is we initialize timer_mutex's for
>> policy->cpus. So we need to do that just for policy->cpu and also we
>> don't
>> need a per-cpu timer_mutex anymore.
>>
> 
> Btw, I tried to take a stab at removing any assumption in cpufreq code
> about policy->cpu being ONLINE.

Wait, allowing an offline CPU to be the policy->cpu (i.e., the CPU which is
considered as the master of the policy/group) is just absurd. If there is
no leader, there is no army. We should NOT sacrifice sane semantics for the
sake of simplifying the code.

> There are 160 instances of those of with
> 23 are in cpufreq.c
>

And that explains why. It is just *natural* to assume that the CPUs governed
by a policy are online. Especially so for the CPU which is supposed to be
the policy leader. Let us please not change that - it will become
counter-intuitive if we do so. [ The other reason is that physical hotplug
is also possible on some systems... in that case your code might make a CPU
which is not even present (but possible) as the policy->cpu.. and great 'fun'
will ensue after that ;-( ]

The goal of this patchset should be to just de-couple the sysfs files/ownership
from the policy->cpu to an extent where it doesn't matter who owns those
files, and probably make it easier to do CPU hotplug without having to
destroy and recreate the files on every hotplug operation.

This is exactly why the _implementation_ matters in this particular case -
if we can't achieve the simplification by keeping sane semantics, then we
shouldn't do the simplification!

That said, I think we should keep trying - we haven't exhausted all ideas
yet :-)

Regards,
Srivatsa S. Bhat

> So, even if we are sure cpufreq.c is fine, it's 137 other uses spread
> across all the other files. I definitely don't want to try and fix those
> as part of this patch. Way too risky and hard to get the test coverage
> it would need. Even some of the acpi cpufreq drivers seem to be making
> this assumption.
> 
> Btw, I think v3 is done. I did some testing and it was fine. But made
> some minor changes. Will test tomorrow to make sure I didn't break
> anything with the minor changes and then send them out.
> 

  parent reply	other threads:[~2014-07-15  7:06 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10  2:37 [PATCH] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Saravana Kannan
2014-07-11  4:18 ` [PATCH v2] " Saravana Kannan
2014-07-11  6:19   ` Viresh Kumar
2014-07-11  9:59     ` skannan
2014-07-11 10:07       ` skannan
2014-07-11 10:52       ` Viresh Kumar
2014-07-12  2:44         ` Saravana Kannan
2014-07-14  6:09           ` Viresh Kumar
2014-07-14 19:08             ` Saravana Kannan
2014-07-15  4:35               ` Viresh Kumar
2014-07-15  5:36                 ` Saravana Kannan
2014-07-15  5:52                   ` Viresh Kumar
2014-07-15  6:58                   ` Srivatsa S. Bhat [this message]
2014-07-15 17:35                     ` skannan
2014-07-16  7:44                       ` Srivatsa S. Bhat
2014-07-16  5:44                     ` Viresh Kumar
2014-07-16  7:49                       ` Srivatsa S. Bhat
2014-07-12  3:06     ` Saravana Kannan
2014-07-14  6:13       ` Viresh Kumar
2014-07-14 19:10         ` Saravana Kannan
2014-07-11  7:43   ` Srivatsa S. Bhat
2014-07-11 10:02     ` skannan
2014-07-15 22:47   ` [PATCH v3 0/2] Simplify hotplug/suspend handling Saravana Kannan
2014-07-15 22:47     ` [PATCH v3 1/2] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Saravana Kannan
2014-07-16  0:28       ` Saravana Kannan
2014-07-16  8:30         ` Viresh Kumar
2014-07-16 19:19           ` Saravana Kannan
2014-07-16  8:24       ` Viresh Kumar
2014-07-16 11:16         ` Srivatsa S. Bhat
2014-07-16 13:13           ` Viresh Kumar
2014-07-16 18:04             ` Srivatsa S. Bhat
2014-07-16 19:56             ` Saravana Kannan
2014-07-17  5:51               ` Viresh Kumar
2014-07-16 19:56           ` Saravana Kannan
2014-07-17  5:35             ` Viresh Kumar
2014-07-18  3:25               ` Saravana Kannan
2014-07-18  4:19                 ` Viresh Kumar
2014-07-16 20:25         ` Saravana Kannan
2014-07-16 21:45           ` Saravana Kannan
2014-07-17  6:24           ` Viresh Kumar
2014-07-16 14:29       ` Dirk Brandewie
2014-07-16 15:28         ` Viresh Kumar
2014-07-16 19:42           ` Saravana Kannan
2014-07-15 22:47     ` [PATCH v3 2/2] cpufreq: Simplify and fix mutual exclusion with hotplug Saravana Kannan
2014-07-16  8:48       ` Viresh Kumar
2014-07-16 19:34         ` Saravana Kannan
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
2014-07-25  1:07       ` [PATCH v4 2/5] cpufreq: Keep track of which CPU owns the kobj/sysfs nodes separately Saravana Kannan
2014-08-07  9:02         ` Viresh Kumar
2014-07-25  1:07       ` [PATCH v4 3/5] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Saravana Kannan
2014-07-31 21:56         ` Rafael J. Wysocki
2014-07-31 22:15           ` Saravana Kannan
2014-07-31 23:48           ` Saravana Kannan
2014-08-07 10:51           ` Viresh Kumar
2014-08-12  9:17             ` Viresh Kumar
2014-08-07 10:48         ` Viresh Kumar
2014-08-11 22:13           ` Saravana Kannan
2014-08-12  8:51             ` Viresh Kumar
2014-07-25  1:07       ` [PATCH v4 4/5] cpufreq: Properly handle physical CPU hot-add/hot-remove Saravana Kannan
2014-08-07 11:02         ` Viresh Kumar
2014-08-11 22:15           ` Saravana Kannan
2014-07-25  1:07       ` [PATCH v4 5/5] cpufreq: Delete dead code related to policy save/restore Saravana Kannan
2014-08-07 11:06         ` Viresh Kumar
2014-07-29  5:52       ` [PATCH v4 0/5] Simplify hotplug/suspend handling skannan
2014-07-30  0:29       ` Rafael J. Wysocki
2014-07-31 20:25         ` Saravana Kannan
2014-08-07  6:04         ` skannan
2014-10-16  8:53       ` Viresh Kumar
2014-10-23 21:41         ` Saravana Kannan
2014-07-16 22:02 ` [PATCH] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Rafael J. Wysocki
2014-07-16 22:35   ` Saravana Kannan
2014-07-24  3:02   ` Saravana Kannan
2014-07-24  5:04     ` Viresh Kumar
2014-07-24  9:12       ` skannan

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=53C4D12E.3040807@mit.edu \
    --to=srivatsa@mit.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.org \
    --cc=skannan@codeaurora.org \
    --cc=toddpoynor@google.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;
as well as URLs for NNTP newsgroup(s).