Skip to content

Commit 597f03f

Browse files
committed
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull CPU hotplug updates from Thomas Gleixner: "Yet another batch of cpu hotplug core updates and conversions: - Provide core infrastructure for multi instance drivers so the drivers do not have to keep custom lists. - Convert custom lists to the new infrastructure. The block-mq custom list conversion comes through the block tree and makes the diffstat tip over to more lines removed than added. - Handle unbalanced hotplug enable/disable calls more gracefully. - Remove the obsolete CPU_STARTING/DYING notifier support. - Convert another batch of notifier users. The relayfs changes which conflicted with the conversion have been shipped to me by Andrew. The remaining lot is targeted for 4.10 so that we finally can remove the rest of the notifiers" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) cpufreq: Fix up conversion to hotplug state machine blk/mq: Reserve hotplug states for block multiqueue x86/apic/uv: Convert to hotplug state machine s390/mm/pfault: Convert to hotplug state machine mips/loongson/smp: Convert to hotplug state machine mips/octeon/smp: Convert to hotplug state machine fault-injection/cpu: Convert to hotplug state machine padata: Convert to hotplug state machine cpufreq: Convert to hotplug state machine ACPI/processor: Convert to hotplug state machine virtio scsi: Convert to hotplug state machine oprofile/timer: Convert to hotplug state machine block/softirq: Convert to hotplug state machine lib/irq_poll: Convert to hotplug state machine x86/microcode: Convert to hotplug state machine sh/SH-X3 SMP: Convert to hotplug state machine ia64/mca: Convert to hotplug state machine ARM/OMAP/wakeupgen: Convert to hotplug state machine ARM/shmobile: Convert to hotplug state machine arm64/FP/SIMD: Convert to hotplug state machine ...
2 parents 999dcbe + 0bf71e4 commit 597f03f

File tree

50 files changed

+1452
-1375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1452
-1375
lines changed

arch/arm/mach-omap2/omap-wakeupgen.c

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -322,34 +322,25 @@ static void irq_save_secure_context(void)
322322
#endif
323323

324324
#ifdef CONFIG_HOTPLUG_CPU
325-
static int irq_cpu_hotplug_notify(struct notifier_block *self,
326-
unsigned long action, void *hcpu)
325+
static int omap_wakeupgen_cpu_online(unsigned int cpu)
327326
{
328-
unsigned int cpu = (unsigned int)hcpu;
329-
330-
/*
331-
* Corresponding FROZEN transitions do not have to be handled,
332-
* they are handled by at a higher level
333-
* (drivers/cpuidle/coupled.c).
334-
*/
335-
switch (action) {
336-
case CPU_ONLINE:
337-
wakeupgen_irqmask_all(cpu, 0);
338-
break;
339-
case CPU_DEAD:
340-
wakeupgen_irqmask_all(cpu, 1);
341-
break;
342-
}
343-
return NOTIFY_OK;
327+
wakeupgen_irqmask_all(cpu, 0);
328+
return 0;
344329
}
345330

346-
static struct notifier_block irq_hotplug_notifier = {
347-
.notifier_call = irq_cpu_hotplug_notify,
348-
};
331+
static int omap_wakeupgen_cpu_dead(unsigned int cpu)
332+
{
333+
wakeupgen_irqmask_all(cpu, 1);
334+
return 0;
335+
}
349336

350337
static void __init irq_hotplug_init(void)
351338
{
352-
register_hotcpu_notifier(&irq_hotplug_notifier);
339+
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "arm/omap-wake:online",
340+
omap_wakeupgen_cpu_online, NULL);
341+
cpuhp_setup_state_nocalls(CPUHP_ARM_OMAP_WAKE_DEAD,
342+
"arm/omap-wake:dead", NULL,
343+
omap_wakeupgen_cpu_dead);
353344
}
354345
#else
355346
static void __init irq_hotplug_init(void)

arch/arm/mach-shmobile/platsmp-scu.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,14 @@
2121
static phys_addr_t shmobile_scu_base_phys;
2222
static void __iomem *shmobile_scu_base;
2323

