Skip to contentSkip to conversation

Remove unused arch_*_relax operations from spinlocks

RFC PATCH In review Will Deacon 10 participants 31 messages Jun 21, 2013 – Jul 1, 2013

Subsystems (13)
Arm (32-bit) x86 PowerPC MIPS +9 more subsystems
lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 3bba21e..37b570d 100644
@@ -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
#5 lore raw

RFC PATCH 3/16 ARM: locks: remove unused arch_*_relax operations

In reply to 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 ARM.

---
 arch/arm/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/arm/include/asm/spinlock.h +0 -4
index 6220e9f..46a55a9 100644
@@ -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
#6 lore raw

RFC PATCH 4/16 arm64: locks: remove unused arch_*_relax operations

In reply to 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 arm64.

Cc Catalin Marinas <[email protected]>
---
 arch/arm64/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/arm64/include/asm/spinlock.h +0 -4
index 7065e92..efeadbd 100644
@@ -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
#2 lore raw

RFC PATCH 2/16 arc: locks: remove unused arch_*_relax operations

In reply to 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.

---
 arch/arc/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/arc/include/asm/spinlock.h +0 -4
index f158197..fddced5 100644
@@ -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
#12 lore raw

RFC PATCH 9/16 metag: locks: remove unused arch_*_relax operations

In reply to 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.

---
 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
index 86a7cf3..15cf4ff 100644
@@ -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
index ad8436f..73d0345 100644
@@ -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
#22 lore raw

RFC PATCH 13/16 s390: locks: remove unused arch_*_relax operations

In reply to Will Deacon

The 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.

Cc Martin Schwidefsky <[email protected]>
---
 arch/s390/include/asm/spinlock.h | 3 ---
 1 file changed, 3 deletions(-)
arch/s390/include/asm/spinlock.h +0 -3
index 701fe8c..8b030e2 100644
@@ -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
#8 lore raw

RFC PATCH 6/16 cris: locks: remove unused arch_*_relax operations

In reply to 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]>
Cc Jesper Nilsson <[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
index f132755..bf94cc6 100644
@@ -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
#24 lore raw

RFC PATCH 15/16 sparc: locks: remove unused arch_*_relax operations

In reply to 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 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
index bcc98fc..180c8f3 100644
@@ -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
index 9689176..f3b7a88 100644
@@ -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
#16 lore raw

RFC PATCH 11/16 hppa: locks: remove unused arch_*_relax operations

In reply to 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 parisc.

---
 arch/parisc/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/parisc/include/asm/spinlock.h +0 -4
index 3516e0b..64f2992 100644
@@ -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
#14 lore raw

RFC PATCH 10/16 mips: locks: remove unused arch_*_relax operations

In reply to 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]>
---
 arch/mips/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/mips/include/asm/spinlock.h +0 -4
index 78d201f..7bd850a 100644
@@ -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
#20 lore raw

RFC PATCH 12/16 powerpc: locks: remove unused arch_*_relax operations

In reply to 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.

Cc Benjamin Herrenschmidt <[email protected]>
---
 arch/powerpc/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/powerpc/include/asm/spinlock.h +0 -4
index 5b23f91..2d4a841 100644
@@ -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
#23 lore raw

RFC PATCH 14/16 sh: locks: remove unused arch_*_relax operations

In reply to 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 SuperH.

---
 arch/sh/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/sh/include/asm/spinlock.h +0 -4
index bdc0f3b..a89820d 100644
@@ -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
#26 lore raw

RFC PATCH 16/16 x86: locks: remove unused arch_*_relax operations

In reply to 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]>
---
 arch/x86/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/include/asm/spinlock.h +0 -4
index 33692ea..1088d8d 100644
@@ -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
#7 lore raw

RFC PATCH 5/16 blackfin: locks: remove unused arch_*_relax operations

In reply to 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 Blackfin.

Cc Mike Frysinger <[email protected]>
---
 arch/blackfin/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/blackfin/include/asm/spinlock.h +0 -4
index 490c7ca..8c58dda 100644
@@ -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
#10 lore raw

RFC PATCH 7/16 ia64: locks: remove unused arch_*_relax operations

In reply to 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 Itanium.

---
 arch/ia64/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/ia64/include/asm/spinlock.h +0 -4
index 54ff557..041f2bc 100644
@@ -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
#11 lore raw

RFC PATCH 8/16 m32r: locks: remove unused arch_*_relax operations

In reply to 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 m32r.

Cc Hirokazu Takata <[email protected]>
---
 arch/m32r/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/m32r/include/asm/spinlock.h +0 -4
index fa13694..3112249 100644
@@ -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
#15 lore raw

Re: [RFC PATCH 10/16] mips: locks: remove unused arch_*_relax operations

In reply to Will Deacon
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
---
  arch/mips/include/asm/spinlock.h | 4 ----
  1 file changed, 4 deletions(-)
arch/mips/include/asm/spinlock.h +0 -4
index 78d201f..7bd850a 100644
@@ -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 */
maintainer
#17 lore raw

RFC PATCH 11/16 hppa: locks: remove unused arch_*_relax operations

In reply to Will Deacon

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
index 3516e0b..64f2992 100644
@@ -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()
maintainer Acked-by on v1 15/16
#25 lore raw

Re: [RFC PATCH 15/16] sparc: locks: remove unused arch_*_relax operations

In reply to Will Deacon

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.

Acked-by on v1 16/16
#27 lore raw

Re: [RFC PATCH 16/16] x86: locks: remove unused arch_*_relax operations

In reply to Will Deacon
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]>
Quoted 23 lines
---
 arch/x86/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/include/asm/spinlock.h +0 -4
index 33692ea..1088d8d 100644
@@ -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
Acked-by on v1 12/16
#21 lore raw

Re: [RFC PATCH 12/16] powerpc: locks: remove unused arch_*_relax operations

In reply to Will Deacon
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
---
 arch/powerpc/include/asm/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/powerpc/include/asm/spinlock.h +0 -4
index 5b23f91..2d4a841 100644
@@ -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 */
Acked-by on v1 2/16
#3 lore raw

Re: [RFC PATCH 02/16] arc: locks: remove unused arch_*_relax operations

In reply to Will Deacon

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

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
index f158197..fddced5 100644
@@ -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 */
Acked-by on v1 6/16
#9 lore raw

Re: [RFC PATCH 06/16] cris: locks: remove unused arch_*_relax operations

In reply to Will Deacon
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
---
 arch/cris/include/arch-v32/arch/spinlock.h | 4 ----
 1 file changed, 4 deletions(-)
arch/cris/include/arch-v32/arch/spinlock.h +0 -4
index f132755..bf94cc6 100644
@@ -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]
#18 lore raw

Re: Fwd: [RFC PATCH 11/16] hppa: locks: remove unused arch_*_relax operations

In reply to Helge Deller
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

#4 lore raw

Re: [RFC PATCH 02/16] arc: locks: remove unused arch_*_relax operations

In reply to Vineet Gupta
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

Acked-by on v1 9/16
#13 lore raw

Re: [RFC PATCH 09/16] metag: locks: remove unused arch_*_relax operations

In reply to Will Deacon
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.

Thanks
James

#19 lore raw

Re: Fwd: [RFC PATCH 11/16] hppa: locks: remove unused arch_*_relax operations

In reply to Will Deacon
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

#28 lore raw
In reply to Will Deacon
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

#29 lore raw
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 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)

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_LOCKBREAK

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?

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#30 lore raw
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 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

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.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/spinlock.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
kernel/spinlock.c +14 -0
index 5cdd806..4b082b5 100644
@@ -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