Skip to content

Commit e0e86b1

Browse files
committed
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull SMP/hotplug updates from Thomas Gleixner: "A small set of updates for SMP and CPU hotplug: - Abort disabling secondary CPUs in the freezer when a wakeup is pending instead of evaluating it only after all CPUs have been offlined. - Remove the shared annotation for the strict per CPU cfd_data in the smp function call core code. - Remove the return values of smp_call_function() and on_each_cpu() as they are unconditionally 0. Fixup the few callers which actually bothered to check the return value" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: smp: Remove smp_call_function() and on_each_cpu() return values smp: Do not mark call_function_data as shared cpu/hotplug: Abort disabling secondary CPUs if wakeup is pending cpu/hotplug: Fix notify_cpu_starting() reference in bringup_wait_for_ap()
2 parents 568521d + caa7593 commit e0e86b1

12 files changed

Lines changed: 36 additions & 55 deletions

File tree

‎arch/alpha/kernel/smp.c‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,7 @@ void
614614
smp_imb(void)
615615
{
616616
/* Must wait other processors to flush their icache before continue. */
617-
if (on_each_cpu(ipi_imb, NULL, 1))
618-
printk(KERN_CRIT "smp_imb: timed out\n");
617+
on_each_cpu(ipi_imb, NULL, 1);
619618
}
620619
EXPORT_SYMBOL(smp_imb);
621620

@@ -630,9 +629,7 @@ flush_tlb_all(void)
630629
{
631630
/* Although we don't have any data to pass, we do want to
632631
synchronize with the other processors. */
633-
if (on_each_cpu(ipi_flush_tlb_all, NULL, 1)) {
634-
printk(KERN_CRIT "flush_tlb_all: timed out\n");
635-
}
632+
on_each_cpu(ipi_flush_tlb_all, NULL, 1);
636633
}
637634

638635
#define asn_locked() (cpu_data[smp_processor_id()].asn_lock)
@@ -667,9 +664,7 @@ flush_tlb_mm(struct mm_struct *mm)
667664
}
668665
}
669666

670-
if (smp_call_function(ipi_flush_tlb_mm, mm, 1)) {
671-
printk(KERN_CRIT "flush_tlb_mm: timed out\n");
672-
}
667+
smp_call_function(ipi_flush_tlb_mm, mm, 1);
673668

674669
preempt_enable();
675670
}
@@ -720,9 +715,7 @@ flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
720715
data.mm = mm;
721716
data.addr = addr;
722717

723-
if (smp_call_function(ipi_flush_tlb_page, &data, 1)) {
724-
printk(KERN_CRIT "flush_tlb_page: timed out\n");
725-
}
718+
smp_call_function(ipi_flush_tlb_page, &data, 1);
726719

727720
preempt_enable();
728721
}
@@ -772,9 +765,7 @@ flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
772765
}
773766
}
774767

775-
if (smp_call_function(ipi_flush_icache_page, mm, 1)) {
776-
printk(KERN_CRIT "flush_icache_page: timed out\n");
777-
}
768+
smp_call_function(ipi_flush_icache_page, mm, 1);
778769

779770
preempt_enable();
780771
}

‎arch/alpha/oprofile/common.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ op_axp_setup(void)
6565
model->reg_setup(&reg, ctr, &sys);
6666

6767
/* Configure the registers on all cpus. */
68-
(void)smp_call_function(model->cpu_setup, &reg, 1);
68+
smp_call_function(model->cpu_setup, &reg, 1);
6969
model->cpu_setup(&reg);
7070
return 0;
7171
}
@@ -86,7 +86,7 @@ op_axp_cpu_start(void *dummy)
8686
static int
8787
op_axp_start(void)
8888
{
89-
(void)smp_call_function(op_axp_cpu_start, NULL, 1);
89+
smp_call_function(op_axp_cpu_start, NULL, 1);
9090
op_axp_cpu_start(NULL);
9191
return 0;
9292
}
@@ -101,7 +101,7 @@ op_axp_cpu_stop(void *dummy)
101101
static void
102102
op_axp_stop(void)
103103
{
104-
(void)smp_call_function(op_axp_cpu_stop, NULL, 1);
104+
smp_call_function(op_axp_cpu_stop, NULL, 1);
105105
op_axp_cpu_stop(NULL);
106106
}
107107

‎arch/arm/common/bL_switcher.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,16 +539,14 @@ static void bL_switcher_trace_trigger_cpu(void *__always_unused info)
539539

540540
int bL_switcher_trace_trigger(void)
541541
{
542-
int ret;
543-
544542
preempt_disable();
545543

546544
bL_switcher_trace_trigger_cpu(NULL);
547-
ret = smp_call_function(bL_switcher_trace_trigger_cpu, NULL, true);
545+
smp_call_function(bL_switcher_trace_trigger_cpu, NULL, true);
548546

549547
preempt_enable();
550548

551-
return ret;
549+
return 0;
552550
}
553551
EXPORT_SYMBOL_GPL(bL_switcher_trace_trigger);
554552

‎arch/ia64/kernel/perfmon.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6390,11 +6390,7 @@ pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
63906390
}
63916391

63926392
/* save the current system wide pmu states */
6393-
ret = on_each_cpu(pfm_alt_save_pmu_state, NULL, 1);
6394-
if (ret) {
6395-
DPRINT(("on_each_cpu() failed: %d\n", ret));
6396-
goto cleanup_reserve;
6397-
}
6393+
on_each_cpu(pfm_alt_save_pmu_state, NULL, 1);
63986394

