FIXUP: sched/tune: do initialization as a postcore_initicall
authorPatrick Bellasi <patrick.bellasi@arm.com>
Fri, 29 Jul 2016 15:09:03 +0000 (16:09 +0100)
committerAmit Pundir <amit.pundir@linaro.org>
Wed, 14 Sep 2016 09:32:22 +0000 (15:02 +0530)
commit4d8776f3cc03da1bab0ffa507675ef1e184990c8
tree76e0e055ff57871e61e4cab99c1e3651ebe426f0
parent49e4bbf3cc1e3d468f463a46643a574cf0fe419a
FIXUP: sched/tune: do initialization as a postcore_initicall

SchedTune needs to walk the scheduling domains to compute the energy
normalization constants used for PE space filtering. To build such
constants we need the energy model data for each CPU in the system.
However, by walking the SDs as a late initcall stage, the userspace has
been already initialized and it could happen that some CPUs are
hotplugged out.
For example, this could happen if a user-space thermal manager daemon
detects that CPUs are to much hot during the boot process.

To avoid such a race condition we can anticipate the SchedTune
initialization code to be a postcore_initicall. This allows to keep the
SchedTune initialization code as simple as an initcall while still safely
relaying on SDs provided data.

Such calls are executed before user-space is initialized and thus, apart
from the case of unlucky early-init kernel space generated hotplugs,
this solution should be safe enough to get all the data we need.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
[jstultz: fwdported to 4.4]
Signed-off-by: John Stultz <john.stultz@linaro.org>
kernel/sched/tune.c