]> Pileus Git - ~andy/linux/commit
xen: Do not enable spinlocks before jump_label_init() has executed
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 13 Sep 2013 02:29:44 +0000 (22:29 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 24 Sep 2013 20:22:26 +0000 (16:22 -0400)
commita945928ea2709bc0e8e8165d33aed855a0110279
tree377335d8b41fd5c9087dee8f0a526b82819ffec1
parentbf4a7c054be1306dcee5d4f5028eb66caf714037
xen: Do not enable spinlocks before jump_label_init() has executed

xen_init_spinlocks() currently calls static_key_slow_inc() before
jump_label_init() is invoked. When CONFIG_JUMP_LABEL is set (which usually is
the case) the effect of this static_key_slow_inc() is deferred until after
jump_label_init(). This is different from when CONFIG_JUMP_LABEL is not set, in
which case the key is set immediately. Thus, depending on the value of config
option, we may observe different behavior.

In addition, when we come to __jump_label_transform() from jump_label_init(),
the key (paravirt_ticketlocks_enabled) is already enabled. On processors where
ideal_nop is not the same as default_nop this will cause a BUG() since it is
expected that before a key is enabled the latter is replaced by the former
during initialization.

To address this problem we need to move
static_key_slow_inc(&paravirt_ticketlocks_enabled) so that it is called
after jump_label_init(). We also need to make sure that this is done before
other cpus start to boot. early_initcall appears to be  a good place to do so.
(Note that we cannot move whole xen_init_spinlocks() there since pv_lock_ops
need to be set before alternative_instructions() runs.)

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v2: Added extra comments in the code]
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
arch/x86/xen/spinlock.c