63996395
/* officially change to the alternate interrupt handler */
64006396
pfm_alt_intr_handler = hdl;
@@ -6421,7 +6417,6 @@ int
64216417
pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
64226418
{
64236419
int i;
6424-
int ret;
64256420

64266421
if (hdl == NULL) return -EINVAL;
64276422

@@ -6435,10 +6430,7 @@ pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
64356430

64366431
pfm_alt_intr_handler = NULL;
64376432

6438-
ret = on_each_cpu(pfm_alt_restore_pmu_state, NULL, 1);
6439-
if (ret) {
6440-
DPRINT(("on_each_cpu() failed: %d\n", ret));
6441-
}
6433+
on_each_cpu(pfm_alt_restore_pmu_state, NULL, 1);
64426434

64436435
for_each_online_cpu(i) {
64446436
pfm_unreserve_session(NULL, 1, i);

‎arch/ia64/kernel/uncached.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
121121
status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
122122
if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) {
123123
atomic_set(&uc_pool->status, 0);
124-
status = smp_call_function(uncached_ipi_visibility, uc_pool, 1);
125-
if (status || atomic_read(&uc_pool->status))
124+
smp_call_function(uncached_ipi_visibility, uc_pool, 1);
125+
if (atomic_read(&uc_pool->status))
126126
goto failed;
127127
} else if (status != PAL_VISIBILITY_OK)
128128
goto failed;
@@ -143,8 +143,8 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
143143
if (status != PAL_STATUS_SUCCESS)
144144
goto failed;
145145
atomic_set(&uc_pool->status, 0);
146-
status = smp_call_function(uncached_ipi_mc_drain, uc_pool, 1);
147-
if (status || atomic_read(&uc_pool->status))
146+
smp_call_function(uncached_ipi_mc_drain, uc_pool, 1);
147+
if (atomic_read(&uc_pool->status))
148148
goto failed;
149149

150150
/*

‎arch/powerpc/kernel/rtas.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,7 @@ int rtas_ibm_suspend_me(u64 handle)
990990
/* Call function on all CPUs. One of us will make the
991991
* rtas call
992992
*/
993-
if (on_each_cpu(rtas_percpu_suspend_me, &data, 0))
994-
atomic_set(&data.error, -EINVAL);
993+
on_each_cpu(rtas_percpu_suspend_me, &data, 0);
995994

996995
wait_for_completion(&done);
997996

‎arch/x86/lib/cache-smp.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ EXPORT_SYMBOL(wbinvd_on_cpu);
1515

1616
int wbinvd_on_all_cpus(void)
1717
{
18-
return on_each_cpu(__wbinvd, NULL, 1);
18+
on_each_cpu(__wbinvd, NULL, 1);
19+
return 0;
1920
}
2021
EXPORT_SYMBOL(wbinvd_on_all_cpus);

‎drivers/char/agp/generic.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,7 @@ static void ipi_handler(void *null)
13111311

13121312
void global_cache_flush(void)
13131313
{
1314-
if (on_each_cpu(ipi_handler, NULL, 1) != 0)
1315-
panic(PFX "timed out waiting for the other CPUs!\n");
1314+
on_each_cpu(ipi_handler, NULL, 1);
13161315
}
13171316
EXPORT_SYMBOL(global_cache_flush);
13181317

‎include/linux/smp.h‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
3535
/*
3636
* Call a function on all processors
3737
*/
38-
int on_each_cpu(smp_call_func_t func, void *info, int wait);
38+
void on_each_cpu(smp_call_func_t func, void *info, int wait);
3939

4040
/*
4141
* Call a function on processors specified by mask, which might include
@@ -101,7 +101,7 @@ extern void smp_cpus_done(unsigned int max_cpus);
101101
/*
102102
* Call a function on all other processors
103103
*/
104-
int smp_call_function(smp_call_func_t func, void *info, int wait);
104+
void smp_call_function(smp_call_func_t func, void *info, int wait);
105105
void smp_call_function_many(const struct cpumask *mask,
106106
smp_call_func_t func, void *info, bool wait);
107107

@@ -144,9 +144,8 @@ static inline void smp_send_stop(void) { }
144144
* These macros fold the SMP functionality into a single CPU system
145145
*/
146146
#define raw_smp_processor_id() 0
147-
static inline int up_smp_call_function(smp_call_func_t func, void *info)
147+
static inline void up_smp_call_function(smp_call_func_t func, void *info)
148148
{
149-
return 0;
150149
}
151150
#define smp_call_function(func, info, wait) \
152151
(up_smp_call_function(func, info))

‎kernel/cpu.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ static int bringup_wait_for_ap(unsigned int cpu)
522522
/*
523523
* SMT soft disabling on X86 requires to bring the CPU out of the
524524
* BIOS 'wait for SIPI' state in order to set the CR4.MCE bit. The
525-
* CPU marked itself as booted_once in cpu_notify_starting() so the
525+
* CPU marked itself as booted_once in notify_cpu_starting() so the
526526
* cpu_smt_allowed() check will now return false if this is not the
527527
* primary sibling.
528528
*/
@@ -1221,6 +1221,13 @@ int freeze_secondary_cpus(int primary)
12211221
for_each_online_cpu(cpu) {
12221222
if (cpu == primary)
12231223
continue;
1224+
1225+
if (pm_wakeup_pending()) {
1226+
pr_info("Wakeup pending. Abort CPU freeze\n");
1227+
error = -EBUSY;
1228+
break;
1229+
}
1230+
12241231
trace_suspend_resume(TPS("CPU_OFF"), cpu, true);
12251232
error = _cpu_down(cpu, 1, CPUHP_OFFLINE);
12261233
trace_suspend_resume(TPS("CPU_OFF"), cpu, false);

0 commit comments

Comments
 (0)