spinlock.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_SPINLOCK_H
  3. #define _ASM_X86_SPINLOCK_H
  4. #include <linux/jump_label.h>
  5. #include <linux/atomic.h>
  6. #include <asm/page.h>
  7. #include <asm/processor.h>
  8. #include <linux/compiler.h>
  9. #include <asm/paravirt.h>
  10. #include <asm/bitops.h>
  11. /*
  12. * Your basic SMP spinlocks, allowing only a single CPU anywhere
  13. *
  14. * Simple spin lock operations. There are two variants, one clears IRQ's
  15. * on the local processor, one does not.
  16. *
  17. * These are fair FIFO ticket locks, which support up to 2^16 CPUs.
  18. *
  19. * (the type definitions are in asm/spinlock_types.h)
  20. */
  21. /* How long a lock should spin before we consider blocking */
  22. #define SPIN_THRESHOLD (1 << 15)
  23. #include <asm/qspinlock.h>
  24. /*
  25. * Read-write spinlocks, allowing multiple readers
  26. * but only one writer.
  27. *
  28. * NOTE! it is quite common to have readers in interrupts
  29. * but no interrupt writers. For those circumstances we
  30. * can "mix" irq-safe locks - any writer needs to get a
  31. * irq-safe write-lock, but readers can get non-irqsafe
  32. * read-locks.
  33. *
  34. * On x86, we implement read-write locks using the generic qrwlock with
  35. * x86 specific optimization.
  36. */
  37. #include <asm/qrwlock.h>
  38. #endif /* _ASM_X86_SPINLOCK_H */