All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/19] cpufreq locking cleanups and documentation
@ 2016-01-11 17:35 Juri Lelli
  2016-01-11 17:35 ` [RFC PATCH 01/19] cpufreq: do not expose cpufreq_governor_lock Juri Lelli
                   ` (20 more replies)
  0 siblings, 21 replies; 110+ messages in thread
From: Juri Lelli @ 2016-01-11 17:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-pm, peterz, rjw, viresh.kumar, mturquette, steve.muckle,
	vincent.guittot, morten.rasmussen, dietmar.eggemann, juri.lelli

Hi all,

In the context of the ongoing discussion about introducing a simple platform
energy model to guide scheduling decisions (Energy Aware Scheduling [1])
concerns have been expressed by Peter about the component in charge of driving
clock frequency selection (Steve recently posted an update of such component
[2]): https://lkml.org/lkml/2015/8/15/141.

The problem is that, with this new approach, cpufreq core functions need to be
accessed from scheduler hot-paths and the overhead associated with the current
locking scheme might result to be unsustainable. 

Peter's proposed approach of using RCU logic to reduce locking overhead seems
reasonable, but things may not be so straightforward as originally thought. The
very first thing I actually realized when I started looking into this is that
it was hard for me to understand which locking mechanism was protecting which
data structure. As mostly a way to build a better understanding of the current
cpufreq locking scheme and also as preparatory work for implementing RCU logic,
I came up with this set of patches. In fact, at this stage, I would like each
patch to be considered as a question I'm asking rather than a proposed change,
thus the RFC tag for the series; with the intent of documenting current locking
scheme and modifying it a bit in order to make RCU logic implementation easier.
Actually, as you'll soon notice, I didn't really start from scratch. Mike
shared with me some patches he has been developing while looking at the same
problem. I've given Mike attribution for the patches that I took unchanged from
him, with thanks for sharing his findings with me.

High level description of patches:

 o [01-04] cleanup and move code around to make things (hopefully) cleaner
 o [05-14] insert lockdep assertions and fix uncovered erroneous situations
 o [15-18] remove overkill usage of locking mechanism
 o 19      adds documentation for the cleaned up locking scheme

With Viresh' tests [3] on both arm TC2 and arm64 Juno boards I'm not seeing
anything bad happening. However, coverage is really small (as is my personal
confidence of not breaking things for other confs :-)).

This set is based on top of linux-pm/linux-next as of today and it is also
available from here:

 git://linux-arm.org/linux-jl.git upstream/cpufreq_cleanups

Comments, concerns and rants are the primary goal of this posting; I'm thus
looking forward to them.

Best,

- Juri

[1] https://lkml.org/lkml/2015/7/7/754
[2] https://lkml.org/lkml/2015/12/9/35 
[3] https://git.linaro.org/people/viresh.kumar/cpufreq-tests.git

Juri Lelli (16):
  cpufreq: kill for_each_policy
  cpufreq: bring data structures close to their locks
  cpufreq: assert locking when accessing cpufreq_policy_list
  cpufreq: always access cpufreq_policy_list while holding
    cpufreq_driver_lock
  cpufreq: assert locking when accessing cpufreq_governor_list
  cpufreq: fix warning for cpufreq_init_policy unlocked access to
    cpufreq_governor_list
  cpufreq: fix warning for show_scaling_available_governors unlocked
    access to cpufreq_governor_list
  cpufreq: assert policy->rwsem is held in cpufreq_set_policy
  cpufreq: assert policy->rwsem is held in __cpufreq_governor
  cpufreq: fix locking of policy->rwsem in cpufreq_init_policy
  cpufreq: fix locking of policy->rwsem in cpufreq_offline_prepare
  cpufreq: fix locking of policy->rwsem in cpufreq_offline_finish
  cpufreq: remove useless usage of cpufreq_governor_mutex in
    __cpufreq_governor
  cpufreq: hold policy->rwsem across CPUFREQ_GOV_POLICY_EXIT
  cpufreq: stop checking for cpufreq_driver being present in
    cpufreq_cpu_get
  cpufreq: documentation: document locking scheme

