projects/linux·commit bc6cb4d5

Merge tag 'locking-core-2023-06-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

bc6cb4d5 · Linus Torvalds <[email protected]> · 2023-06-27 14:14:30 -07:00

Pull locking updates from Ingo Molnar:

 - Introduce cmpxchg128() -- aka. the demise of cmpxchg_double()

   The cmpxchg128() family of functions is basically & functionally the
   same as cmpxchg_double(), but with a saner interface.

   Instead of a 6-parameter horror that forced u128 - u64/u64-halves
   layout details on the interface and exposed users to complexity,
   fragility & bugs, use a natural 3-parameter interface with u128
   types.

 - Restructure the generated atomic headers, and add kerneldoc comments
   for all of the generic atomic{,64,_long}_t operations.

   The generated definitions are much cleaner now, and come with
   documentation.

 - Implement lock_set_cmp_fn() on lockdep, for defining an ordering when
   taking multiple locks of the same type.

   This gets rid of one use of lockdep_set_novalidate_class() in the
   bcache code.

 - Fix raw_cpu_generic_try_cmpxchg() bug due to an unintended variable
   shadowing generating garbage code on Clang on certain ARM builds.

* tag 'locking-core-2023-06-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (43 commits)
  locking/atomic: scripts: fix ${atomic}_dec_if_positive() kerneldoc
  percpu: Fix self-assignment of __old in raw_cpu_generic_try_cmpxchg()
  locking/atomic: treewide: delete arch_atomic_*() kerneldoc
  locking/atomic: docs: Add atomic operations to the driver basic API documentation
  locking/atomic: scripts: generate kerneldoc comments
  docs: scripts: kernel-doc: accept bitwise negation like ~@var
  locking/atomic: scripts: simplify raw_atomic*() definitions
  locking/atomic: scripts: simplify raw_atomic_long*() definitions
  locking/atomic: scripts: split pfx/name/sfx/order
  locking/atomic: scripts: restructure fallback ifdeffery
  locking/atomic: scripts: build raw_atomic_long*() directly
  locking/atomic: treewide: use raw_atomic*_<op>()
  locking/atomic: scripts: add trivial raw_atomic*_<op>()
  locking/atomic: scripts: factor out order template generation
  locking/atomic: scripts: remove leftover "${mult}"
  locking/atomic: scripts: remove bogus order parameter
  locking/atomic: xtensa: add preprocessor symbols
  locking/atomic: x86: add preprocessor symbols
  locking/atomic: sparc: add preprocessor symbols
  locking/atomic: sh: add preprocessor symbols
  ...
Commit
bc6cb4d5bc3a44197de30784eae71d8ba28483eb
Parents
ed3b7923 · b33eb50a

Merge commit. Changes below are compared with the first parent: ed3b7923.

Changes

136 files changed · +9922 −4161

