diff options
| -rw-r--r-- | arch/x86/xen/spinlock.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c index 253f63fceea1..be6b86078957 100644 --- a/arch/x86/xen/spinlock.c +++ b/arch/x86/xen/spinlock.c | |||
| @@ -259,6 +259,14 @@ void xen_uninit_lock_cpu(int cpu) | |||
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | 261 | ||
| 262 | /* | ||
| 263 | * Our init of PV spinlocks is split in two init functions due to us | ||
| 264 | * using paravirt patching and jump labels patching and having to do | ||
| 265 | * all of this before SMP code is invoked. | ||
| 266 | * | ||
| 267 | * The paravirt patching needs to be done _before_ the alternative asm code | ||
| 268 | * is started, otherwise we would not patch the core kernel code. | ||
| 269 | */ | ||
| 262 | void __init xen_init_spinlocks(void) | 270 | void __init xen_init_spinlocks(void) |
| 263 | { | 271 | { |
| 264 | 272 | ||
| @@ -267,12 +275,26 @@ void __init xen_init_spinlocks(void) | |||
| 267 | return; | 275 | return; |
| 268 | } | 276 | } |
| 269 | 277 | ||
| 270 | static_key_slow_inc(¶virt_ticketlocks_enabled); | ||
| 271 | |||
| 272 | pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning); | 278 | pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning); |
| 273 | pv_lock_ops.unlock_kick = xen_unlock_kick; | 279 | pv_lock_ops.unlock_kick = xen_unlock_kick; |
| 274 | } | 280 | } |
| 275 | 281 | ||
| 282 | /* | ||
| 283 | * While the jump_label init code needs to happend _after_ the jump labels are | ||
| 284 | * enabled and before SMP is started. Hence we use pre-SMP initcall level | ||
| 285 | * init. We cannot do it in xen_init_spinlocks as that is done before | ||
| 286 | * jump labels are activated. | ||
| 287 | */ | ||
| 288 | static __init int xen_init_spinlocks_jump(void) | ||
| 289 | { | ||
| 290 | if (!xen_pvspin) | ||
| 291 | return 0; | ||
| 292 | |||
| 293 | static_key_slow_inc(¶virt_ticketlocks_enabled); | ||
| 294 | return 0; | ||
| 295 | } | ||
| 296 | early_initcall(xen_init_spinlocks_jump); | ||
| 297 | |||
| 276 | static __init int xen_parse_nopvspin(char *arg) | 298 | static __init int xen_parse_nopvspin(char *arg) |
| 277 | { | 299 | { |
| 278 | xen_pvspin = false; | 300 | xen_pvspin = false; |
