ANDROID: cpu/hotplug: avoid breaking Android ABI by fusing cpuhp steps

We can't add more values to the cpuhp_state enum, lest we break some
vendor module. So instead break out existing steps into helper functions
which call both steps. Fortunately none of these steps return anything
other than 0, so we don't need to worry about rollback.

Bug: 161946584
Fixes: 62cd795e46 ("random: clear fast pool, crng, and batches in cpuhp bring up")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Icaa61291207d799bab741be7bab2b636cda09422
This commit is contained in:
Jason A. Donenfeld 2022-06-23 15:17:14 +02:00 committed by Greg Kroah-Hartman
parent c566c065e8
commit 467eb53acd
2 changed files with 16 additions and 14 deletions

View File

@ -60,7 +60,6 @@ enum cpuhp_state {
CPUHP_LUSTRE_CFS_DEAD,
CPUHP_AP_ARM_CACHE_B15_RAC_DEAD,
CPUHP_PADATA_DEAD,
CPUHP_RANDOM_PREPARE,
CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE,
@ -177,7 +176,6 @@ enum cpuhp_state {
CPUHP_AP_PERF_POWERPC_TRACE_IMC_ONLINE,
CPUHP_AP_WATCHDOG_ONLINE,
CPUHP_AP_WORKQUEUE_ONLINE,
CPUHP_AP_RANDOM_ONLINE,
CPUHP_AP_RCUTREE_ONLINE,
CPUHP_AP_BASE_CACHEINFO_ONLINE,
CPUHP_AP_ONLINE_DYN,

View File

@ -1446,6 +1446,20 @@ core_initcall(cpu_hotplug_pm_sync_init);
int __boot_cpu_id;
/* Horrific hacks because we can't add more to cpuhp_hp_states. */
static int random_and_perf_prepare_fusion(unsigned int cpu)
{
perf_event_init_cpu(cpu);
random_prepare_cpu(cpu);
return 0;
}
static int random_and_workqueue_online_fusion(unsigned int cpu)
{
workqueue_online_cpu(cpu);
random_online_cpu(cpu);
return 0;
}
#endif /* CONFIG_SMP */
/* Boot processor state steps */
@ -1464,14 +1478,9 @@ static struct cpuhp_step cpuhp_hp_states[] = {
},
[CPUHP_PERF_PREPARE] = {
.name = "perf:prepare",
.startup.single = perf_event_init_cpu,
.startup.single = random_and_perf_prepare_fusion,
.teardown.single = perf_event_exit_cpu,
},
[CPUHP_RANDOM_PREPARE] = {
.name = "random:prepare",
.startup.single = random_prepare_cpu,
.teardown.single = NULL,
},
[CPUHP_WORKQUEUE_PREP] = {
.name = "workqueue:prepare",
.startup.single = workqueue_prepare_cpu,
@ -1585,14 +1594,9 @@ static struct cpuhp_step cpuhp_hp_states[] = {
},
[CPUHP_AP_WORKQUEUE_ONLINE] = {
.name = "workqueue:online",
.startup.single = workqueue_online_cpu,
.startup.single = random_and_workqueue_online_fusion,
.teardown.single = workqueue_offline_cpu,
},
[CPUHP_AP_RANDOM_ONLINE] = {
.name = "random:online",
.startup.single = random_online_cpu,
.teardown.single = NULL,
},
[CPUHP_AP_RCUTREE_ONLINE] = {
.name = "RCU/tree:online",
.startup.single = rcutree_online_cpu,