FileStatusAddDelContent
Documentation/core-api/this_cpu_ops.rstmodified+0−2View file
Documentation/driver-api/basics.rstmodified+7−1View file
arch/alpha/include/asm/atomic.hmodified+0−35View file
arch/arc/include/asm/atomic-spinlock.hmodified+9−0View file
arch/arc/include/asm/atomic.hmodified+0−24View file
arch/arc/include/asm/atomic64-arcv2.hmodified+2−17View file
arch/arm/include/asm/assembler.hmodified+17−0View file
arch/arm/include/asm/atomic.hmodified+11−4View file
arch/arm/include/asm/sync_bitops.hmodified+25−4View file
arch/arm/lib/bitops.hmodified+11−3View file
arch/arm/lib/testchangebit.Smodified+4−0View file
arch/arm/lib/testclearbit.Smodified+4−0View file
arch/arm/lib/testsetbit.Smodified+4−0View file
arch/arm64/include/asm/atomic.hmodified+0−28View file
arch/arm64/include/asm/atomic_ll_sc.hmodified+32−24View file
arch/arm64/include/asm/atomic_lse.hmodified+17−22View file
arch/arm64/include/asm/cmpxchg.hmodified+14−34View file
arch/arm64/include/asm/percpu.hmodified+20−10View file
arch/csky/include/asm/atomic.hmodified+0−35View file
arch/hexagon/include/asm/atomic.hmodified+9−60View file
arch/ia64/include/asm/atomic.hmodified+0−7View file
arch/loongarch/include/asm/atomic.hmodified+0−56View file
arch/m68k/include/asm/atomic.hmodified+12−6View file
arch/mips/include/asm/atomic.hmodified+0−11View file
arch/openrisc/include/asm/atomic.hmodified+0−3View file
arch/parisc/include/asm/atomic.hmodified+18−9View file
arch/powerpc/include/asm/atomic.hmodified+0−24View file
arch/powerpc/kernel/smp.cmodified+6−6View file
arch/riscv/include/asm/atomic.hmodified+0−72View file
arch/s390/include/asm/cmpxchg.hmodified+6−26View file
arch/s390/include/asm/cpu_mf.hmodified+1−1View file
arch/s390/include/asm/percpu.hmodified+16−18View file
arch/s390/kernel/perf_cpum_sf.cmodified+3−13View file
arch/sh/include/asm/atomic-grb.hmodified+9−0View file
arch/sh/include/asm/atomic-irq.hmodified+9−0View file
arch/sh/include/asm/atomic-llsc.hmodified+9−0View file
arch/sh/include/asm/atomic.hmodified+0−3View file
arch/sparc/include/asm/atomic_32.hmodified+16−2View file
arch/sparc/include/asm/atomic_64.hmodified+18−11View file
arch/x86/include/asm/atomic.hmodified+0−87View file
arch/x86/include/asm/atomic64_32.hmodified+0−76View file
arch/x86/include/asm/atomic64_64.hmodified+0−81View file
arch/x86/include/asm/cmpxchg.hmodified+0−25View file
arch/x86/include/asm/cmpxchg_32.hmodified+1−1View file
arch/x86/include/asm/cmpxchg_64.hmodified+66−1View file
arch/x86/include/asm/percpu.hmodified+61−41View file
arch/x86/kernel/alternative.cmodified+2−2View file
arch/x86/kernel/cpu/mce/core.cmodified+8−8View file
arch/x86/kernel/nmi.cmodified+1−1View file
arch/x86/kernel/pvclock.cmodified+2−2View file
arch/x86/kvm/x86.cmodified+1−1View file
arch/x86/lib/Makefilemodified+2−1View file
arch/x86/lib/cmpxchg16b_emu.Smodified+25−18View file
arch/x86/lib/cmpxchg8b_emu.Smodified+53−14View file
arch/xtensa/include/asm/atomic.hmodified+9−3View file
drivers/iommu/amd/amd_iommu_types.hmodified+7−2View file
drivers/iommu/amd/iommu.cmodified+4−6View file
drivers/iommu/intel/irq_remapping.cmodified+2−6View file
drivers/md/bcache/btree.cmodified+22−1View file
drivers/md/bcache/btree.hmodified+2−2View file
include/asm-generic/atomic.hmodified+0−3View file
include/asm-generic/bitops/atomic.hmodified+6−6View file
include/asm-generic/bitops/lock.hmodified+4−4View file
include/asm-generic/percpu.hmodified+152−49View file
include/crypto/b128ops.hmodified+3−11View file
include/linux/atomic/atomic-arch-fallback.hmodified+3576−1587View file
include/linux/atomic/atomic-instrumented.hmodified+3194−361View file
include/linux/atomic/atomic-long.hmodified+1435−687View file
include/linux/context_tracking.hmodified+2−2View file
include/linux/context_tracking_state.hmodified+1−1View file
include/linux/cpumask.hmodified+1−1View file
include/linux/dmar.hmodified+66−59View file
include/linux/jump_label.hmodified+1−1View file
include/linux/lockdep.hmodified+8−0View file
include/linux/lockdep_types.hmodified+8−0View file
include/linux/percpu-defs.hmodified+13−32View file
include/linux/slub_def.hmodified+9−3View file
include/linux/types.hmodified+5−0View file
include/uapi/linux/types.hmodified+4−0View file
kernel/context_tracking.cmodified+6−6View file
kernel/locking/lockdep.cmodified+87−31View file
kernel/sched/clock.cmodified+1−1View file
lib/crypto/curve25519-hacl64.cmodified+0−2View file
lib/crypto/poly1305-donna64.cmodified+0−2View file
mm/slab.hmodified+46−7View file
mm/slub.cmodified+82−57View file
scripts/atomic/atomic-tbl.shmodified+108−4View file
scripts/atomic/atomics.tblmodified+1−1View file
scripts/atomic/fallbacks/acquiremodified+0−4View file
scripts/atomic/fallbacks/add_negativemodified+1−13View file
scripts/atomic/fallbacks/add_unlessmodified+1−14View file
scripts/atomic/fallbacks/andnotmodified+1−5View file
scripts/atomic/fallbacks/cmpxchgadded+3−0View file
scripts/atomic/fallbacks/decmodified+1−5View file
scripts/atomic/fallbacks/dec_and_testmodified+1−13View file
scripts/atomic/fallbacks/dec_if_positivemodified+2−6View file
scripts/atomic/fallbacks/dec_unless_positivemodified+2−6View file
scripts/atomic/fallbacks/fencemodified+0−4View file
scripts/atomic/fallbacks/fetch_add_unlessmodified+2−15View file
scripts/atomic/fallbacks/incmodified+1−5View file
scripts/atomic/fallbacks/inc_and_testmodified+1−13View file
scripts/atomic/fallbacks/inc_not_zeromodified+1−12View file
scripts/atomic/fallbacks/inc_unless_negativemodified+2−6View file
scripts/atomic/fallbacks/read_acquiremodified+1−5View file
scripts/atomic/fallbacks/releasemodified+0−4View file
scripts/atomic/fallbacks/set_releasemodified+1−5View file
scripts/atomic/fallbacks/sub_and_testmodified+1−14View file
scripts/atomic/fallbacks/try_cmpxchgmodified+1−5View file
scripts/atomic/fallbacks/xchgadded+3−0View file
scripts/atomic/gen-atomic-fallback.shmodified+175−91View file
scripts/atomic/gen-atomic-instrumented.shmodified+16−26View file
scripts/atomic/gen-atomic-long.shmodified+18−20View file
scripts/atomic/kerneldoc/addadded+13−0View file
scripts/atomic/kerneldoc/add_negativeadded+13−0View file
scripts/atomic/kerneldoc/add_unlessadded+18−0View file
scripts/atomic/kerneldoc/andadded+13−0View file
scripts/atomic/kerneldoc/andnotadded+13−0View file
scripts/atomic/kerneldoc/cmpxchgadded+14−0View file
scripts/atomic/kerneldoc/decadded+12−0View file
scripts/atomic/kerneldoc/dec_and_testadded+12−0View file
scripts/atomic/kerneldoc/dec_if_positiveadded+12−0View file
scripts/atomic/kerneldoc/dec_unless_positiveadded+12−0View file
scripts/atomic/kerneldoc/incadded+12−0View file
scripts/atomic/kerneldoc/inc_and_testadded+12−0View file
scripts/atomic/kerneldoc/inc_not_zeroadded+12−0View file
scripts/atomic/kerneldoc/inc_unless_negativeadded+12−0View file
scripts/atomic/kerneldoc/oradded+13−0View file
scripts/atomic/kerneldoc/readadded+12−0View file
scripts/atomic/kerneldoc/setadded+13−0View file
scripts/atomic/kerneldoc/subadded+13−0View file
scripts/atomic/kerneldoc/sub_and_testadded+13−0View file
scripts/atomic/kerneldoc/try_cmpxchgadded+15−0View file
scripts/atomic/kerneldoc/xchgadded+13−0View file
scripts/atomic/kerneldoc/xoradded+13−0View file
scripts/kernel-docmodified+1−1View file
scripts/min-tool-version.shmodified+5−1View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/core-api/this_cpu_ops.rst

