History

locking/arch: Move qrwlock.h include after qspinlock.h

include/asm-generic/qrwlock.h was trying to get arch_spin_is_locked via asm-generic/qspinlock.h. However, this does not work because architectures might be using queued rwlocks but not queued spinlocks (csky), or because they might be defining their own queued_* macros before including asm/qspinlock.h. To fix this, ensure that asm/spinlock.h always includes qrwlock.h after defining arch_spin_is_locked (either directly for csky, or via asm/qspinlock.h for other architectures). The only inclusion elsewhere is in kernel/locking/qrwlock.c. That one is really unnecessary because the file is only compiled in SMP configurations (config QUEUED_RWLOCKS depends on SMP) and in that case linux/spinlock.h already includes asm/qrwlock.h if needed, via asm/spinlock.h.

Waiman Long committed 5 years ago

Commit d8d0da41 parent 9294b8a6 files · +6 −6Browse files

Unified · Split

6 files
  1. arch/arm64/include/asm/spinlock.h +1 −1
  2. arch/mips/include/asm/spinlock.h +1 −1
  3. arch/sparc/include/asm/spinlock_64.h +1 −1
  4. arch/xtensa/include/asm/spinlock.h +1 −1
  5. include/asm-generic/qrwlock.h +2 −1
  6. kernel/locking/qrwlock.c +0 −1
arch/arm64/include/asm/spinlock.h+1−1
@@ -5,8 +5,8 @@ · 4 unmodified lines
55 #ifndef __ASM_SPINLOCK_H
66 #define __ASM_SPINLOCK_H
77
8−#include <asm/qrwlock.h>
98 #include <asm/qspinlock.h>
9+#include <asm/qrwlock.h>
1010
1111 /* See include/linux/spinlock.h */
1212 #define smp_mb__after_spinlock() smp_mb()
arch/mips/include/asm/spinlock.h+1−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #define _ASM_SPINLOCK_H
1111
1212 #include <asm/processor.h>
13−#include <asm/qrwlock.h>
1413
1514 #include <asm-generic/qspinlock_types.h>
1615
@@ -27,5 +26,6 @@ static inline void queued_spin_unlock(struct qspinlock *lock) · 10 unmodified lines
2726 }
2827
2928 #include <asm/qspinlock.h>
29+#include <asm/qrwlock.h>
3030
3131 #endif /* _ASM_SPINLOCK_H */
arch/sparc/include/asm/spinlock_64.h+1−1
@@ -11,8 +11,8 @@ · 10 unmodified lines
1111
1212 #include <asm/processor.h>
1313 #include <asm/barrier.h>
14−#include <asm/qrwlock.h>
1514 #include <asm/qspinlock.h>
15+#include <asm/qrwlock.h>
1616
1717 #endif /* !(__ASSEMBLY__) */
1818
arch/xtensa/include/asm/spinlock.h+1−1
@@ -12,8 +12,8 @@ · 11 unmodified lines
1212 #define _XTENSA_SPINLOCK_H
1313
1414 #include <asm/barrier.h>
15−#include <asm/qrwlock.h>
1615 #include <asm/qspinlock.h>
16+#include <asm/qrwlock.h>
1717
1818 #define smp_mb__after_spinlock() smp_mb()
1919
include/asm-generic/qrwlock.h+2−1
@@ -14,7 +14,8 @@ · 13 unmodified lines
1414 #include <asm/processor.h>
1515
1616 #include <asm-generic/qrwlock_types.h>
17−#include <asm-generic/qspinlock.h>
17+
18+/* Must be included from asm/spinlock.h after defining arch_spin_is_locked. */
1819
1920 /*
2021 * Writer states & reader shift and bias.
kernel/locking/qrwlock.c+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <linux/percpu.h>
1313 #include <linux/hardirq.h>
1414 #include <linux/spinlock.h>
15−#include <asm/qrwlock.h>
1615
1716 /**
1817 * queued_read_lock_slowpath - acquire read lock of a queue rwlock

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t