paravirt-spinlocks.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Split spinlock implementation out into its own file, so it can be
  3. * compiled in a FTRACE-compatible way.
  4. */
  5. #include <linux/spinlock.h>
  6. #include <linux/module.h>
  7. #include <linux/jump_label.h>
  8. #include <asm/paravirt.h>
  9. #ifdef CONFIG_QUEUED_SPINLOCKS
  10. __visible void __native_queued_spin_unlock(struct qspinlock *lock)
  11. {
  12. native_queued_spin_unlock(lock);
  13. }
  14. PV_CALLEE_SAVE_REGS_THUNK(__native_queued_spin_unlock);
  15. bool pv_is_native_spin_unlock(void)
  16. {
  17. return pv_lock_ops.queued_spin_unlock.func ==
  18. __raw_callee_save___native_queued_spin_unlock;
  19. }
  20. #endif
  21. struct pv_lock_ops pv_lock_ops = {
  22. #ifdef CONFIG_SMP
  23. #ifdef CONFIG_QUEUED_SPINLOCKS
  24. .queued_spin_lock_slowpath = native_queued_spin_lock_slowpath,
  25. .queued_spin_unlock = PV_CALLEE_SAVE(__native_queued_spin_unlock),
  26. .wait = paravirt_nop,
  27. .kick = paravirt_nop,
  28. #else /* !CONFIG_QUEUED_SPINLOCKS */
  29. .lock_spinning = __PV_IS_CALLEE_SAVE(paravirt_nop),
  30. .unlock_kick = paravirt_nop,
  31. #endif /* !CONFIG_QUEUED_SPINLOCKS */
  32. #endif /* SMP */
  33. };
  34. EXPORT_SYMBOL(pv_lock_ops);
  35. struct static_key paravirt_ticketlocks_enabled = STATIC_KEY_INIT_FALSE;
  36. EXPORT_SYMBOL(paravirt_ticketlocks_enabled);