From: Alexander A Sverdlin <alexander.sverdlin@nokia.com>
To: Paul Burton <paul.burton@imgtec.com>, linux-mips@vger.kernel.org
Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Boqun Feng <boqun.feng@gmail.com>, Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] MIPS: Provide {atomic_}xchg_relaxed()
Date: Wed, 27 Jan 2021 21:36:26 +0100 [thread overview]
Message-ID: <20210127203627.47510-6-alexander.sverdlin@nokia.com> (raw)
In-Reply-To: <20210127203627.47510-1-alexander.sverdlin@nokia.com>
From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
This has the effect of removing one redundant SYNCW from
queued_spin_lock_slowpath() on Octeon.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
arch/mips/include/asm/atomic.h | 2 ++
arch/mips/include/asm/cmpxchg.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index a4e5116..3b0f54b 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -266,5 +266,7 @@ ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
#define atomic_cmpxchg_relaxed(v, o, n) \
(cmpxchg_relaxed(&((v)->counter), (o), (n)))
+#define atomic_xchg_relaxed(v, new) \
+ (xchg_relaxed(&((v)->counter), (new)))
#endif /* _ASM_ATOMIC_H */
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
index 620f01a..7830d81 100644
--- a/arch/mips/include/asm/cmpxchg.h
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -110,6 +110,10 @@ unsigned long __xchg(volatile void *ptr, unsigned long x, int size)
__res; \
})
+#define xchg_relaxed(ptr, x) \
+ ((__typeof__(*(ptr))) \
+ __xchg((ptr), (unsigned long)(x), sizeof(*(ptr))))
+
#define __cmpxchg_asm(ld, st, m, old, new) \
({ \
__typeof(*(m)) __ret; \
--
2.10.2
next prev parent reply other threads:[~2021-01-27 20:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-27 20:36 [PATCH 0/6] MIPS: qspinlock: Try to reduce reduce the spinlock regression Alexander A Sverdlin
2021-01-27 20:36 ` [PATCH 1/6] MIPS: Octeon: Implement __smp_store_release() Alexander A Sverdlin
2021-01-27 22:32 ` Peter Zijlstra
2021-01-28 7:27 ` Alexander Sverdlin
2021-01-28 11:33 ` Peter Zijlstra
2021-01-28 11:52 ` Alexander Sverdlin
2021-01-28 14:57 ` Peter Zijlstra
2021-01-28 15:15 ` Peter Zijlstra
2021-01-28 12:09 ` Alexander Sverdlin
2021-01-28 15:04 ` Peter Zijlstra
2021-01-27 20:36 ` [PATCH 2/6] MIPS: Implement atomic_cmpxchg_relaxed() Alexander A Sverdlin
2021-01-27 20:36 ` [PATCH 3/6] MIPS: Octeon: qspinlock: Flush write buffer Alexander A Sverdlin
2021-01-27 22:34 ` Peter Zijlstra
2021-01-28 7:29 ` Alexander Sverdlin
2021-01-28 11:35 ` Peter Zijlstra
2021-01-28 12:13 ` Alexander Sverdlin
2021-01-28 15:26 ` Peter Zijlstra
2021-01-27 20:36 ` [PATCH 4/6] MIPS: Octeon: qspinlock: Exclude mmiowb() Alexander A Sverdlin
2021-01-27 22:35 ` Peter Zijlstra
2021-01-27 20:36 ` Alexander A Sverdlin [this message]
2021-01-27 20:36 ` [PATCH 6/6] MIPS: cmpxchg: Use cmpxchg_local() for {cmp_}xchg_small() Alexander A Sverdlin
2021-01-27 22:37 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210127203627.47510-6-alexander.sverdlin@nokia.com \
--to=alexander.sverdlin@nokia.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul.burton@imgtec.com \
--cc=peterz@infradead.org \
--cc=tsbogend@alpha.franken.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.