24-
static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
25-
unsigned long action, void *hcpu)
24+
static int shmobile_scu_cpu_prepare(unsigned int cpu)
2625
{
27-
unsigned int cpu = (long)hcpu;
28-
29-
switch (action) {
30-
case CPU_UP_PREPARE:
31-
/* For this particular CPU register SCU SMP boot vector */
32-
shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
33-
shmobile_scu_base_phys);
34-
break;
35-
};
36-
37-
return NOTIFY_OK;
26+
/* For this particular CPU register SCU SMP boot vector */
27+
shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
28+
shmobile_scu_base_phys);
29+
return 0;
3830
}
3931

40-
static struct notifier_block shmobile_smp_scu_notifier = {
41-
.notifier_call = shmobile_smp_scu_notifier_call,
42-
};
43-
4432
void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
4533
unsigned int max_cpus)
4634
{
@@ -54,7 +42,9 @@ void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
5442
scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
5543

5644
/* Use CPU notifier for reset vector control */
57-
register_cpu_notifier(&shmobile_smp_scu_notifier);
45+
cpuhp_setup_state_nocalls(CPUHP_ARM_SHMOBILE_SCU_PREPARE,
46+
"arm/shmobile-scu:prepare",
47+
shmobile_scu_cpu_prepare, NULL);
5848
}
5949

6050
#ifdef CONFIG_HOTPLUG_CPU

arch/arm64/kernel/fpsimd.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -299,28 +299,16 @@ static inline void fpsimd_pm_init(void) { }
299299
#endif /* CONFIG_CPU_PM */
300300

301301
#ifdef CONFIG_HOTPLUG_CPU
302-
static int fpsimd_cpu_hotplug_notifier(struct notifier_block *nfb,
303-
unsigned long action,
304-
void *hcpu)
302+
static int fpsimd_cpu_dead(unsigned int cpu)
305303
{
306-
unsigned int cpu = (long)hcpu;
307-
308-
switch (action) {
309-
case CPU_DEAD:
310-
case CPU_DEAD_FROZEN:
311-
per_cpu(fpsimd_last_state, cpu) = NULL;
312-
break;
313-
}
314-
return NOTIFY_OK;
304+
per_cpu(fpsimd_last_state, cpu) = NULL;
305+
return 0;
315306
}
316307

317-
static struct notifier_block fpsimd_cpu_hotplug_notifier_block = {
318-
.notifier_call = fpsimd_cpu_hotplug_notifier,
319-
};
320-
321308
static inline void fpsimd_hotplug_init(void)
322309
{
323-
register_cpu_notifier(&fpsimd_cpu_hotplug_notifier_block);
310+
cpuhp_setup_state_nocalls(CPUHP_ARM64_FPSIMD_DEAD, "arm64/fpsimd:dead",
311+
NULL, fpsimd_cpu_dead);
324312
}
325313

326314
#else

arch/ia64/kernel/mca.c

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,33 +1890,17 @@ ia64_mca_cpu_init(void *cpu_data)
18901890
PAGE_KERNEL)));
18911891
}
18921892

1893-
static void ia64_mca_cmc_vector_adjust(void *dummy)
1893+
static int ia64_mca_cpu_online(unsigned int cpu)
18941894
{
18951895
unsigned long flags;
18961896

18971897
local_irq_save(flags);
18981898
if (!cmc_polling_enabled)
18991899
ia64_mca_cmc_vector_enable(NULL);
19001900
local_irq_restore(flags);
1901+
return 0;
19011902
}
19021903

1903-
static int mca_cpu_callback(struct notifier_block *nfb,
1904-
unsigned long action,
1905-
void *hcpu)
1906-
{
1907-
switch (action) {
1908-
case CPU_ONLINE:
1909-
case CPU_ONLINE_FROZEN:
1910-
ia64_mca_cmc_vector_adjust(NULL);
1911-
break;
1912-
}
1913-
return NOTIFY_OK;
1914-
}
1915-
1916-
static struct notifier_block mca_cpu_notifier = {
1917-
.notifier_call = mca_cpu_callback
1918-
};
1919-
19201904
/*
19211905
* ia64_mca_init
19221906
*
@@ -2111,15 +2095,13 @@ ia64_mca_late_init(void)
21112095
if (!mca_init)
21122096
return 0;
21132097

2114-
register_hotcpu_notifier(&mca_cpu_notifier);
2115-
21162098
/* Setup the CMCI/P vector and handler */
21172099
setup_timer(&cmc_poll_timer, ia64_mca_cmc_poll, 0UL);
21182100

