powerpc/mmu nohash: Convert to hotplug state machine
Install the callbacks via the state machine. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: rt@linutronix.de Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20160818125731.27256-17-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Родитель
68e694dcef
Коммит
da3ed6519b
|
@ -369,44 +369,34 @@ void destroy_context(struct mm_struct *mm)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
static int mmu_ctx_cpu_prepare(unsigned int cpu)
|
||||||
static int mmu_context_cpu_notify(struct notifier_block *self,
|
|
||||||
unsigned long action, void *hcpu)
|
|
||||||
{
|
{
|
||||||
unsigned int cpu = (unsigned int)(long)hcpu;
|
|
||||||
|
|
||||||
/* We don't touch CPU 0 map, it's allocated at aboot and kept
|
/* We don't touch CPU 0 map, it's allocated at aboot and kept
|
||||||
* around forever
|
* around forever
|
||||||
*/
|
*/
|
||||||
if (cpu == boot_cpuid)
|
if (cpu == boot_cpuid)
|
||||||
return NOTIFY_OK;
|
return 0;
|
||||||
|
|
||||||
switch (action) {
|
pr_devel("MMU: Allocating stale context map for CPU %d\n", cpu);
|
||||||
case CPU_UP_PREPARE:
|
stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
|
||||||
case CPU_UP_PREPARE_FROZEN:
|
return 0;
|
||||||
pr_devel("MMU: Allocating stale context map for CPU %d\n", cpu);
|
|
||||||
stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
|
|
||||||
break;
|
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
|
||||||
case CPU_UP_CANCELED:
|
|
||||||
case CPU_UP_CANCELED_FROZEN:
|
|
||||||
case CPU_DEAD:
|
|
||||||
case CPU_DEAD_FROZEN:
|
|
||||||
pr_devel("MMU: Freeing stale context map for CPU %d\n", cpu);
|
|
||||||
kfree(stale_map[cpu]);
|
|
||||||
stale_map[cpu] = NULL;
|
|
||||||
|
|
||||||
/* We also clear the cpu_vm_mask bits of CPUs going away */
|
|
||||||
clear_tasks_mm_cpumask(cpu);
|
|
||||||
break;
|
|
||||||
#endif /* CONFIG_HOTPLUG_CPU */
|
|
||||||
}
|
|
||||||
return NOTIFY_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block mmu_context_cpu_nb = {
|
static int mmu_ctx_cpu_dead(unsigned int cpu)
|
||||||
.notifier_call = mmu_context_cpu_notify,
|
{
|
||||||
};
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
|
if (cpu == boot_cpuid)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
pr_devel("MMU: Freeing stale context map for CPU %d\n", cpu);
|
||||||
|
kfree(stale_map[cpu]);
|
||||||
|
stale_map[cpu] = NULL;
|
||||||
|
|
||||||
|
/* We also clear the cpu_vm_mask bits of CPUs going away */
|
||||||
|
clear_tasks_mm_cpumask(cpu);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
|
|
||||||
|
@ -469,7 +459,9 @@ void __init mmu_context_init(void)
|
||||||
#else
|
#else
|
||||||
stale_map[boot_cpuid] = memblock_virt_alloc(CTX_MAP_SIZE, 0);
|
stale_map[boot_cpuid] = memblock_virt_alloc(CTX_MAP_SIZE, 0);
|
||||||
|
|
||||||
register_cpu_notifier(&mmu_context_cpu_nb);
|
cpuhp_setup_state_nocalls(CPUHP_POWERPC_MMU_CTX_PREPARE,
|
||||||
|
"powerpc/mmu/ctx:prepare",
|
||||||
|
mmu_ctx_cpu_prepare, mmu_ctx_cpu_dead);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
|
|
|
@ -32,6 +32,7 @@ enum cpuhp_state {
|
||||||
CPUHP_RCUTREE_PREP,
|
CPUHP_RCUTREE_PREP,
|
||||||
CPUHP_CPUIDLE_COUPLED_PREPARE,
|
CPUHP_CPUIDLE_COUPLED_PREPARE,
|
||||||
CPUHP_POWERPC_PMAC_PREPARE,
|
CPUHP_POWERPC_PMAC_PREPARE,
|
||||||
|
CPUHP_POWERPC_MMU_CTX_PREPARE,
|
||||||
CPUHP_NOTIFY_PREPARE,
|
CPUHP_NOTIFY_PREPARE,
|
||||||
CPUHP_TIMERS_DEAD,
|
CPUHP_TIMERS_DEAD,
|
||||||
CPUHP_BRINGUP_CPU,
|
CPUHP_BRINGUP_CPU,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче