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
5#ifndef __ASM_SPINLOCK_H5#ifndef __ASM_SPINLOCK_H
6#define __ASM_SPINLOCK_H6#define __ASM_SPINLOCK_H
7 7
8#include <asm/qrwlock.h>
9#include <asm/qspinlock.h>8#include <asm/qspinlock.h>
9#include <asm/qrwlock.h>
10 10
11/* See include/linux/spinlock.h */11/* See include/linux/spinlock.h */
12#define smp_mb__after_spinlock() smp_mb()12#define smp_mb__after_spinlock() smp_mb()
arch/mips/include/asm/spinlock.h+1−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
10#define _ASM_SPINLOCK_H10#define _ASM_SPINLOCK_H
11 11
12#include <asm/processor.h>12#include <asm/processor.h>
13#include <asm/qrwlock.h>
14 13
15#include <asm-generic/qspinlock_types.h>14#include <asm-generic/qspinlock_types.h>
16 15
@@ -27,5 +26,6 @@ static inline void queued_spin_unlock(struct qspinlock *lock) · 10 unmodified lines
27}26}
28 27
29#include <asm/qspinlock.h>28#include <asm/qspinlock.h>
29#include <asm/qrwlock.h>
30 30
31#endif /* _ASM_SPINLOCK_H */31#endif /* _ASM_SPINLOCK_H */
arch/sparc/include/asm/spinlock_64.h+1−1
@@ -11,8 +11,8 @@ · 10 unmodified lines
11 11
12#include <asm/processor.h>12#include <asm/processor.h>
13#include <asm/barrier.h>13#include <asm/barrier.h>
14#include <asm/qrwlock.h>
15#include <asm/qspinlock.h>14#include <asm/qspinlock.h>
15#include <asm/qrwlock.h>
16 16
17#endif /* !(__ASSEMBLY__) */17#endif /* !(__ASSEMBLY__) */
18 18
arch/xtensa/include/asm/spinlock.h+1−1
@@ -12,8 +12,8 @@ · 11 unmodified lines
12#define _XTENSA_SPINLOCK_H12#define _XTENSA_SPINLOCK_H
13 13
14#include <asm/barrier.h>14#include <asm/barrier.h>
15#include <asm/qrwlock.h>
16#include <asm/qspinlock.h>15#include <asm/qspinlock.h>
16#include <asm/qrwlock.h>
17 17
18#define smp_mb__after_spinlock() smp_mb()18#define smp_mb__after_spinlock() smp_mb()
19 19
include/asm-generic/qrwlock.h+2−1
@@ -14,7 +14,8 @@ · 13 unmodified lines
14#include <asm/processor.h>14#include <asm/processor.h>
15 15
16#include <asm-generic/qrwlock_types.h>16#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. */
18 19
19/*20/*
20 * Writer states & reader shift and bias.21 * Writer states & reader shift and bias.
kernel/locking/qrwlock.c+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
12#include <linux/percpu.h>12#include <linux/percpu.h>
13#include <linux/hardirq.h>13#include <linux/hardirq.h>
14#include <linux/spinlock.h>14#include <linux/spinlock.h>
15#include <asm/qrwlock.h>
16 15
17/**16/**
18 * queued_read_lock_slowpath - acquire read lock of a queue rwlock17 * 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