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

Commit 99f23e76 authored by danile71's avatar danile71 Committed by Dyneteve
Browse files

Revert "cpu-hotplug: convert cpu_hotplug_disabled to a counter"

This reverts commit 202fb55e.
parent ea0f079e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ More details follow:
                                        |
                                        v
                           Disable regular cpu hotplug
                        by increasing cpu_hotplug_disabled
                        by setting cpu_hotplug_disabled=1
                                        |
                                        v
                            Release cpu_add_remove_lock
@@ -89,7 +89,7 @@ Resuming back is likewise, with the counterparts being (in the order of
execution during resume):
* enable_nonboot_cpus() which involves:
   |  Acquire cpu_add_remove_lock
   |  Decrease cpu_hotplug_disabled, thereby enabling regular cpu hotplug
   |  Reset cpu_hotplug_disabled to 0, thereby enabling regular cpu hotplug
   |  Call _cpu_up() [for all those cpus in the frozen_cpus mask, in a loop]
   |  Release cpu_add_remove_lock
   v
@@ -120,7 +120,7 @@ after the entire cycle is complete (i.e., suspend + resume).
                           Acquire cpu_add_remove_lock
                                        |
                                        v
                          If cpu_hotplug_disabled > 0
                          If cpu_hotplug_disabled is 1
                                return gracefully
                                        |
                                        |
+9 −14
Original line number Diff line number Diff line
@@ -150,14 +150,14 @@ static void cpu_hotplug_done(void)
void cpu_hotplug_disable(void)
{
	cpu_maps_update_begin();
	cpu_hotplug_disabled++;
	cpu_hotplug_disabled = 1;
	cpu_maps_update_done();
}

void cpu_hotplug_enable(void)
{
	cpu_maps_update_begin();
	WARN_ON(--cpu_hotplug_disabled < 0);
	cpu_hotplug_disabled = 0;
	cpu_maps_update_done();
}

@@ -524,18 +524,13 @@ int disable_nonboot_cpus(void)
		}
	}

	if (!error)
	if (!error) {
		BUG_ON(num_online_cpus() > 1);
	else
		pr_err("Non-boot CPUs are not disabled\n");

	/*
	 * Make sure the CPUs won't be enabled by someone else. We need to do
	 * this even in case of failure as all disable_nonboot_cpus() users are
	 * supposed to do enable_nonboot_cpus() on the failure path.
	 */
	cpu_hotplug_disabled++;

		/* Make sure the CPUs won't be enabled by someone else */
		cpu_hotplug_disabled = 1;
	} else {
		printk(KERN_ERR "Non-boot CPUs are not disabled\n");
	}
	cpu_maps_update_done();
	return error;
}
@@ -554,7 +549,7 @@ void __ref enable_nonboot_cpus(void)

	/* Allow everyone to use the CPU hotplug again */
	cpu_maps_update_begin();
	WARN_ON(--cpu_hotplug_disabled < 0);
	cpu_hotplug_disabled = 0;
	if (cpumask_empty(frozen_cpus))
		goto out;