All of lore.kernel.org
 help / color / mirror / Atom feed
From: skannan@codeaurora.org
To: "Srivatsa S. Bhat" <srivatsa@MIT.EDU>
Cc: Saravana Kannan <skannan@codeaurora.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Todd Poynor <toddpoynor@google.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.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: Fri, 11 Jul 2014 10:02:57 -0000	[thread overview]
Message-ID: <dd77b9ad6c51df71f24ba1f292b2ede8.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <53BF95AB.6030800@mit.edu>


Srivatsa S. Bhat wrote:
> On 07/11/2014 09:48 AM, Saravana Kannan wrote:
>> The CPUfreq driver moves the cpufreq policy ownership between CPUs when
>> CPUs within a cluster (CPUs sharing same policy) go ONLINE/OFFLINE. When
>> moving policy ownership between CPUs, it also moves the cpufreq sysfs
>> directory between CPUs and also fixes up the symlinks of the other CPUs
>> in
>> the cluster.
>>
>> Also, when all the CPUs in a cluster go OFFLINE, all the sysfs nodes and
>> directories are deleted, the kobject is released and the policy is
>> freed.
>> And when the first CPU in a cluster comes up, the policy is reallocated
>> and
>> initialized, kobject is acquired, the sysfs nodes are created or
>> symlinked,
>> etc.
>>
>> All these steps end up creating unnecessarily complicated code and
>> locking.
>> There's no real benefit to adding/removing/moving the sysfs nodes and
>> the
>> policy between CPUs. Other per CPU sysfs directories like power and
>> cpuidle
>> are left alone during hotplug. So there's some precedence to what this
>> patch is trying to do.
>>
>> This patch simplifies a lot of the code and locking by removing the
>> adding/removing/moving of policy/sysfs/kobj and just leaves the cpufreq
>> directory and policy in place irrespective of whether the CPUs are
>> ONLINE/OFFLINE.
>>
>> Leaving the policy, sysfs and kobject in place also brings these
>> additional
>> benefits:
>> * Faster suspend/resume.
>> * Faster hotplug.
>> * Sysfs file permissions maintained across hotplug without userspace
>>   workarounds.
>> * Policy settings and governor tunables maintained across suspend/resume
>>   and hotplug.
>> * Cpufreq stats would be maintained across hotplug for all CPUs and can
>> be
>>   queried even after CPU goes OFFLINE.
>>
>> Change-Id: I39c395e1fee8731880c0fd7c8a9c1d83e2e4b8d0
>> Tested-by: Stephen Boyd <sboyd@codeaurora.org>
>> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
>> ---
>>
>> Preliminary testing has been done. cpufreq directories are getting
>> created
>> properly. Online/offline of CPUs work. Policies remain unmodifiable from
>> userspace when all policy CPUs are offline.
>>
>> Error handling code has NOT been updated.
>>
>> I've added a bunch of FIXME comments next to where I'm not sure about
>> the
>> locking in the existing code. I believe most of the try_lock's were
>> present
>> to prevent a deadlock between sysfs lock and the cpufreq locks. Now that
>> the sysfs entries are not touched after creating them, we should be able
>> to
>> replace most/all of these try_lock's with a normal lock.
>>
>> This patch has more room for code simplification, but I would like to
>> get
>> some acks for the functionality and this code before I do further
>> simplification.
>>
>
> The idea behind this work is very welcome indeed! IMHO, there is nothing
> conceptually wrong in maintaining the per-cpu sysfs files across CPU
> hotplug
> (as long as we take care to return appropriate error codes if userspace
> tries to set values using the control files of offline CPUs). So, it
> really
> boils down to whether or not we get the implementation right; the idea
> itself
> looks fine as of now. Hence, your efforts in making this patch(set) easier
> to
> review will certainly help. Perhaps you can simplify the code later, but
> at
> this point, splitting up this patch into multiple smaller, reviewable
> pieces
> (accompanied by well-written changelogs that explain the intent) is the
> utmost
> priority. Just like Viresh, even I had a hard time reviewing all of this
> in
> one go.
>
> Thank you for taking up this work!

