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

Commit 72397113 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: 5064550d422d ("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
(cherry picked from commit 2c26b627277ef5ac79cfe10cf8183373ddddc4da)
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 25e813dd
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ enum cpuhp_state {
	CPUHP_IOMMU_INTEL_DEAD,
	CPUHP_LUSTRE_CFS_DEAD,
	CPUHP_AP_ARM_CACHE_B15_RAC_DEAD,
	CPUHP_RANDOM_PREPARE,
	CPUHP_WORKQUEUE_PREP,
	CPUHP_POWER_NUMA_PREPARE,
	CPUHP_HRTIMERS_PREPARE,
@@ -178,7 +177,6 @@ enum cpuhp_state {
	CPUHP_AP_PERF_POWERPC_THREAD_IMC_ONLINE,
	CPUHP_AP_WATCHDOG_ONLINE,
	CPUHP_AP_WORKQUEUE_ONLINE,
	CPUHP_AP_RANDOM_ONLINE,
	CPUHP_AP_RCUTREE_ONLINE,
	CPUHP_AP_NOTIFY_PERF_ONLINE,
	CPUHP_AP_BASE_CACHEINFO_ONLINE,
+16 −12
Original line number Diff line number Diff line
@@ -1391,6 +1391,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 */
@@ -1409,14 +1423,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,
@@ -1530,14 +1539,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,