for (i = 0; i < 10; i++) {
smp_rmb(); if (per_cpu(cpu_state, cpu) == CPU_DEAD) { if (system_state == SYSTEM_RUNNING)
pr_info("CPU %u is now offline\n", cpu);
return;
}
msleep(100);
}
pr_err("CPU %u didn't die...\n", cpu);
}
int native_cpu_disable(unsignedint cpu)
{ return cpu == 0 ? -EPERM : 0;
}
int __cpu_disable(void)
{ unsignedint cpu = smp_processor_id(); int ret;
ret = mp_ops->cpu_disable(cpu); if (ret) return ret;
/* * Take this CPU offline. Once we clear this, we can't return, * and we must not schedule until we're ready to give up the cpu.
*/
set_cpu_online(cpu, false);
/* * OK - migrate IRQs away from this CPU
*/
migrate_irqs();
/* * Flush user cache and TLB mappings, and then remove this CPU * from the vm mask set of all processes.
*/
flush_cache_all(); #ifdef CONFIG_MMU
local_flush_tlb_all(); #endif
int __cpu_up(unsignedint cpu, struct task_struct *tsk)
{ unsignedlong timeout;
per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
/* Fill in data in head.S for secondary cpus */
stack_start.sp = tsk->thread.sp;
stack_start.thread_info = tsk->stack;
stack_start.bss_start = 0; /* don't clear bss for secondary cpus */
stack_start.start_kernel_fn = start_secondary;
/* * The following tlb flush calls are invoked when old translations are * being torn down, or pte attributes are changing. For single threaded * address spaces, a new context is obtained on the current cpu, and tlb * context on other cpus are invalidated to force a new context allocation * at switch_mm time, should the mm ever be used on other cpus. For * multithreaded address spaces, intercpu interrupts have to be sent. * Another case where intercpu interrupts are required is when the target * mm might be active on another cpu (eg debuggers doing the flushes on * behalf of debugees, kswapd stealing pages from another process etc). * Kanoj 07/00.
*/ void flush_tlb_mm(struct mm_struct *mm)
{
preempt_disable();
if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) {
smp_call_function(flush_tlb_mm_ipi, (void *)mm, 1);
} else { int i;
for_each_online_cpu(i) if (smp_processor_id() != i)
cpu_context(i, mm) = 0;
}
local_flush_tlb_mm(mm);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.