Thanks for the support. I'll keep in mind to keep the patches simple and
not do unnecessary optimizations. But the first patch diff unfortunately
is going to be a bit big since it'll delete a lot of code. :( But I'll add
more detailed commit text or "cover" text in the next one. I don't want to
split up the patch so much that individual ones don't compile or boot.

Maybe after patch v3, if you guys can suggest splitting it up into chunks
that won't involve huge rewrites, I can try to do that.

-Saravana

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

WARNING: multiple messages have this Message-ID (diff)
From: skannan@codeaurora.org (skannan at codeaurora.org)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend
Date: Fri, 11 Jul 2014 10:02:57 -0000	[thread overview]
Message-ID: <dd77b9ad6c51df71f24ba1f292b2ede8.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <53BF95AB.6030800@mit.edu>


Srivatsa S. Bhat wrote:
> On 07/11/2014 09:48 AM, Saravana Kannan wrote:
>> The CPUfreq driver moves the cpufreq policy ownership between CPUs when
>> CPUs within a cluster (CPUs sharing same policy) go ONLINE/OFFLINE. When
>> moving policy ownership between CPUs, it also moves the cpufreq sysfs
>> directory between CPUs and also fixes up the symlinks of the other CPUs
>> in
>> the cluster.
>>
>> Also, when all the CPUs in a cluster go OFFLINE, all the sysfs nodes and
>> directories are deleted, the kobject is released and the policy is
>> freed.
>> And when the first CPU in a cluster comes up, the policy is reallocated
>> and
>> initialized, kobject is acquired, the sysfs nodes are created or
>> symlinked,
>> etc.
>>
>> All these steps end up creating unnecessarily complicated code and
>> locking.
>> There's no real benefit to adding/removing/moving the sysfs nodes and
>> the
>> policy between CPUs. Other per CPU sysfs directories like power and
>> cpuidle
>> are left alone during hotplug. So there's some precedence to what this
>> patch is trying to do.
>>
>> This patch simplifies a lot of the code and locking by removing the
>> adding/removing/moving of policy/sysfs/kobj and just leaves the cpufreq
>> directory and policy in place irrespective of whether the CPUs are
>> ONLINE/OFFLINE.
>>
>> Leaving the policy, sysfs and kobject in place also brings these
>> additional
>> benefits:
>> * Faster suspend/resume.
>> * Faster hotplug.
>> * Sysfs file permissions maintained across hotplug without userspace
>>   workarounds.
>> * Policy settings and governor tunables maintained across suspend/resume
>>   and hotplug.
>> * Cpufreq stats would be maintained across hotplug for all CPUs and can
>> be
>>   queried even after CPU goes OFFLINE.
>>
>> Change-Id: I39c395e1fee8731880c0fd7c8a9c1d83e2e4b8d0
>> Tested-by: Stephen Boyd <sboyd@codeaurora.org>
>> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
>> ---
>>
>> Preliminary testing has been done. cpufreq directories are getting
>> created
>> properly. Online/offline of CPUs work. Policies remain unmodifiable from
>> userspace when all policy CPUs are offline.
>>
>> Error handling code has NOT been updated.
>>
>> I've added a bunch of FIXME comments next to where I'm not sure about
>> the
>> locking in the existing code. I believe most of the try_lock's were
>> present
>> to prevent a deadlock between sysfs lock and the cpufreq locks. Now that
>> the sysfs entries are not touched after creating them, we should be able
>> to
>> replace most/all of these try_lock's with a normal lock.
>>
>> This patch has more room for code simplification, but I would like to
>> get
>> some acks for the functionality and this code before I do further
>> simplification.
>>
>
> The idea behind this work is very welcome indeed! IMHO, there is nothing
> conceptually wrong in maintaining the per-cpu sysfs files across CPU
> hotplug
> (as long as we take care to return appropriate error codes if userspace
> tries to set values using the control files of offline CPUs). So, it
> really
> boils down to whether or not we get the implementation right; the idea
> itself
> looks fine as of now. Hence, your efforts in making this patch(set) easier
> to
> review will certainly help. Perhaps you can simplify the code later, but
> at
> this point, splitting up this patch into multiple smaller, reviewable
> pieces
> (accompanied by well-written changelogs that explain the intent) is the
> utmost
> priority. Just like Viresh, even I had a hard time reviewing all of this
> in
> one go.
>
> Thank you for taking up this work!

Thanks for the support. I'll keep in mind to keep the patches simple and
not do unnecessary optimizations. But the first patch diff unfortunately
is going to be a bit big since it'll delete a lot of code. :( But I'll add
more detailed commit text or "cover" text in the next one. I don't want to
split up the patch so much that individual ones don't compile or boot.

Maybe after patch v3, if you guys can suggest splitting it up into chunks
that won't involve huge rewrites, I can try to do that.

-Saravana

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2014-07-11 10:02 UTC|newest]

Thread overview: 205+ 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-10  2:37 ` Saravana Kannan
2014-07-11  4:18 ` [PATCH v2] " Saravana Kannan
2014-07-11  4:18   ` Saravana Kannan
2014-07-11  6:19   ` Viresh Kumar
2014-07-11  6:19     ` Viresh Kumar
2014-07-11  6:19     ` Viresh Kumar
2014-07-11  9:59     ` skannan
2014-07-11  9:59       ` skannan at codeaurora.org
2014-07-11  9:59       ` skannan
2014-07-11 10:07       ` skannan
2014-07-11 10:07         ` skannan at codeaurora.org
2014-07-11 10:07         ` skannan
2014-07-11 10:52       ` Viresh Kumar
2014-07-11 10:52         ` Viresh Kumar
2014-07-11 10:52         ` Viresh Kumar
2014-07-12  2:44         ` Saravana Kannan
2014-07-12  2:44           ` Saravana Kannan
2014-07-12  2:44           ` Saravana Kannan
2014-07-14  6:09           ` Viresh Kumar
2014-07-14  6:09             ` Viresh Kumar
2014-07-14  6:09             ` Viresh Kumar
2014-07-14 19:08             ` Saravana Kannan
2014-07-14 19:08               ` Saravana Kannan
2014-07-14 19:08               ` Saravana Kannan
2014-07-15  4:35               ` Viresh Kumar
2014-07-15  4:35                 ` Viresh Kumar
2014-07-15  4:35                 ` Viresh Kumar
2014-07-15  5:36                 ` Saravana Kannan
2014-07-15  5:36                   ` Saravana Kannan
2014-07-15  5:36                   ` Saravana Kannan
2014-07-15  5:52                   ` Viresh Kumar
2014-07-15  5:52                     ` Viresh Kumar
2014-07-15  5:52                     ` Viresh Kumar
2014-07-15  6:58                   ` Srivatsa S. Bhat
2014-07-15  6:58                     ` Srivatsa S. Bhat
2014-07-15  6:58                     ` Srivatsa S. Bhat
2014-07-15 17:35                     ` skannan
2014-07-15 17:35                       ` skannan at codeaurora.org
2014-07-15 17:35                       ` skannan
2014-07-16  7:44                       ` Srivatsa S. Bhat
2014-07-16  7:44                         ` Srivatsa S. Bhat
2014-07-16  7:44                         ` Srivatsa S. Bhat
2014-07-16  5:44                     ` Viresh Kumar
2014-07-16  5:44                       ` Viresh Kumar
2014-07-16  5:44                       ` Viresh Kumar
2014-07-16  7:49                       ` Srivatsa S. Bhat
2014-07-16  7:49                         ` Srivatsa S. Bhat
2014-07-16  7:49                         ` Srivatsa S. Bhat
2014-07-12  3:06     ` Saravana Kannan
2014-07-12  3:06       ` Saravana Kannan
2014-07-12  3:06       ` Saravana Kannan
2014-07-14  6:13       ` Viresh Kumar
2014-07-14  6:13         ` Viresh Kumar
2014-07-14  6:13         ` Viresh Kumar
2014-07-14 19:10         ` Saravana Kannan
2014-07-14 19:10           ` Saravana Kannan
2014-07-14 19:10           ` Saravana Kannan
2014-07-11  7:43   ` Srivatsa S. Bhat
2014-07-11  7:43     ` Srivatsa S. Bhat
2014-07-11 10:02     ` skannan [this message]
2014-07-11 10:02       ` skannan at codeaurora.org
2014-07-15 22:47   ` [PATCH v3 0/2] Simplify hotplug/suspend handling Saravana Kannan
2014-07-15 22:47     ` 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-15 22:47       ` Saravana Kannan
2014-07-16  0:28       ` Saravana Kannan
2014-07-16  0:28         ` Saravana Kannan
2014-07-16  8:30         ` Viresh Kumar
2014-07-16  8:30           ` Viresh Kumar
2014-07-16  8:30           ` Viresh Kumar
2014-07-16 19:19           ` Saravana Kannan
2014-07-16 19:19             ` Saravana Kannan
2014-07-16 19:19             ` Saravana Kannan
2014-07-16  8:24       ` Viresh Kumar
2014-07-16  8:24         ` Viresh Kumar
2014-07-16  8:24         ` Viresh Kumar
2014-07-16 11:16         ` Srivatsa S. Bhat
2014-07-16 11:16           ` Srivatsa S. Bhat
2014-07-16 11:16           ` Srivatsa S. Bhat
2014-07-16 13:13           ` Viresh Kumar
2014-07-16 13:13             ` Viresh Kumar
2014-07-16 13:13             ` Viresh Kumar
2014-07-16 18:04             ` Srivatsa S. Bhat
2014-07-16 18:04               ` Srivatsa S. Bhat
2014-07-16 18:04               ` Srivatsa S. Bhat
2014-07-16 19:56             ` Saravana Kannan
2014-07-16 19:56               ` Saravana Kannan
2014-07-16 19:56               ` Saravana Kannan
2014-07-17  5:51               ` Viresh Kumar
2014-07-17  5:51                 ` Viresh Kumar
2014-07-17  5:51                 ` Viresh Kumar
2014-07-16 19:56           ` Saravana Kannan
2014-07-16 19:56             ` Saravana Kannan
2014-07-16 19:56             ` Saravana Kannan
2014-07-17  5:35             ` Viresh Kumar
2014-07-17  5:35               ` Viresh Kumar
2014-07-17  5:35               ` Viresh Kumar
2014-07-18  3:25               ` Saravana Kannan
2014-07-18  3:25                 ` Saravana Kannan
2014-07-18  3:25                 ` Saravana Kannan
2014-07-18  4:19                 ` Viresh Kumar
2014-07-18  4:19                   ` Viresh Kumar
2014-07-18  4:19                   ` Viresh Kumar
2014-07-16 20:25         ` Saravana Kannan
2014-07-16 20:25           ` Saravana Kannan
2014-07-16 20:25           ` Saravana Kannan
2014-07-16 21:45           ` Saravana Kannan
2014-07-16 21:45             ` Saravana Kannan
2014-07-16 21:45             ` Saravana Kannan
2014-07-17  6:24           ` Viresh Kumar
2014-07-17  6:24             ` Viresh Kumar
2014-07-17  6:24             ` Viresh Kumar
2014-07-16 14:29       ` Dirk Brandewie
2014-07-16 14:29         ` Dirk Brandewie
2014-07-16 15:28         ` Viresh Kumar
2014-07-16 15:28           ` Viresh Kumar
2014-07-16 15:28           ` Viresh Kumar
2014-07-16 19:42           ` Saravana Kannan
2014-07-16 19:42             ` Saravana Kannan
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-15 22:47       ` Saravana Kannan
2014-07-16  8:48       ` Viresh Kumar
2014-07-16  8:48         ` Viresh Kumar
2014-07-16  8:48         ` Viresh Kumar
2014-07-16 19:34         ` Saravana Kannan
2014-07-16 19:34           ` Saravana Kannan
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       ` 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-25  1:07         ` Saravana Kannan
2014-07-31 20:47         ` 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-07-25  1:07         ` Saravana Kannan
2014-08-07  9:02         ` Viresh Kumar
2014-08-07  9:02           ` Viresh Kumar
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-25  1:07         ` Saravana Kannan
2014-07-31 21:56         ` Rafael J. Wysocki
2014-07-31 21:56           ` Rafael J. Wysocki
2014-07-31 22:15           ` Saravana Kannan
2014-07-31 22:15             ` Saravana Kannan
2014-07-31 23:48           ` Saravana Kannan
2014-07-31 23:48             ` Saravana Kannan
2014-07-31 23:48             ` Saravana Kannan
2014-08-07 10:51           ` Viresh Kumar
2014-08-07 10:51             ` Viresh Kumar
2014-08-07 10:51             ` Viresh Kumar
2014-08-12  9:17             ` Viresh Kumar
2014-08-12  9:17               ` Viresh Kumar
2014-08-12  9:17               ` Viresh Kumar
2014-08-07 10:48         ` Viresh Kumar
2014-08-07 10:48           ` Viresh Kumar
2014-08-07 10:48           ` Viresh Kumar
2014-08-11 22:13           ` Saravana Kannan
2014-08-11 22:13             ` Saravana Kannan
2014-08-11 22:13             ` Saravana Kannan
2014-08-12  8:51             ` Viresh Kumar
2014-08-12  8:51               ` Viresh Kumar
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-07-25  1:07         ` Saravana Kannan
2014-07-25  1:07         ` Saravana Kannan
2014-08-07 11:02         ` Viresh Kumar
2014-08-07 11:02           ` Viresh Kumar
2014-08-07 11:02           ` Viresh Kumar
2014-08-11 22:15           ` Saravana Kannan
2014-08-11 22:15             ` Saravana Kannan
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-07-25  1:07         ` Saravana Kannan
2014-08-07 11:06         ` Viresh Kumar
2014-08-07 11:06           ` Viresh Kumar
2014-08-07 11:06           ` Viresh Kumar
2014-07-29  5:52       ` [PATCH v4 0/5] Simplify hotplug/suspend handling skannan
2014-07-29  5:52         ` skannan at codeaurora.org
2014-07-29  5:52         ` skannan
2014-07-30  0:29       ` Rafael J. Wysocki
2014-07-30  0:29         ` Rafael J. Wysocki
2014-07-31 20:25         ` Saravana Kannan
2014-07-31 20:25           ` Saravana Kannan
2014-08-07  6:04         ` skannan
2014-08-07  6:04           ` skannan at codeaurora.org
2014-10-16  8:53       ` Viresh Kumar
2014-10-16  8:53         ` Viresh Kumar
2014-10-16  8:53         ` Viresh Kumar
2014-10-23 21:41         ` Saravana Kannan
2014-10-23 21:41           ` Saravana Kannan
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:02   ` Rafael J. Wysocki
2014-07-16 22:35   ` Saravana Kannan
2014-07-16 22:35     ` Saravana Kannan
2014-07-24  3:02   ` Saravana Kannan
2014-07-24  3:02     ` Saravana Kannan
2014-07-24  5:04     ` Viresh Kumar
2014-07-24  5:04       ` Viresh Kumar
2014-07-24  5:04       ` Viresh Kumar
2014-07-24  9:12       ` skannan
2014-07-24  9:12         ` skannan at codeaurora.org
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=dd77b9ad6c51df71f24ba1f292b2ede8.squirrel@www.codeaurora.org \
    --to=skannan@codeaurora.org \
    --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=srivatsa@MIT.EDU \
    --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 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.