21192101
/* Unmask/enable the vector */
21202102
cmc_polling_enabled = 0;
2121-
schedule_work(&cmc_enable_work);
2122-
2103+
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/mca:online",
2104+
ia64_mca_cpu_online, NULL);
21232105
IA64_MCA_DEBUG("%s: CMCI/P setup and enabled.\n", __func__);
21242106

21252107
#ifdef CONFIG_ACPI

arch/mips/cavium-octeon/smp.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -380,29 +380,11 @@ static int octeon_update_boot_vector(unsigned int cpu)
380380
return 0;
381381
}
382382

383-
static int octeon_cpu_callback(struct notifier_block *nfb,
384-
unsigned long action, void *hcpu)
385-
{
386-
unsigned int cpu = (unsigned long)hcpu;
387-
388-
switch (action & ~CPU_TASKS_FROZEN) {
389-
case CPU_UP_PREPARE:
390-
octeon_update_boot_vector(cpu);
391-
break;
392-
case CPU_ONLINE:
393-
pr_info("Cpu %d online\n", cpu);
394-
break;
395-
case CPU_DEAD:
396-
break;
397-
}
398-
399-
return NOTIFY_OK;
400-
}
401-
402383
static int register_cavium_notifier(void)
403384
{
404-
hotcpu_notifier(octeon_cpu_callback, 0);
405-
return 0;
385+
return cpuhp_setup_state_nocalls(CPUHP_MIPS_SOC_PREPARE,
386+
"mips/cavium:prepare",
387+
octeon_update_boot_vector, NULL);
406388
}
407389
late_initcall(register_cavium_notifier);
408390

arch/mips/loongson64/loongson-3/smp.c

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ void play_dead(void)
677677
play_dead_at_ckseg1(state_addr);
678678
}
679679

680-
void loongson3_disable_clock(int cpu)
680+
static int loongson3_disable_clock(unsigned int cpu)
681681
{
682682
uint64_t core_id = cpu_data[cpu].core;
683683
uint64_t package_id = cpu_data[cpu].package;
@@ -688,9 +688,10 @@ void loongson3_disable_clock(int cpu)
688688
if (!(loongson_sysconf.workarounds & WORKAROUND_CPUHOTPLUG))
689689
LOONGSON_FREQCTRL(package_id) &= ~(1 << (core_id * 4 + 3));
690690
}
691+
return 0;
691692
}
692693

693-
void loongson3_enable_clock(int cpu)
694+
static int loongson3_enable_clock(unsigned int cpu)
694695
{
695696
uint64_t core_id = cpu_data[cpu].core;
696697
uint64_t package_id = cpu_data[cpu].package;
@@ -701,34 +702,15 @@ void loongson3_enable_clock(int cpu)
701702
if (!(loongson_sysconf.workarounds & WORKAROUND_CPUHOTPLUG))
702703
LOONGSON_FREQCTRL(package_id) |= 1 << (core_id * 4 + 3);
703704
}
704-
}
705-
706-
#define CPU_POST_DEAD_FROZEN (CPU_POST_DEAD | CPU_TASKS_FROZEN)
707-
static int loongson3_cpu_callback(struct notifier_block *nfb,
708-
unsigned long action, void *hcpu)
709-
{
710-
unsigned int cpu = (unsigned long)hcpu;
711-
712-
switch (action) {
713-
case CPU_POST_DEAD:
714-
case CPU_POST_DEAD_FROZEN:
715-
pr_info("Disable clock for CPU#%d\n", cpu);
716-
loongson3_disable_clock(cpu);
717-
break;
718-
case CPU_UP_PREPARE:
719-
case CPU_UP_PREPARE_FROZEN:
720-
pr_info("Enable clock for CPU#%d\n", cpu);
721-
loongson3_enable_clock(cpu);
722-
break;
723-
}
724-
725-
return NOTIFY_OK;
705+
return 0;
726706
}
727707

