Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e545a614 authored by Manfred Spraul's avatar Manfred Spraul Committed by Ingo Molnar
Browse files

kernel/cpu.c: create a CPU_STARTING cpu_chain notifier



Right now, there is no notifier that is called on a new cpu, before the new
cpu begins processing interrupts/softirqs.
Various kernel function would need that notification, e.g. kvm works around
by calling smp_call_function_single(), rcu polls cpu_online_map.

The patch adds a CPU_STARTING notification. It also adds a helper function
that sends the message to all cpu_chain handlers.

Tested on x86-64.
All other archs are untested. Especially on sparc, I'm not sure if I got
it right.

Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7686ad56
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -149,6 +149,9 @@ smp_callin(void)
	atomic_inc(&init_mm.mm_count);
	current->active_mm = &init_mm;

	/* inform the notifiers about the new cpu */
	notify_cpu_starting(cpuid);

	/* Must have completely accurate bogos.  */
	local_irq_enable();

+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
	/*
	 * Enable local interrupts.
	 */
	notify_cpu_starting(cpu);
	local_irq_enable();
	local_fiq_enable();

+1 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ void __init smp_callin(void)
	unmask_irq(IPI_INTR_VECT);
	unmask_irq(TIMER0_INTR_VECT);
	preempt_disable();
	notify_cpu_starting(cpu);
	local_irq_enable();

	cpu_set(cpu, cpu_online_map);
+1 −0
Original line number Diff line number Diff line
@@ -401,6 +401,7 @@ smp_callin (void)
	spin_lock(&vector_lock);
	/* Setup the per cpu irq handling data structures */
	__setup_vector_irq(cpuid);
	notify_cpu_starting(cpuid);
	cpu_set(cpuid, cpu_online_map);
	per_cpu(cpu_state, cpuid) = CPU_ONLINE;
	spin_unlock(&vector_lock);
+2 −0
Original line number Diff line number Diff line
@@ -498,6 +498,8 @@ static void __init smp_online(void)
{
	int cpu_id = smp_processor_id();

	notify_cpu_starting(cpu_id);

	local_irq_enable();

	/* Get our bogomips. */
Loading