Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 467eb53a authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Greg Kroah-Hartman
Browse files

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: 62cd795e ("random: clear fast pool, crng, and batches in cpuhp bring up")
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: Icaa61291207d799bab741be7bab2b636cda09422
parent c566c065
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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,
+16 −12
Original line number Diff line number Diff line
@@ -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,