728708
static int register_loongson3_notifier(void)
729709
{
730-
hotcpu_notifier(loongson3_cpu_callback, 0);
731-
return 0;
710+
return cpuhp_setup_state_nocalls(CPUHP_MIPS_SOC_PREPARE,
711+
"mips/loongson:prepare",
712+
loongson3_enable_clock,
713+
loongson3_disable_clock);
732714
}
733715
early_initcall(register_loongson3_notifier);
734716

arch/powerpc/mm/mmu_context_nohash.c

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -369,44 +369,34 @@ void destroy_context(struct mm_struct *mm)
369369
}
370370

371371
#ifdef CONFIG_SMP
372-
373-
static int mmu_context_cpu_notify(struct notifier_block *self,
374-
unsigned long action, void *hcpu)
372+
static int mmu_ctx_cpu_prepare(unsigned int cpu)
375373
{
376-
unsigned int cpu = (unsigned int)(long)hcpu;
377-
378374
/* We don't touch CPU 0 map, it's allocated at aboot and kept
379375
* around forever
380376
*/
381377
if (cpu == boot_cpuid)
382-
return NOTIFY_OK;
383-
384-
switch (action) {
385-
case CPU_UP_PREPARE:
386-
case CPU_UP_PREPARE_FROZEN:
387-
pr_devel("MMU: Allocating stale context map for CPU %d\n", cpu);
388-
stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
389-
break;
390-
#ifdef CONFIG_HOTPLUG_CPU
391-
case CPU_UP_CANCELED:
392-
case CPU_UP_CANCELED_FROZEN:
393-
case CPU_DEAD:
394-
case CPU_DEAD_FROZEN:
395-
pr_devel("MMU: Freeing stale context map for CPU %d\n", cpu);
396-
kfree(stale_map[cpu]);
397-
stale_map[cpu] = NULL;
398-
399-
/* We also clear the cpu_vm_mask bits of CPUs going away */
400-
clear_tasks_mm_cpumask(cpu);
401-
break;
402-
#endif /* CONFIG_HOTPLUG_CPU */
403-
}
404-
return NOTIFY_OK;
378+
return 0;
379+
380+
pr_devel("MMU: Allocating stale context map for CPU %d\n", cpu);
381+
stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
382+
return 0;
405383
}
406384

407-
static struct notifier_block mmu_context_cpu_nb = {
408-
.notifier_call = mmu_context_cpu_notify,
409-
};
385+
static int mmu_ctx_cpu_dead(unsigned int cpu)
386+
{
387+
#ifdef CONFIG_HOTPLUG_CPU
388+
if (cpu == boot_cpuid)
389+
return 0;
390+
391+
pr_devel("MMU: Freeing stale context map for CPU %d\n", cpu);
392+
kfree(stale_map[cpu]);
393+
stale_map[cpu] = NULL;
394+
395+
/* We also clear the cpu_vm_mask bits of CPUs going away */
396+
clear_tasks_mm_cpumask(cpu);
397+
#endif
398+
return 0;
399+
}
410400

411401
#endif /* CONFIG_SMP */
412402

@@ -469,7 +459,9 @@ void __init mmu_context_init(void)
469459
#else
470460
stale_map[boot_cpuid] = memblock_virt_alloc(CTX_MAP_SIZE, 0);
471461

472-
register_cpu_notifier(&mmu_context_cpu_nb);
462+
cpuhp_setup_state_nocalls(CPUHP_POWERPC_MMU_CTX_PREPARE,
463+
"powerpc/mmu/ctx:prepare",
464+
mmu_ctx_cpu_prepare, mmu_ctx_cpu_dead);
473465
#endif
474466

475467
printk(KERN_INFO

0 commit comments

Comments
 (0)