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

Commit ca5d376e authored by Dou Liyang's avatar Dou Liyang Committed by Ingo Molnar
Browse files

x86/paravirt: Set up the virt_spin_lock_key after static keys get initialized



Commit:

  9043442b ("locking/paravirt: Use new static key for controlling call of virt_spin_lock()")

sets the static virt_spin_lock_key to a value before jump_label_init()
has been called, which will result in a WARN().

Reorder the initialization sequence:

 - Move the native_pv_lock_init() into native_smp_prepare_cpus()
 - set the value in xen_init_lock_cpu()

to avoid calling into the not yet initialized static keys subsystem.

Suggested-by: default avatarJuergen Gross <jgross@suse.com>
Reported-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: boris.ostrovsky@oracle.com
Cc: bp@suse.de
Cc: luto@kernel.org
Cc: vkuznets@redhat.com
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/1509170804-3813-1-git-send-email-douly.fnst@cn.fujitsu.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent e319e1fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1358,6 +1358,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
	pr_info("CPU0: ");
	print_cpu_info(&cpu_data(0));

	native_pv_lock_init();

	uv_system_init();

	set_mtrr_aps_delayed_init();
@@ -1385,7 +1387,6 @@ void __init native_smp_prepare_boot_cpu(void)
	/* already set me in cpu_online_mask in boot_cpu_init() */
	cpumask_set_cpu(me, cpu_callout_mask);
	cpu_set_state_online(me);
	native_pv_lock_init();
}

void __init native_smp_cpus_done(unsigned int max_cpus)
+4 −2
Original line number Diff line number Diff line
@@ -81,8 +81,11 @@ void xen_init_lock_cpu(int cpu)
	int irq;
	char *name;

	if (!xen_pvspin)
	if (!xen_pvspin) {
		if (cpu == 0)
			static_branch_disable(&virt_spin_lock_key);
		return;
	}

	WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n",
	     cpu, per_cpu(lock_kicker_irq, cpu));
@@ -130,7 +133,6 @@ void __init xen_init_spinlocks(void)

	if (!xen_pvspin) {
		printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
		static_branch_disable(&virt_spin_lock_key);
		return;
	}
	printk(KERN_DEBUG "xen: PV spinlocks enabled\n");