View file
diff --git a/Documentation/core-api/this_cpu_ops.rst b/Documentation/core-api/this_cpu_ops.rst
index 5cb8b88..91acbcf 100644
--- a/Documentation/core-api/this_cpu_ops.rst
+++ b/Documentation/core-api/this_cpu_ops.rst
@@ -53,7 +53,6 @@ preemption and interrupts::
this_cpu_add_return(pcp, val)
this_cpu_xchg(pcp, nval)
this_cpu_cmpxchg(pcp, oval, nval)
- this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
this_cpu_sub(pcp, val)
this_cpu_inc(pcp)
this_cpu_dec(pcp)
@@ -242,7 +241,6 @@ safe::
__this_cpu_add_return(pcp, val)
__this_cpu_xchg(pcp, nval)
__this_cpu_cmpxchg(pcp, oval, nval)
- __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
__this_cpu_sub(pcp, val)
__this_cpu_inc(pcp)
__this_cpu_dec(pcp)

Documentation/driver-api/basics.rst

View file
diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst
index 4b4d8e2..7671b53 100644
--- a/Documentation/driver-api/basics.rst
+++ b/Documentation/driver-api/basics.rst
@@ -84,7 +84,13 @@ Reference counting
Atomics
-------
-.. kernel-doc:: arch/x86/include/asm/atomic.h
+.. kernel-doc:: include/linux/atomic/atomic-instrumented.h
+ :internal:
+
+.. kernel-doc:: include/linux/atomic/atomic-arch-fallback.h
+ :internal:
+
+.. kernel-doc:: include/linux/atomic/atomic-long.h
:internal:
Kernel objects manipulation

arch/alpha/include/asm/atomic.h

View file
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index f2861a4..cbd9244 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -200,25 +200,6 @@ ATOMIC_OPS(xor, xor)
#undef ATOMIC_OP_RETURN
#undef ATOMIC_OP
-#define arch_atomic64_cmpxchg(v, old, new) \
- (arch_cmpxchg(&((v)->counter), old, new))
-#define arch_atomic64_xchg(v, new) \
- (arch_xchg(&((v)->counter), new))
-
-#define arch_atomic_cmpxchg(v, old, new) \
- (arch_cmpxchg(&((v)->counter), old, new))
-#define arch_atomic_xchg(v, new) \
- (arch_xchg(&((v)->counter), new))
-
-/**
- * arch_atomic_fetch_add_unless - add unless the number is a given value
- * @v: pointer of type atomic_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as it was not @u.
- * Returns the old value of @v.
- */
static __inline__ int arch_atomic_fetch_add_unless(atomic_t *v, int a, int u)
{
int c, new, old;
@@ -242,15 +223,6 @@ static __inline__ int arch_atomic_fetch_add_unless(atomic_t *v, int a, int u)
}
#define arch_atomic_fetch_add_unless arch_atomic_fetch_add_unless
-/**
- * arch_atomic64_fetch_add_unless - add unless the number is a given value
- * @v: pointer of type atomic64_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as it was not @u.
- * Returns the old value of @v.
- */
static __inline__ s64 arch_atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u)
{
s64 c, new, old;
@@ -274,13 +246,6 @@ static __inline__ s64 arch_atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u
}
#define arch_atomic64_fetch_add_unless arch_atomic64_fetch_add_unless
-/*
- * arch_atomic64_dec_if_positive - decrement by 1 if old value positive
- * @v: pointer of type atomic_t
- *
- * The function returns the old value of *v minus 1, even if
- * the atomic variable, v, was not decremented.
- */
static inline s64 arch_atomic64_dec_if_positive(atomic64_t *v)
{
s64 old, tmp;

arch/arc/include/asm/atomic-spinlock.h

View file
diff --git a/arch/arc/include/asm/atomic-spinlock.h b/arch/arc/include/asm/atomic-spinlock.h
index 2c83034..89d12a6 100644
--- a/arch/arc/include/asm/atomic-spinlock.h
+++ b/arch/arc/include/asm/atomic-spinlock.h
@@ -81,6 +81,11 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t *v) \
ATOMIC_OPS(add, +=, add)
ATOMIC_OPS(sub, -=, sub)
+#define arch_atomic_fetch_add arch_atomic_fetch_add
+#define arch_atomic_fetch_sub arch_atomic_fetch_sub
+#define arch_atomic_add_return arch_atomic_add_return
+#define arch_atomic_sub_return arch_atomic_sub_return
+
#undef ATOMIC_OPS
#define ATOMIC_OPS(op, c_op, asm_op) \
ATOMIC_OP(op, c_op, asm_op) \
@@ -92,7 +97,11 @@ ATOMIC_OPS(or, |=, or)
ATOMIC_OPS(xor, ^=, xor)
#define arch_atomic_andnot arch_atomic_andnot
+
+#define arch_atomic_fetch_and arch_atomic_fetch_and
#define arch_atomic_fetch_andnot arch_atomic_fetch_andnot
+#define arch_atomic_fetch_or arch_atomic_fetch_or
+#define arch_atomic_fetch_xor arch_atomic_fetch_xor
#undef ATOMIC_OPS
#undef ATOMIC_FETCH_OP