Michael Turquette (3):
  cpufreq: do not expose cpufreq_governor_lock
  cpufreq: merge governor lock and mutex
  cpufreq: remove transition_lock

 Documentation/cpu-freq/core.txt    |  44 +++++++++++++
 drivers/cpufreq/cpufreq.c          | 132 +++++++++++++++++++++++--------------
 drivers/cpufreq/cpufreq_governor.h |   2 -
 include/linux/cpufreq.h            |   5 --
 4 files changed, 125 insertions(+), 58 deletions(-)

-- 
2.2.2

^ permalink raw reply	[flat|nested] 110+ messages in thread

end of thread, other threads:[~2016-02-03  6:59 UTC | newest]

Thread overview: 110+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11 17:35 [RFC PATCH 00/19] cpufreq locking cleanups and documentation Juri Lelli
2016-01-11 17:35 ` [RFC PATCH 01/19] cpufreq: do not expose cpufreq_governor_lock Juri Lelli
2016-01-12  8:56   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 02/19] cpufreq: merge governor lock and mutex Juri Lelli
2016-01-12  9:00   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 03/19] cpufreq: kill for_each_policy Juri Lelli
2016-01-12  9:01   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 04/19] cpufreq: bring data structures close to their locks Juri Lelli
2016-01-11 22:05   ` Peter Zijlstra
2016-01-11 23:03     ` Rafael J. Wysocki
2016-01-12  8:27       ` Peter Zijlstra
2016-01-12 10:43         ` Juri Lelli
2016-01-12 16:47         ` Rafael J. Wysocki
2016-01-11 22:07   ` Peter Zijlstra
2016-01-12  9:27     ` Viresh Kumar
2016-01-12 11:21       ` Juri Lelli
2016-01-12 11:58         ` Peter Zijlstra
2016-01-12 12:36           ` Juri Lelli
2016-01-12 15:26             ` Juri Lelli
2016-01-12 15:58               ` Peter Zijlstra
2016-01-12  9:10   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 05/19] cpufreq: assert locking when accessing cpufreq_policy_list Juri Lelli
2016-01-12  9:34   ` Viresh Kumar
2016-01-12 11:44     ` Juri Lelli
2016-01-13  5:59       ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 06/19] cpufreq: always access cpufreq_policy_list while holding cpufreq_driver_lock Juri Lelli
2016-01-12  9:57   ` Viresh Kumar
2016-01-12 12:08     ` Juri Lelli
2016-01-13  6:01       ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list Juri Lelli
2016-01-12 10:01   ` Viresh Kumar
2016-01-12 15:33     ` Juri Lelli
2016-01-11 17:35 ` [RFC PATCH 08/19] cpufreq: fix warning for cpufreq_init_policy unlocked access to cpufreq_governor_list Juri Lelli
2016-01-12 10:09   ` Viresh Kumar
2016-01-12 15:52     ` Juri Lelli
2016-01-13  6:07       ` Viresh Kumar
2016-01-14 16:35         ` Juri Lelli
2016-01-18  5:23           ` Viresh Kumar
2016-01-18 15:19             ` Juri Lelli
2016-01-11 17:35 ` [RFC PATCH 09/19] cpufreq: fix warning for show_scaling_available_governors " Juri Lelli
2016-01-12 10:13   ` Viresh Kumar
2016-01-13 10:25     ` Juri Lelli
2016-01-13 10:32       ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 10/19] cpufreq: assert policy->rwsem is held in cpufreq_set_policy Juri Lelli
2016-01-12 10:15   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Juri Lelli
2016-01-12 10:20   ` Viresh Kumar
2016-01-30  0:33     ` Saravana Kannan
2016-01-30 11:49       ` Rafael J. Wysocki
2016-02-01  6:09         ` Viresh Kumar
2016-02-01 10:22           ` Rafael J. Wysocki
2016-02-01 20:24             ` Saravana Kannan
2016-02-01 21:00               ` Rafael J. Wysocki
2016-02-02  6:36                 ` Viresh Kumar
2016-02-02 21:38                   ` Saravana Kannan
2016-02-02  6:34               ` Viresh Kumar
2016-02-02 21:37                 ` Saravana Kannan
2016-02-03  2:13                   ` Viresh Kumar
2016-02-03  4:04                     ` Saravana Kannan
2016-02-03  5:02                       ` Viresh Kumar
2016-02-03  5:06                         ` Saravana Kannan
2016-02-03  6:59                           ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 12/19] cpufreq: fix locking of policy->rwsem in cpufreq_init_policy Juri Lelli
2016-01-12 10:39   ` Viresh Kumar
2016-01-14 17:58     ` Juri Lelli
2016-01-11 17:35 ` [RFC PATCH 13/19] cpufreq: fix locking of policy->rwsem in cpufreq_offline_prepare Juri Lelli
2016-01-12 10:54   ` Viresh Kumar
2016-01-15 12:37     ` Juri Lelli
2016-01-11 17:35 ` [RFC PATCH 14/19] cpufreq: fix locking of policy->rwsem in cpufreq_offline_finish Juri Lelli
2016-01-12 11:02   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 15/19] cpufreq: remove useless usage of cpufreq_governor_mutex in __cpufreq_governor Juri Lelli
2016-01-12 11:06   ` Viresh Kumar
2016-01-15 16:30     ` Juri Lelli
2016-01-18  5:50       ` Viresh Kumar
2016-01-19 16:49         ` Juri Lelli
2016-01-20  7:29           ` Viresh Kumar
2016-01-20 10:17             ` Juri Lelli
2016-01-20 10:18               ` Viresh Kumar
2016-01-20 10:27                 ` Juri Lelli
2016-01-20 10:30                   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 16/19] cpufreq: hold policy->rwsem across CPUFREQ_GOV_POLICY_EXIT Juri Lelli
2016-01-12 11:09   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 17/19] cpufreq: stop checking for cpufreq_driver being present in cpufreq_cpu_get Juri Lelli
2016-01-12 11:17   ` Viresh Kumar
2016-01-11 17:35 ` [RFC PATCH 18/19] cpufreq: remove transition_lock Juri Lelli
2016-01-12 11:24   ` Viresh Kumar
2016-01-13  0:54     ` Michael Turquette
2016-01-13  6:31       ` Viresh Kumar
     [not found]         ` <20160113182131.1168.45753@quark.deferred.io>
