Skip to content

Commit 992a1a3

Browse files
committed
Merge tag 'smp-core-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core SMP updates from Thomas Gleixner: "CPU (hotplug) updates: - Support for locked CSD objects in smp_call_function_single_async() which allows to simplify callsites in the scheduler core and MIPS - Treewide consolidation of CPU hotplug functions which ensures the consistency between the sysfs interface and kernel state. The low level functions cpu_up/down() are now confined to the core code and not longer accessible from random code" * tag 'smp-core-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (22 commits) cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus() cpu/hotplug: Hide cpu_up/down() cpu/hotplug: Move bringup of secondary CPUs out of smp_init() torture: Replace cpu_up/down() with add/remove_cpu() firmware: psci: Replace cpu_up/down() with add/remove_cpu() xen/cpuhotplug: Replace cpu_up/down() with device_online/offline() parisc: Replace cpu_up/down() with add/remove_cpu() sparc: Replace cpu_up/down() with add/remove_cpu() powerpc: Replace cpu_up/down() with add/remove_cpu() x86/smp: Replace cpu_up/down() with add/remove_cpu() arm64: hibernate: Use bringup_hibernate_cpu() cpu/hotplug: Provide bringup_hibernate_cpu() arm64: Use reboot_cpu instead of hardconding it to 0 arm64: Don't use disable_nonboot_cpus() ARM: Use reboot_cpu instead of hardcoding it to 0 ARM: Don't use disable_nonboot_cpus() ia64: Replace cpu_down() with smp_shutdown_nonboot_cpus() cpu/hotplug: Create a new function to shutdown nonboot cpus cpu/hotplug: Add new {add,remove}_cpu() functions sched/core: Remove rq.hrtick_csd_pending ...
2 parents 2d38533 + e98eac6 commit 992a1a3

File tree

20 files changed

+194
-97
lines changed

20 files changed

+194
-97
lines changed

arch/arm/kernel/reboot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ void soft_restart(unsigned long addr)
8888
* to execute e.g. a RAM-based pin loop is not sufficient. This allows the
8989
* kexec'd kernel to use any and all RAM as it sees fit, without having to
9090
* avoid any code or data used by any SW CPU pin loop. The CPU hotplug
91-
* functionality embodied in disable_nonboot_cpus() to achieve this.
91+
* functionality embodied in smp_shutdown_nonboot_cpus() to achieve this.
9292
*/
9393
void machine_shutdown(void)
9494
{
95-
disable_nonboot_cpus();
95+
smp_shutdown_nonboot_cpus(reboot_cpu);
9696
}
9797

9898
/*

arch/arm64/kernel/hibernate.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,11 @@ int arch_hibernation_header_restore(void *addr)
166166
sleep_cpu = -EINVAL;
167167
return -EINVAL;
168168
}
169-
if (!cpu_online(sleep_cpu)) {
170-
pr_info("Hibernated on a CPU that is offline! Bringing CPU up.\n");
171-
ret = cpu_up(sleep_cpu);
172-
if (ret) {
173-
pr_err("Failed to bring hibernate-CPU up!\n");
174-
sleep_cpu = -EINVAL;
175-
return ret;
176-
}
169+
170+
ret = bringup_hibernate_cpu(sleep_cpu);
171+
if (ret) {
172+
sleep_cpu = -EINVAL;
173+
return ret;
177174
}
178175

179176
resume_hdr = *hdr;

arch/arm64/kernel/process.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ void arch_cpu_idle_dead(void)
141141
* to execute e.g. a RAM-based pin loop is not sufficient. This allows the
142142
* kexec'd kernel to use any and all RAM as it sees fit, without having to
143143
* avoid any code or data used by any SW CPU pin loop. The CPU hotplug
144-
* functionality embodied in disable_nonboot_cpus() to achieve this.
144+
* functionality embodied in smpt_shutdown_nonboot_cpus() to achieve this.
145145
*/
146146
void machine_shutdown(void)
147147
{
148-
disable_nonboot_cpus();
148+
smp_shutdown_nonboot_cpus(reboot_cpu);
149149
}
150150

