Remove unused arch_*_relax operations from spinlocks
Subsystems (13)
cover Remove unused arch_*_relax operations from spinlocks
Hello,
This is an RFC cleanup series removing the unused arch_{spin,read,write}_relax macros from (nearly) all architectures that define them. The macros have no users in core code and are typically synonymous with cpu_relax(), the notable exceptions being PowerPC (where the thing is still unused) and S390.
S390 does actually use the relax macros internally, as part of the spinlock implementation, in order to yield the CPU when a virtual CPU is spinning. For that reason, I've left arch_spin_relax alone there.
Feedback welcome,
Will
Will Deacon (16):
alpha: locks: remove unused arch_*_relax operations
arc: locks: remove unused arch_*_relax operations
ARM: locks: remove unused arch_*_relax operations
arm64: locks: remove unused arch_*_relax operations
blackfin: locks: remove unused arch_*_relax operations
cris: locks: remove unused arch_*_relax operations
ia64: locks: remove unused arch_*_relax operations
m32r: locks: remove unused arch_*_relax operations
metag: locks: remove unused arch_*_relax operations
mips: locks: remove unused arch_*_relax operations
hppa: locks: remove unused arch_*_relax operations
powerpc: locks: remove unused arch_*_relax operations
s390: locks: remove unused arch_*_relax operations
sh: locks: remove unused arch_*_relax operations
sparc: locks: remove unused arch_*_relax operations
x86: locks: remove unused arch_*_relax operations
arch/alpha/include/asm/spinlock.h | 4 ---- arch/arc/include/asm/spinlock.h | 4 ---- arch/arm/include/asm/spinlock.h | 4 ---- arch/arm64/include/asm/spinlock.h | 4 ---- arch/blackfin/include/asm/spinlock.h | 4 ---- arch/cris/include/arch-v32/arch/spinlock.h | 4 ---- arch/ia64/include/asm/spinlock.h | 4 ---- arch/m32r/include/asm/spinlock.h | 4 ---- arch/metag/include/asm/spinlock.h | 4 ---- arch/metag/include/asm/spinlock_lnkget.h | 7 ------- arch/mips/include/asm/spinlock.h | 4 ---- arch/parisc/include/asm/spinlock.h | 4 ---- arch/powerpc/include/asm/spinlock.h | 4 ---- arch/s390/include/asm/spinlock.h | 3 --- arch/sh/include/asm/spinlock.h | 4 ---- arch/sparc/include/asm/spinlock_32.h | 4 ---- arch/sparc/include/asm/spinlock_64.h | 4 ---- arch/x86/include/asm/spinlock.h | 4 ---- 18 files changed, 74 deletions(-)
Signature · 1 line
1.8.2.2
RFC PATCH 1/16 alpha: locks: remove unused arch_*_relax operations
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Alpha.
--- arch/alpha/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/alpha/include/asm/spinlock.h +0 -4
@@ -168,8 +168,4 @@ static inline void arch_write_unlock(arch_rwlock_t * lock)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* _ALPHA_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 2/16 arc: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Arc.
--- arch/arc/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/arc/include/asm/spinlock.h +0 -4
@@ -137,8 +137,4 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 02/16] arc: locks: remove unused arch_*_relax operations
Hi Will,
Quoted 4 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for Arc.
For consistency sake, can you please uppercase to ARC in changelog above. Same goes for arc prefix in patch subject.
Quoted 3 lines
Cc Vineet Gupta <[email protected]>Signed-off-by Will Deacon <[email protected]>
Thx,
-Vineet
Quoted 17 lines
--- arch/arc/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)arch/arc/include/asm/spinlock.h +0
-4@@ -137,8 +137,4 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
Re: [RFC PATCH 02/16] arc: locks: remove unused arch_*_relax operations
Quoted 10 lines · Vineet Gupta
Hi Will,
Quoted 4 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for Arc.
For consistency sake, can you please uppercase to ARC in changelog above. Same goes for arc prefix in patch subject.
Sure, I'll update the log. I honestly had no idea about the casing and I was too lazy to look it up :)
Cheers,
Will
RFC PATCH 3/16 ARM: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for ARM.
--- arch/arm/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/include/asm/spinlock.h +0 -4
@@ -271,8 +271,4 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 4/16 arm64: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for arm64.
--- arch/arm64/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/include/asm/spinlock.h +0 -4
@@ -195,8 +195,4 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 5/16 blackfin: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Blackfin.
--- arch/blackfin/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/blackfin/include/asm/spinlock.h +0 -4
@@ -96,10 +96,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)__raw_write_unlock_asm (&rw->lock); } -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif #endif /* !__BFIN_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 6/16 cris: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Cris.
--- arch/cris/include/arch-v32/arch/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/cris/include/arch-v32/arch/spinlock.h +0 -4
@@ -124,8 +124,4 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)#define _raw_read_lock_flags (lock, flags) _raw_read_lock(lock)#define _raw_write_lock_flags (lock, flags) _raw_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_ARCH_SPINLOCK_H */
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 06/16] cris: locks: remove unused arch_*_relax operations
Quoted 6 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for Cris.
Cc Mikael Starvik <[email protected]>
Quoted 20 lines
Signed-off-by Will Deacon <[email protected]>--- arch/cris/include/arch-v32/arch/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)arch/cris/include/arch-v32/arch/spinlock.h +0
-4@@ -124,8 +124,4 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)#define _raw_read_lock_flags (lock, flags) _raw_read_lock(lock)#define _raw_write_lock_flags (lock, flags) _raw_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_ARCH_SPINLOCK_H */ Signature · 1 line
1.8.2.2
/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
RFC PATCH 7/16 ia64: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Itanium.
--- arch/ia64/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/ia64/include/asm/spinlock.h +0 -4
@@ -284,8 +284,4 @@ static inline int arch_read_trylock(arch_rwlock_t *x) return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word; } -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* _ASM_IA64_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 8/16 m32r: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for m32r.
--- arch/m32r/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/m32r/include/asm/spinlock.h +0 -4
@@ -320,8 +320,4 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* _ASM_M32R_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 9/16 metag: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Metag, including duplicate definitions of arch_{read,write}_lock_flags.
--- arch/metag/include/asm/spinlock.h | 4 ---- arch/metag/include/asm/spinlock_lnkget.h | 7 ------- 2 files changed, 11 deletions(-)
arch/metag/include/asm/spinlock.h +0 -4
@@ -15,8 +15,4 @@#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
arch/metag/include/asm/spinlock_lnkget.h +0 -7
@@ -239,11 +239,4 @@ static inline int arch_read_can_lock(arch_rwlock_t *rw) return tmp; } -#define arch_read_lock_flags (lock, flags) arch_read_lock(lock) -#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) - -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_LNKGET_H */
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 09/16] metag: locks: remove unused arch_*_relax operations
Quoted 8 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for Metag, including duplicate definitions of arch_{read,write}_lock_flags.
Cc James Hogan <[email protected]>Signed-off-by Will Deacon <[email protected]>
Thanks
James
RFC PATCH 10/16 mips: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for MIPS.
--- arch/mips/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/mips/include/asm/spinlock.h +0 -4
@@ -419,8 +419,4 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* _ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 10/16] mips: locks: remove unused arch_*_relax operations
Quoted 7 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for MIPS.
Cc Ralf Baechle <[email protected]>Cc David Daney <[email protected]>
FWIW: Acked-by: David Daney <[email protected]>
Quoted 19 lines
Signed-off-by Will Deacon <[email protected]>--- arch/mips/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)arch/mips/include/asm/spinlock.h +0
-4@@ -419,8 +419,4 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* _ASM_SPINLOCK_H */
RFC PATCH 11/16 hppa: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for parisc.
--- arch/parisc/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/parisc/include/asm/spinlock.h +0 -4
@@ -191,8 +191,4 @@ static __inline__ int arch_write_can_lock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
Helge Deller
maintainerRFC PATCH 11/16 hppa: locks: remove unused arch_*_relax operations
Thanks Will,
forwarding to [email protected] so that it gets into parisc patchwork.
I'll queue this patch up for 3.11 if it's OK for you.
Helge
-------- Original Message --------
Subject: [RFC PATCH 11/16] hppa: locks: remove unused arch_*_relax operations
Date: Fri, 21 Jun 2013 18:17:32 +0100
From: Will Deacon <[email protected]>
To: [email protected]
CC: Will Deacon <[email protected]>, Helge Deller <[email protected]>
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for parisc.
--- arch/parisc/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/parisc/include/asm/spinlock.h +0 -3
@@ -191,8 +191,4 @@ static __inline__ int arch_write_can_lock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax()
Re: Fwd: [RFC PATCH 11/16] hppa: locks: remove unused arch_*_relax operations
Quoted 1 line · Helge Deller
Thanks Will,
Hi Helge,
Quoted 3 lines
forwarding to [email protected] so that it gets into parisc patchwork.
I'll queue this patch up for 3.11 if it's OK for you.
Fine by me. Each patch in the series is self-contained, so they can get merged via the arch trees without any problem.
Thanks!
Will
Re: Fwd: [RFC PATCH 11/16] hppa: locks: remove unused arch_*_relax operations
Quoted 11 lines · Will Deacon
Quoted 1 line · Helge Deller
Thanks Will,
Hi Helge,
Quoted 3 lines
forwarding to [email protected] so that it gets into parisc patchwork.
I'll queue this patch up for 3.11 if it's OK for you.
Fine by me. Each patch in the series is self-contained, so they can get merged via the arch trees without any problem.
Wait a second; turns out the GENERIC_LOCKBREAK code *can* emit calls to these functions, so I'll need to sort that out before you can take the arch-side of things.
Better hold off on this until I have that fixed.
Cheers,
Will
RFC PATCH 12/16 powerpc: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for PowerPC.
--- arch/powerpc/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/powerpc/include/asm/spinlock.h +0 -4
@@ -291,9 +291,5 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) __spin_yield(lock) -#define arch_read_relax (lock) __rw_yield(lock) -#define arch_write_relax (lock) __rw_yield(lock) -#endif /* __KERNEL__ */ #endif /* __ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 12/16] powerpc: locks: remove unused arch_*_relax operations
Quoted 5 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for PowerPC.
Quoted 19 lines
Signed-off-by Will Deacon <[email protected]>--- arch/powerpc/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)arch/powerpc/include/asm/spinlock.h +0
-4@@ -291,9 +291,5 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) __spin_yield(lock) -#define arch_read_relax (lock) __rw_yield(lock) -#define arch_write_relax (lock) __rw_yield(lock) -#endif /* __KERNEL__ */ #endif /* __ASM_SPINLOCK_H */
RFC PATCH 13/16 s390: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for S390. arch_spin_relax is left alone, since the S390 spinlock internals rely on (and export) this symbol.
--- arch/s390/include/asm/spinlock.h | 3 --- 1 file changed, 3 deletions(-)
arch/s390/include/asm/spinlock.h +0 -3
@@ -170,7 +170,4 @@ static inline int arch_write_trylock(arch_rwlock_t *rw) return _raw_write_trylock_retry(rw); } -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 14/16 sh: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for SuperH.
--- arch/sh/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/sh/include/asm/spinlock.h +0 -4
@@ -219,8 +219,4 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)#define arch_read_lock_flags (lock, flags) arch_read_lock(lock)#define arch_write_lock_flags (lock, flags) arch_write_lock(lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* __ASM_SH_SPINLOCK_H */
Signature · 1 line
1.8.2.2
RFC PATCH 15/16 sparc: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for Sparc.
--- arch/sparc/include/asm/spinlock_32.h | 4 ---- arch/sparc/include/asm/spinlock_64.h | 4 ---- 2 files changed, 8 deletions(-)
arch/sparc/include/asm/spinlock_32.h +0 -4
@@ -188,10 +188,6 @@ static inline int __arch_read_trylock(arch_rwlock_t *rw)#define arch_read_lock_flags (rw, flags) arch_read_lock(rw)#define arch_write_lock_flags (rw, flags) arch_write_lock(rw) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#define arch_read_can_lock (rw) (!((rw)->lock & 0xff))#define arch_write_can_lock (rw) (!(rw)->lock)
arch/sparc/include/asm/spinlock_64.h +0 -4
@@ -216,10 +216,6 @@ static int inline arch_write_trylock(arch_rwlock_t *lock)#define arch_read_can_lock (rw) (!((rw)->lock & 0x80000000UL))#define arch_write_can_lock (rw) (!(rw)->lock) -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -#endif /* !(__ASSEMBLY__) */ #endif /* !(__SPARC64_SPINLOCK_H) */
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 15/16] sparc: locks: remove unused arch_*_relax operations
From: Will Deacon <[email protected]>
Date: Fri, 21 Jun 2013 18:17:36 +0100
Quoted 7 lines
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for Sparc.
Cc David Miller <[email protected]>Signed-off-by Will Deacon <[email protected]>
RFC PATCH 16/16 x86: locks: remove unused arch_*_relax operations
In reply to Will DeaconThe arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax().
This patch removes the unused definitions for x86.
--- arch/x86/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/include/asm/spinlock.h +0 -4
@@ -229,10 +229,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#undef WRITE_LOCK_SUB#undef WRITE_LOCK_CMP -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -/* The {read|write|spin}_lock() on x86 are full memory barriers. */ static inline void smp_mb__after_lock (void ) { }#define ARCH_HAS_SMP_MB_AFTER_LOCK
Signature · 1 line
1.8.2.2
Re: [RFC PATCH 16/16] x86: locks: remove unused arch_*_relax operations
Quoted 9 lines · Will Deacon
The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for
cpu_relax().This patch removes the unused definitions for x86.
Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>Signed-off-by Will Deacon <[email protected]>
Quoted 23 lines
--- arch/x86/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-)arch/x86/include/asm/spinlock.h +0
-4@@ -229,10 +229,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)#undef WRITE_LOCK_SUB#undef WRITE_LOCK_CMP -#define arch_spin_relax (lock) cpu_relax() -#define arch_read_relax (lock) cpu_relax() -#define arch_write_relax (lock) cpu_relax() -/* The {read|write|spin}_lock() on x86 are full memory barriers. */ static inline void smp_mb__after_lock (void ) { }#define ARCH_HAS_SMP_MB_AFTER_LOCK Signature · 1 line
1.8.2.2
Quoted 5 lines · Will Deacon
This is an RFC cleanup series removing the unused arch_{spin,read,write}_relax macros from (nearly) all architectures that define them. The macros have no users in core code and are typically synonymous with
cpu_relax(), the notable exceptions being PowerPC (where the thing is still unused) and S390.
So the `no users in core code' part isn't quite true...
With GENERIC_LOCKBREAK (arm64, ia64, m32r, parisc, powerpc, s390, sh and sparc), we can actually spit out arch_*_relax calls in kernel/spinlock.c using some macro concatenation that defeated my grep-fu.
This only makes a difference on powerpc and s390, so we could either:
(1) conditionally define the relax macros as cpu_relax in spinlock.c (so the two guys above can have their special versions)
(2) Replace the calls with calls to cpu_relax() (although powerpc seems to want to know who owns the lock in order to relax)
(3) Leave the current code alone for architectures that may select GENERIC_LOCKBREAK
Any other ideas/preferences?
Will
Quoted 18 lines · On Mon, 24 Jun 2013 12:58:25 +0100 Will Deacon <[email protected]> wrote:
Quoted 5 lines · Will Deacon
This is an RFC cleanup series removing the unused arch_{spin,read,write}_relax macros from (nearly) all architectures that define them. The macros have no users in core code and are typically synonymous with
cpu_relax(), the notable exceptions being PowerPC (where the thing is still unused) and S390.So the `no users in core code' part isn't quite true...
With
GENERIC_LOCKBREAK(arm64, ia64, m32r, parisc, powerpc, s390, sh and sparc), we can actually spit out arch_*_relax calls inkernel/spinlock.cusing some macro concatenation that defeated my grep-fu.This only makes a difference on powerpc and s390, so we could either:
(1) conditionally define the relax macros as
cpu_relaxinspinlock.c(so the two guys above can have their special versions)
Quoted 7 lines
(2) Replace the calls with calls to
cpu_relax()(although powerpc seems to want to know who owns the lock in order to relax)(3) Leave the current code alone for architectures that may select
GENERIC_LOCKBREAKAny other ideas/preferences?
Yeah, we never came around to implement arch_read/write_relax. We can remove the two defines for s390, if we want to add some logic there we can just re-add an appropriate definition. As powerpc is optimizing their read/write locks with GENERIC_LOCKBREAK=y we should leave the ability to override the relax function as it is, no?
Signature · 4 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin.
Quoted 17 lines · Martin Schwidefsky
Quoted 15 lines · On Mon, 24 Jun 2013 12:58:25 +0100 Will Deacon <[email protected]> wrote:
With
GENERIC_LOCKBREAK(arm64, ia64, m32r, parisc, powerpc, s390, sh and sparc), we can actually spit out arch_*_relax calls inkernel/spinlock.cusing some macro concatenation that defeated my grep-fu.This only makes a difference on powerpc and s390, so we could either:
(1) conditionally define the relax macros as
cpu_relaxinspinlock.c(so the two guys above can have their special versions)(2) Replace the calls with calls to
cpu_relax()(although powerpc seems to want to know who owns the lock in order to relax)(3) Leave the current code alone for architectures that may select
GENERIC_LOCKBREAK
Quoted 7 lines
Quoted 1 line
Any other ideas/preferences?
Yeah, we never came around to implement arch_read/write_relax. We can remove the two defines for s390, if we want to add some logic there we can just re-add an appropriate definition. As powerpc is optimizing their read/write locks with GENERIC_LOCKBREAK=y we should leave the ability to override the relax function as it is, no?
Yes, I'll drop the powerpc patch and then add the following patch to the start of the series for v2.
Cheers,
Will
--->8
From 87707347c9239b647c3b1dd57063eac08fdb1bf4 Mon Sep 17 00:00:00 2001
From: Will Deacon <[email protected]>
Date: Mon, 24 Jun 2013 19:06:51 +0100
Subject: [PATCH] locking: add default arch_*_relax definitions for
GENERIC_LOCKBREAK
When running with GENERIC_LOCKBREAK=y, the locking implementations emit calls to arch_{read,write,spin}_relax when spinning on a contended lock in order to allow architectures to favour the CPU owning the lock if possible.
In reality, everybody apart from PowerPC and S390 just does cpu_relax() here, so make that the default behaviour and allow it to be overridden if required.
--- kernel/spinlock.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
kernel/spinlock.c +14 -0
@@ -34,6 +34,20 @@#else #define raw_read_can_lock (l) read_can_lock(l)#define raw_write_can_lock (l) write_can_lock(l) + +/* +* Some architectures can relax in favour of the CPU owning the lock. +*/ +#ifndef arch_read_relax +# define arch_read_relax (l) cpu_relax() +#endif +#ifndef arch_write_relax +# define arch_write_relax (l) cpu_relax() +#endif +#ifndef arch_spin_relax +# define arch_spin_relax (l) cpu_relax() +#endif +/* * We build the __lock_function inlines here. They are too large for * inlining all over the place, but here is only one user per function
Signature · 1 line
1.8.2.2