2016-01-14  9:44           ` Juri Lelli
2016-01-14 10:32           ` Viresh Kumar
2016-01-14 13:52             ` Juri Lelli
2016-01-18  5:09               ` Viresh Kumar
2016-01-19 14:00           ` Peter Zijlstra
2016-01-19 14:42             ` Juri Lelli
2016-01-19 15:30               ` Peter Zijlstra
2016-01-19 16:01                 ` Juri Lelli
2016-01-19 19:17                   ` Peter Zijlstra
2016-01-19 19:21                     ` Peter Zijlstra
2016-01-19 21:52                       ` Rafael J. Wysocki
2016-01-20 17:04                         ` Peter Zijlstra
2016-01-20 22:12                           ` Rafael J. Wysocki
2016-01-20 22:38                             ` Peter Zijlstra
2016-01-20 23:33                               ` Rafael J. Wysocki
2016-01-20 12:59                       ` Juri Lelli
2016-01-11 17:36 ` [RFC PATCH 19/19] cpufreq: documentation: document locking scheme Juri Lelli
2016-01-11 22:45 ` [RFC PATCH 00/19] cpufreq locking cleanups and documentation Rafael J. Wysocki
2016-01-12 10:46   ` Juri Lelli
2016-01-30  0:57 ` Saravana Kannan
2016-02-01  6:02   ` Viresh Kumar
2016-02-01 12:06   ` Juri Lelli

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.