diff options
Diffstat (limited to 'kernel/cpu.c')
| -rw-r--r-- | kernel/cpu.c | 19 | 
1 files changed, 16 insertions, 3 deletions
| diff --git a/kernel/cpu.c b/kernel/cpu.c index 3d2bf1d50a0c..1209ddaec026 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -483,6 +483,8 @@ static int cpu_hotplug_disabled;  DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); +static bool cpu_hotplug_offline_disabled __ro_after_init; +  void cpus_read_lock(void)  {  	percpu_down_read(&cpu_hotplug_lock); @@ -542,6 +544,14 @@ static void lockdep_release_cpus_lock(void)  	rwsem_release(&cpu_hotplug_lock.dep_map, _THIS_IP_);  } +/* Declare CPU offlining not supported */ +void cpu_hotplug_disable_offlining(void) +{ +	cpu_maps_update_begin(); +	cpu_hotplug_offline_disabled = true; +	cpu_maps_update_done(); +} +  /*   * Wait for currently running CPU hotplug operations to complete (if any) and   * disable future CPU hotplug (from sysfs). The 'cpu_add_remove_lock' protects @@ -1471,7 +1481,7 @@ static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)  	 * If the platform does not support hotplug, report it explicitly to  	 * differentiate it from a transient offlining failure.  	 */ -	if (cc_platform_has(CC_ATTR_HOTPLUG_DISABLED)) +	if (cpu_hotplug_offline_disabled)  		return -EOPNOTSUPP;  	if (cpu_hotplug_disabled)  		return -EBUSY; @@ -1894,8 +1904,8 @@ int freeze_secondary_cpus(int primary)  	cpumask_clear(frozen_cpus);  	pr_info("Disabling non-boot CPUs ...\n"); -	for_each_online_cpu(cpu) { -		if (cpu == primary) +	for (cpu = nr_cpu_ids - 1; cpu >= 0; cpu--) { +		if (!cpu_online(cpu) || cpu == primary)  			continue;  		if (pm_wakeup_pending()) { @@ -3072,6 +3082,9 @@ EXPORT_SYMBOL(__cpu_possible_mask);  struct cpumask __cpu_online_mask __read_mostly;  EXPORT_SYMBOL(__cpu_online_mask); +struct cpumask __cpu_enabled_mask __read_mostly; +EXPORT_SYMBOL(__cpu_enabled_mask); +  struct cpumask __cpu_present_mask __read_mostly;  EXPORT_SYMBOL(__cpu_present_mask); |