151151
/*

arch/ia64/kernel/process.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,8 @@ cpu_halt (void)
646646

647647
void machine_shutdown(void)
648648
{
649-
#ifdef CONFIG_HOTPLUG_CPU
650-
int cpu;
649+
smp_shutdown_nonboot_cpus(reboot_cpu);
651650

652-
for_each_online_cpu(cpu) {
653-
if (cpu != smp_processor_id())
654-
cpu_down(cpu);
655-
}
656-
#endif
657651
#ifdef CONFIG_KEXEC
658652
kexec_disable_iosapic();
659653
#endif

arch/mips/kernel/smp.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -696,29 +696,22 @@ EXPORT_SYMBOL(flush_tlb_one);
696696

697697
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
698698

699-
static DEFINE_PER_CPU(atomic_t, tick_broadcast_count);
700699
static DEFINE_PER_CPU(call_single_data_t, tick_broadcast_csd);
701700

702701
void tick_broadcast(const struct cpumask *mask)
703702
{
704-
atomic_t *count;
705703
call_single_data_t *csd;
706704
int cpu;
707705

708706
for_each_cpu(cpu, mask) {
709-
count = &per_cpu(tick_broadcast_count, cpu);
710707
csd = &per_cpu(tick_broadcast_csd, cpu);
711-
712-
if (atomic_inc_return(count) == 1)
713-
smp_call_function_single_async(cpu, csd);
708+
smp_call_function_single_async(cpu, csd);
714709
}
715710
}
716711

717712
static void tick_broadcast_callee(void *info)
718713
{
719-
int cpu = smp_processor_id();
720714
tick_receive_broadcast();
721-
atomic_set(&per_cpu(tick_broadcast_count, cpu), 0);
722715
}
723716

724717
static int __init tick_broadcast_init(void)

arch/parisc/kernel/processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int __init processor_probe(struct parisc_device *dev)
212212
#ifdef CONFIG_SMP
213213
if (cpuid) {
214214
set_cpu_present(cpuid, true);
215-
cpu_up(cpuid);
215+
add_cpu(cpuid);
216216
}
217217
#endif
218218

arch/powerpc/kexec/core_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static void wake_offline_cpus(void)
212212
if (!cpu_online(cpu)) {
213213
printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
214214
cpu);
215-
WARN_ON(cpu_up(cpu));
215+
WARN_ON(add_cpu(cpu));
216216
}
217217
}
218218
}

arch/sparc/kernel/ds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static int dr_cpu_configure(struct ds_info *dp, struct ds_cap_state *cp,
555555

556556
printk(KERN_INFO "ds-%llu: Starting cpu %d...\n",
557557
dp->id, cpu);
558-
err = cpu_up(cpu);
558+
err = add_cpu(cpu);
559559
if (err) {
560560
__u32 res = DR_CPU_RES_FAILURE;
561561
__u32 stat = DR_CPU_STAT_UNCONFIGURED;
@@ -611,7 +611,7 @@ static int dr_cpu_unconfigure(struct ds_info *dp,
611611

612612
printk(KERN_INFO "ds-%llu: Shutting down cpu %d...\n",
613613
dp->id, cpu);
614-
err = cpu_down(cpu);
614+
err = remove_cpu(cpu);
615615
if (err)
616616
dr_cpu_mark(resp, cpu, ncpus,
617617
DR_CPU_RES_FAILURE,

arch/x86/kernel/topology.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,29 @@ __setup("cpu0_hotplug", enable_cpu0_hotplug);
5959
*/
6060
int _debug_hotplug_cpu(int cpu, int action)
6161
{
62-
struct device *dev = get_cpu_device(cpu);
6362
int ret;
6463

6564
if (!cpu_is_hotpluggable(cpu))
6665
return -EINVAL;
6766

68-
lock_device_hotplug();
69-
7067
switch (action) {
7168
case 0:
72-
ret = cpu_down(cpu);
73-
if (!ret) {
69+
ret = remove_cpu(cpu);
70+
if (!ret)
7471
pr_info("DEBUG_HOTPLUG_CPU0: CPU %u is now offline\n", cpu);
75-
dev->offline = true;
76-
kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
77-
} else
72+
else
7873
pr_debug("Can't offline CPU%d.\n", cpu);
7974
break;
8075
case 1:
81-
ret = cpu_up(cpu);
82-
if (!ret) {
83-
dev->offline = false;
84-
kobject_uevent(&dev->kobj, KOBJ_ONLINE);
85-
} else {
76+
ret = add_cpu(cpu);
77+
if (ret)
8678
pr_debug("Can't online CPU%d.\n", cpu);
87-
}
79+
8880
break;
8981
default:
9082
ret = -EINVAL;
9183
}
9284

93-
unlock_device_hotplug();
94-
9585
return ret;
9686
}
9787

arch/x86/mm/mmio-mod.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static void enter_uniprocessor(void)
386386
put_online_cpus();
387387

388388
for_each_cpu(cpu, downed_cpus) {
389-
err = cpu_down(cpu);
389+
err = remove_cpu(cpu);
390390
if (!err)
391391
pr_info("CPU%d is down.\n", cpu);
392392
else
@@ -406,7 +406,7 @@ static void leave_uniprocessor(void)
406406
return;
407407
pr_notice("Re-enabling CPUs...\n");
408408
for_each_cpu(cpu, downed_cpus) {
409-
err = cpu_up(cpu);
409+
err = add_cpu(cpu);
410410
if (!err)
411411
pr_info("enabled CPU%d.\n", cpu);
412412
else

0 commit comments

Comments
 (0)