arch/arc/include/asm/atomic.h

View file
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
index 52ee51e..592d7ff 100644
--- a/arch/arc/include/asm/atomic.h
+++ b/arch/arc/include/asm/atomic.h
@@ -22,30 +22,6 @@
#include <asm/atomic-spinlock.h>
#endif
-#define arch_atomic_cmpxchg(v, o, n) \
-({ \
- arch_cmpxchg(&((v)->counter), (o), (n)); \
-})
-
-#ifdef arch_cmpxchg_relaxed
-#define arch_atomic_cmpxchg_relaxed(v, o, n) \
-({ \
- arch_cmpxchg_relaxed(&((v)->counter), (o), (n)); \
-})
-#endif
-
-#define arch_atomic_xchg(v, n) \
-({ \
- arch_xchg(&((v)->counter), (n)); \
-})
-
-#ifdef arch_xchg_relaxed
-#define arch_atomic_xchg_relaxed(v, n) \
-({ \
- arch_xchg_relaxed(&((v)->counter), (n)); \
-})
-#endif
-
/*
* 64-bit atomics
*/

arch/arc/include/asm/atomic64-arcv2.h

View file
diff --git a/arch/arc/include/asm/atomic64-arcv2.h b/arch/arc/include/asm/atomic64-arcv2.h
index c5a8010..6b6db98 100644
--- a/arch/arc/include/asm/atomic64-arcv2.h
+++ b/arch/arc/include/asm/atomic64-arcv2.h
@@ -159,6 +159,7 @@ arch_atomic64_cmpxchg(atomic64_t *ptr, s64 expected, s64 new)
return prev;
}
+#define arch_atomic64_cmpxchg arch_atomic64_cmpxchg
static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)
{
@@ -179,14 +180,7 @@ static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)
return prev;
}
-
-/**
- * arch_atomic64_dec_if_positive - decrement by 1 if old value positive
- * @v: pointer of type atomic64_t
- *
- * The function returns the old value of *v minus 1, even if
- * the atomic variable, v, was not decremented.
- */
+#define arch_atomic64_xchg arch_atomic64_xchg
static inline s64 arch_atomic64_dec_if_positive(atomic64_t *v)
{
@@ -212,15 +206,6 @@ static inline s64 arch_atomic64_dec_if_positive(atomic64_t *v)
}
#define arch_atomic64_dec_if_positive arch_atomic64_dec_if_positive
-/**
- * arch_atomic64_fetch_add_unless - add unless the number is a given value
- * @v: pointer of type atomic64_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, if it was not @u.
- * Returns the old value of @v
- */
static inline s64 arch_atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u)
{
s64 old, temp;

arch/arm/include/asm/assembler.h

View file
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 505a306..aebe2c8 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -394,6 +394,23 @@ ALT_UP_B(.L0_\@)
#endif
.endm
+/*
+ * Raw SMP data memory barrier
+ */
+ .macro __smp_dmb mode
+#if __LINUX_ARM_ARCH__ >= 7
+ .ifeqs "\mode","arm"
+ dmb ish
+ .else
+ W(dmb) ish
+ .endif
+#elif __LINUX_ARM_ARCH__ == 6
+ mcr p15, 0, r0, c7, c10, 5 @ dmb
+#else
+ .error "Incompatible SMP platform"
+#endif
+ .endm
+
#if defined(CONFIG_CPU_V7M)
/*
* setmode is used to assert to be in svc mode during boot. For v7-M

arch/arm/include/asm/atomic.h

View file
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index db8512d..f0e3b01 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -197,6 +197,16 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t *v) \
return val; \
}
+#define arch_atomic_add_return arch_atomic_add_return
+#define arch_atomic_sub_return arch_atomic_sub_return
+#define arch_atomic_fetch_add arch_atomic_fetch_add
+#define arch_atomic_fetch_sub arch_atomic_fetch_sub
+
+#define arch_atomic_fetch_and arch_atomic_fetch_and
+#define arch_atomic_fetch_andnot arch_atomic_fetch_andnot
+#define arch_atomic_fetch_or arch_atomic_fetch_or
+#define arch_atomic_fetch_xor arch_atomic_fetch_xor
+
static inline int arch_atomic_cmpxchg(atomic_t *v, int old, int new)
{
int ret;
@@ -210,8 +220,7 @@ static inline int arch_atomic_cmpxchg(atomic_t *v, int old, int new)
return ret;
}
-
-#define arch_atomic_fetch_andnot arch_atomic_fetch_andnot
+#define arch_atomic_cmpxchg arch_atomic_cmpxchg
#endif /* __LINUX_ARM_ARCH__ */
@@ -240,8 +249,6 @@ ATOMIC_OPS(xor, ^=, eor)
#undef ATOMIC_OP_RETURN
#undef ATOMIC_OP
-#define arch_atomic_xchg(v, new) (arch_xchg(&((v)->counter), new))
-
#ifndef CONFIG_GENERIC_ATOMIC64
typedef struct {
s64 counter;

arch/arm/include/asm/sync_bitops.h

View file
diff --git a/arch/arm/include/asm/sync_bitops.h b/arch/arm/include/asm/sync_bitops.h
index 6f5d627..f46b3c5 100644
--- a/arch/arm/include/asm/sync_bitops.h
+++ b/arch/arm/include/asm/sync_bitops.h
@@ -14,14 +14,35 @@
* ops which are SMP safe even on a UP kernel.
*/
+/*
+ * Unordered
+ */
+
#define sync_set_bit(nr, p) _set_bit(nr, p)
#define sync_clear_bit(nr, p) _clear_bit(nr, p)
#define sync_change_bit(nr, p) _change_bit(nr, p)
-#define sync_test_and_set_bit(nr, p) _test_and_set_bit(nr, p)
-#define sync_test_and_clear_bit(nr, p) _test_and_clear_bit(nr, p)
-#define sync_test_and_change_bit(nr, p) _test_and_change_bit(nr, p)
#define sync_test_bit(nr, addr) test_bit(nr, addr)
-#define arch_sync_cmpxchg arch_cmpxchg
+/*
+ * Fully ordered
+ */
+
+int _sync_test_and_set_bit(int nr, volatile unsigned long * p);
+#define sync_test_and_set_bit(nr, p) _sync_test_and_set_bit(nr, p)
+
+int _sync_test_and_clear_bit(int nr, volatile unsigned long * p);
+#define sync_test_and_clear_bit(nr, p) _sync_test_and_clear_bit(nr, p)
+
+int _sync_test_and_change_bit(int nr, volatile unsigned long * p);
+#define sync_test_and_change_bit(nr, p) _sync_test_and_change_bit(nr, p)
+
+#define arch_sync_cmpxchg(ptr, old, new) \
+({ \
+ __typeof__(*(ptr)) __ret; \
+ __smp_mb__before_atomic(); \
+ __ret = arch_cmpxchg_relaxed((ptr), (old), (new)); \
+ __smp_mb__after_atomic(); \
+ __ret; \
+})
#endif

arch/arm/lib/bitops.h

View file
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index 95bd359..f069d1b 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -28,7 +28,7 @@ UNWIND( .fnend )
ENDPROC(\name )
.endm
- .macro testop, name, instr, store
+ .macro __testop, name, instr, store, barrier
ENTRY( \name )
UNWIND( .fnstart )
ands ip, r1, #3
@@ -38,7 +38,7 @@ UNWIND( .fnstart )
mov r0, r0, lsr #5
add r1, r1, r0, lsl #2 @ Get word offset
mov r3, r2, lsl r3 @ create mask
- smp_dmb
+ \barrier
#if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
.arch_extension mp
ALT_SMP(W(pldw) [r1])
@@ -50,13 +50,21 @@ UNWIND( .fnstart )
strex ip, r2, [r1]
cmp ip, #0
bne 1b
- smp_dmb
+ \barrier
cmp r0, #0
movne r0, #1
2: bx lr
UNWIND( .fnend )
ENDPROC(\name )
.endm
+
+ .macro testop, name, instr, store
+ __testop \name, \instr, \store, smp_dmb
+ .endm
+
+ .macro sync_testop, name, instr, store
+ __testop \name, \instr, \store, __smp_dmb
+ .endm
#else
.macro bitop, name, instr
ENTRY( \name )

arch/arm/lib/testchangebit.S

View file
diff --git a/arch/arm/lib/testchangebit.S b/arch/arm/lib/testchangebit.S
index 4ebecc6..f13fe9b 100644
--- a/arch/arm/lib/testchangebit.S
+++ b/arch/arm/lib/testchangebit.S
@@ -10,3 +10,7 @@
.text
testop _test_and_change_bit, eor, str
+
+#if __LINUX_ARM_ARCH__ >= 6
+sync_testop _sync_test_and_change_bit, eor, str
+#endif

arch/arm/lib/testclearbit.S

View file
diff --git a/arch/arm/lib/testclearbit.S b/arch/arm/lib/testclearbit.S
index 009afa0..4d2c5ca 100644
--- a/arch/arm/lib/testclearbit.S
+++ b/arch/arm/lib/testclearbit.S
@@ -10,3 +10,7 @@
.text
testop _test_and_clear_bit, bicne, strne
+
+#if __LINUX_ARM_ARCH__ >= 6
+sync_testop _sync_test_and_clear_bit, bicne, strne
+#endif

arch/arm/lib/testsetbit.S

View file
diff --git a/arch/arm/lib/testsetbit.S b/arch/arm/lib/testsetbit.S
index f3192e5..649dbab 100644
--- a/arch/arm/lib/testsetbit.S
+++ b/arch/arm/lib/testsetbit.S
@@ -10,3 +10,7 @@
.text
testop _test_and_set_bit, orreq, streq
+
+#if __LINUX_ARM_ARCH__ >= 6
+sync_testop _sync_test_and_set_bit, orreq, streq
+#endif

arch/arm64/include/asm/atomic.h

View file
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h
index c997927..400d279 100644
--- a/arch/arm64/include/asm/atomic.h
+++ b/arch/arm64/include/asm/atomic.h
@@ -142,24 +142,6 @@ static __always_inline long arch_atomic64_dec_if_positive(atomic64_t *v)
#define arch_atomic_fetch_xor_release arch_atomic_fetch_xor_release
#define arch_atomic_fetch_xor arch_atomic_fetch_xor
-#define arch_atomic_xchg_relaxed(v, new) \
- arch_xchg_relaxed(&((v)->counter), (new))
-#define arch_atomic_xchg_acquire(v, new) \
- arch_xchg_acquire(&((v)->counter), (new))
-#define arch_atomic_xchg_release(v, new) \
- arch_xchg_release(&((v)->counter), (new))
-#define arch_atomic_xchg(v, new) \
- arch_xchg(&((v)->counter), (new))
-
-#define arch_atomic_cmpxchg_relaxed(v, old, new) \
- arch_cmpxchg_relaxed(&((v)->counter), (old), (new))
-#define arch_atomic_cmpxchg_acquire(v, old, new) \
- arch_cmpxchg_acquire(&((v)->counter), (old), (new))
-#define arch_atomic_cmpxchg_release(v, old, new) \
- arch_cmpxchg_release(&((v)->counter), (old), (new))
-#define arch_atomic_cmpxchg(v, old, new) \
- arch_cmpxchg(&((v)->counter), (old), (new))
-
#define arch_atomic_andnot arch_atomic_andnot
/*
@@ -209,16 +191,6 @@ static __always_inline long arch_atomic64_dec_if_positive(atomic64_t *v)
#define arch_atomic64_fetch_xor_release arch_atomic64_fetch_xor_release
#define arch_atomic64_fetch_xor arch_atomic64_fetch_xor
-#define arch_atomic64_xchg_relaxed arch_atomic_xchg_relaxed
-#define arch_atomic64_xchg_acquire arch_atomic_xchg_acquire
-#define arch_atomic64_xchg_release arch_atomic_xchg_release
-#define arch_atomic64_xchg arch_atomic_xchg
-
-#define arch_atomic64_cmpxchg_relaxed arch_atomic_cmpxchg_relaxed
-#define arch_atomic64_cmpxchg_acquire arch_atomic_cmpxchg_acquire
-#define arch_atomic64_cmpxchg_release arch_atomic_cmpxchg_release
-#define arch_atomic64_cmpxchg arch_atomic_cmpxchg
-
#define arch_atomic64_andnot arch_atomic64_andnot
#define arch_atomic64_dec_if_positive arch_atomic64_dec_if_positive

arch/arm64/include/asm/atomic_ll_sc.h

View file
diff --git a/arch/arm64/include/asm/atomic_ll_sc.h b/arch/arm64/include/asm/atomic_ll_sc.h
index cbb3d96..89d2ba2 100644
--- a/arch/arm64/include/asm/atomic_ll_sc.h
+++ b/arch/arm64/include/asm/atomic_ll_sc.h
@@ -294,38 +294,46 @@ __CMPXCHG_CASE( , , mb_, 64, dmb ish, , l, "memory", L)
#undef __CMPXCHG_CASE
-#define __CMPXCHG_DBL(name, mb, rel, cl) \
-static __always_inline long \
-__ll_sc__cmpxchg_double##name(unsigned long old1, \
- unsigned long old2, \
- unsigned long new1, \
- unsigned long new2, \
- volatile void *ptr) \
+union __u128_halves {
+ u128 full;
+ struct {
+ u64 low, high;
+ };
+};
+
+#define __CMPXCHG128(name, mb, rel, cl...) \
+static __always_inline u128 \
+__ll_sc__cmpxchg128##name(volatile u128 *ptr, u128 old, u128 new) \
{ \
- unsigned long tmp, ret; \
+ union __u128_halves r, o = { .full = (old) }, \
+ n = { .full = (new) }; \
+ unsigned int tmp; \
\
- asm volatile("// __cmpxchg_double" #name "\n" \
- " prfm pstl1strm, %2\n" \
- "1: ldxp %0, %1, %2\n" \
- " eor %0, %0, %3\n" \
- " eor %1, %1, %4\n" \
- " orr %1, %0, %1\n" \
- " cbnz %1, 2f\n" \
- " st" #rel "xp %w0, %5, %6, %2\n" \
- " cbnz %w0, 1b\n" \
+ asm volatile("// __cmpxchg128" #name "\n" \
+ " prfm pstl1strm, %[v]\n" \
+ "1: ldxp %[rl], %[rh], %[v]\n" \
+ " cmp %[rl], %[ol]\n" \
+ " ccmp %[rh], %[oh], 0, eq\n" \
+ " b.ne 2f\n" \
+ " st" #rel "xp %w[tmp], %[nl], %[nh], %[v]\n" \
+ " cbnz %w[tmp], 1b\n" \
" " #mb "\n" \
"2:" \
- : "=&r" (tmp), "=&r" (ret), "+Q" (*(__uint128_t *)ptr) \
- : "r" (old1), "r" (old2), "r" (new1), "r" (new2) \
- : cl); \
+ : [v] "+Q" (*(u128 *)ptr), \
+ [rl] "=&r" (r.low), [rh] "=&r" (r.high), \
+ [tmp] "=&r" (tmp) \
+ : [ol] "r" (o.low), [oh] "r" (o.high), \
+ [nl] "r" (n.low), [nh] "r" (n.high) \
+ : "cc", ##cl); \
\
- return ret; \
+ return r.full; \
}
-__CMPXCHG_DBL( , , , )
-__CMPXCHG_DBL(_mb, dmb ish, l, "memory")
+__CMPXCHG128( , , )
+__CMPXCHG128(_mb, dmb ish, l, "memory")
+
+#undef __CMPXCHG128
-#undef __CMPXCHG_DBL
#undef K
#endif /* __ASM_ATOMIC_LL_SC_H */

arch/arm64/include/asm/atomic_lse.h

View file
diff --git a/arch/arm64/include/asm/atomic_lse.h b/arch/arm64/include/asm/atomic_lse.h
index 319958b..87f568a 100644
--- a/arch/arm64/include/asm/atomic_lse.h
+++ b/arch/arm64/include/asm/atomic_lse.h
@@ -281,40 +281,35 @@ __CMPXCHG_CASE(x, , mb_, 64, al, "memory")
#undef __CMPXCHG_CASE
-#define __CMPXCHG_DBL(name, mb, cl...) \
-static __always_inline long \
-__lse__cmpxchg_double##name(unsigned long old1, \
- unsigned long old2, \
- unsigned long new1, \
- unsigned long new2, \
- volatile void *ptr) \
+#define __CMPXCHG128(name, mb, cl...) \
+static __always_inline u128 \
+__lse__cmpxchg128##name(volatile u128 *ptr, u128 old, u128 new) \
{ \
- unsigned long oldval1 = old1; \
- unsigned long oldval2 = old2; \
- register unsigned long x0 asm ("x0") = old1; \
- register unsigned long x1 asm ("x1") = old2; \
- register unsigned long x2 asm ("x2") = new1; \
- register unsigned long x3 asm ("x3") = new2; \
+ union __u128_halves r, o = { .full = (old) }, \
+ n = { .full = (new) }; \
+ register unsigned long x0 asm ("x0") = o.low; \
+ register unsigned long x1 asm ("x1") = o.high; \
+ register unsigned long x2 asm ("x2") = n.low; \
+ register unsigned long x3 asm ("x3") = n.high; \
register unsigned long x4 asm ("x4") = (unsigned long)ptr; \
\
asm volatile( \
__LSE_PREAMBLE \
" casp" #mb "\t%[old1], %[old2], %[new1], %[new2], %[v]\n"\
- " eor %[old1], %[old1], %[oldval1]\n" \
- " eor %[old2], %[old2], %[oldval2]\n" \
- " orr %[old1], %[old1], %[old2]" \
: [old1] "+&r" (x0), [old2] "+&r" (x1), \
- [v] "+Q" (*(__uint128_t *)ptr) \
+ [v] "+Q" (*(u128 *)ptr) \
: [new1] "r" (x2), [new2] "r" (x3), [ptr] "r" (x4), \
- [oldval1] "r" (oldval1), [oldval2] "r" (oldval2) \
+ [oldval1] "r" (o.low), [oldval2] "r" (o.high) \
: cl); \
\
- return x0; \
+ r.low = x0; r.high = x1; \
+ \
+ return r.full; \
}
-__CMPXCHG_DBL( , )
-__CMPXCHG_DBL(_mb, al, "memory")
+__CMPXCHG128( , )
+__CMPXCHG128(_mb, al, "memory")
-#undef __CMPXCHG_DBL
+#undef __CMPXCHG128
#endif /* __ASM_ATOMIC_LSE_H */

arch/arm64/include/asm/cmpxchg.h

View file
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index c6bc5d8..d7a5407 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -130,21 +130,18 @@ __CMPXCHG_CASE(mb_, 64)
#undef __CMPXCHG_CASE
-#define __CMPXCHG_DBL(name) \
-static inline long __cmpxchg_double##name(unsigned long old1, \
- unsigned long old2, \
- unsigned long new1, \
- unsigned long new2, \
- volatile void *ptr) \
+#define __CMPXCHG128(name) \
+static inline u128 __cmpxchg128##name(volatile u128 *ptr, \
+ u128 old, u128 new) \
{ \

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/percpu.h

View file

This diff is incomplete. Download the complete patch.

arch/csky/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/hexagon/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/ia64/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/loongarch/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/m68k/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/mips/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/openrisc/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/parisc/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/kernel/smp.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/s390/include/asm/cmpxchg.h

View file

This diff is incomplete. Download the complete patch.

arch/s390/include/asm/cpu_mf.h

View file

This diff is incomplete. Download the complete patch.

arch/s390/include/asm/percpu.h

View file

This diff is incomplete. Download the complete patch.

arch/s390/kernel/perf_cpum_sf.c

View file

This diff is incomplete. Download the complete patch.

arch/sh/include/asm/atomic-grb.h

View file

This diff is incomplete. Download the complete patch.

arch/sh/include/asm/atomic-irq.h

View file

This diff is incomplete. Download the complete patch.

arch/sh/include/asm/atomic-llsc.h

View file

This diff is incomplete. Download the complete patch.

arch/sh/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/sparc/include/asm/atomic_32.h

View file

This diff is incomplete. Download the complete patch.

arch/sparc/include/asm/atomic_64.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/atomic64_32.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/atomic64_64.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/cmpxchg.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/cmpxchg_32.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/cmpxchg_64.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/percpu.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/alternative.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/cpu/mce/core.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/nmi.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/pvclock.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kvm/x86.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/lib/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/x86/lib/cmpxchg16b_emu.S

View file

This diff is incomplete. Download the complete patch.

arch/x86/lib/cmpxchg8b_emu.S

View file

This diff is incomplete. Download the complete patch.

arch/xtensa/include/asm/atomic.h

View file

This diff is incomplete. Download the complete patch.

drivers/iommu/amd/amd_iommu_types.h

View file

This diff is incomplete. Download the complete patch.

drivers/iommu/amd/iommu.c

View file

This diff is incomplete. Download the complete patch.

drivers/iommu/intel/irq_remapping.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/bcache/btree.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/bcache/btree.h

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/atomic.h

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/bitops/atomic.h

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/bitops/lock.h

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/percpu.h

View file

This diff is incomplete. Download the complete patch.

include/crypto/b128ops.h

View file

This diff is incomplete. Download the complete patch.

include/linux/atomic/atomic-arch-fallback.h

View file

This diff is incomplete. Download the complete patch.

include/linux/atomic/atomic-instrumented.h

View file

This diff is incomplete. Download the complete patch.

include/linux/atomic/atomic-long.h

View file

This diff is incomplete. Download the complete patch.

include/linux/context_tracking.h

View file

This diff is incomplete. Download the complete patch.

include/linux/context_tracking_state.h

View file

This diff is incomplete. Download the complete patch.

include/linux/cpumask.h

View file

This diff is incomplete. Download the complete patch.

include/linux/dmar.h

View file

This diff is incomplete. Download the complete patch.

include/linux/jump_label.h

View file

This diff is incomplete. Download the complete patch.

include/linux/lockdep.h

View file

This diff is incomplete. Download the complete patch.

include/linux/lockdep_types.h

View file

This diff is incomplete. Download the complete patch.

include/linux/percpu-defs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/slub_def.h

View file

This diff is incomplete. Download the complete patch.

include/linux/types.h

View file

This diff is incomplete. Download the complete patch.

include/uapi/linux/types.h

View file

This diff is incomplete. Download the complete patch.

kernel/context_tracking.c

View file

This diff is incomplete. Download the complete patch.

kernel/locking/lockdep.c

View file

This diff is incomplete. Download the complete patch.

kernel/sched/clock.c

View file

This diff is incomplete. Download the complete patch.

lib/crypto/curve25519-hacl64.c

View file

This diff is incomplete. Download the complete patch.

lib/crypto/poly1305-donna64.c

View file

This diff is incomplete. Download the complete patch.

mm/slab.h

View file

This diff is incomplete. Download the complete patch.

mm/slub.c

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/atomic-tbl.sh

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/atomics.tbl

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/acquire

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/add_negative

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/add_unless

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/andnot

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/cmpxchg

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/dec

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/dec_and_test

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/dec_if_positive

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/dec_unless_positive

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/fence

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/fetch_add_unless

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/inc

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/inc_and_test

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/inc_not_zero

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/inc_unless_negative

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/read_acquire

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/release

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/set_release

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/sub_and_test

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/try_cmpxchg

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/fallbacks/xchg

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/gen-atomic-fallback.sh

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/gen-atomic-instrumented.sh

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/gen-atomic-long.sh

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/add

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/add_negative

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/add_unless

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/and

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/andnot

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/cmpxchg

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/dec

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/dec_and_test

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/dec_if_positive

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/dec_unless_positive

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/inc

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/inc_and_test

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/inc_not_zero

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/inc_unless_negative

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/or

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/read

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/set

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/sub

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/sub_and_test

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/try_cmpxchg

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/xchg

View file

This diff is incomplete. Download the complete patch.

scripts/atomic/kerneldoc/xor

View file

This diff is incomplete. Download the complete patch.

scripts/kernel-doc

View file

This diff is incomplete. Download the complete patch.

scripts/min-tool-version.sh

View file

This diff is incomplete. Download the complete patch.