From: Vineet Gupta <vgupta@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>, linux-kernel@vger.kernel.org
Cc: Bradley Morgan <brads@mainlining.org>,
Vineet Gupta <vgupta@kernel.org>, Guo Ren <guoren@kernel.org>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Chris Zankel <chris@zankel.net>,
Max Filippov <jcmvbkbc@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@kernel.org>,
David Laight <david.laight.linux@gmail.com>,
linux-snps-arc@lists.infradead.org, linux-csky@vger.kernel.org,
linux-sh@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH 3/5] ARC: Emulate two-byte cmpxchg
Date: Wed, 7 Oct 2026 22:48:39 +0200 [thread overview]
Message-ID: <40f3c095-4202-4d2b-93e3-376a231d4fe8@kernel.org> (raw)
In-Reply-To: <20261007203636.1982188-3-paulmck@kernel.org>
On 10/7/26 22:36, Paul E. McKenney wrote:
> From: Bradley Morgan <brads@mainlining.org>
>
> ARC has no two-byte atomic compare and swap, so the
> arch_cmpxchg_relaxed() macro switch lets case 2 fall through to
> BUILD_BUG() via default, and a two-byte cmpxchg() fails the build.
>
> Route case 2 through the new cmpxchg_emu_u16(), which narrows the
> old and new values itself, so the dispatch keeps the (uintptr_t)
> casts the case 1 path already uses.
>
> The sizeof(*(_p_)) fix that v4 folded in here landed separately
> through Vineet's f050c3e61d2a, so this patch is now only the
> case 2 wiring.
>
> Signed-off-by: Bradley Morgan <brads@mainlining.org>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Vineet Gupta <vgupta@kernel.org>
Thx,
-Vineet
> ---
> arch/arc/include/asm/cmpxchg.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
> index 76f43db0890fc..7157718f147c1 100644
> --- a/arch/arc/include/asm/cmpxchg.h
> +++ b/arch/arc/include/asm/cmpxchg.h
> @@ -50,6 +50,9 @@
> case 1: \
> _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_); \
> break; \
> + case 2: \
> + _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *__force)_p_, (unsigned long)_o_, (unsigned long)_n_); \
> + break; \
> case 4: \
> _prev_ = __cmpxchg(_p_, _o_, _n_); \
> break; \
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
next prev parent reply other threads:[~2026-10-07 20:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 20:36 [PATCH 0/5] Provide two-byte cmpxchg() emulation Paul E. McKenney
2026-10-07 20:36 ` [PATCH 1/5] lib: Add two-byte cmpxchg emulation function Paul E. McKenney
2026-10-07 20:36 ` [PATCH 2/5] sh: Emulate two-byte cmpxchg Paul E. McKenney
2026-10-07 20:36 ` [PATCH 3/5] ARC: " Paul E. McKenney
2026-10-07 20:48 ` Vineet Gupta [this message]
2026-10-07 20:58 ` Paul E. McKenney
2026-10-07 20:36 ` [PATCH 4/5] csky: " Paul E. McKenney
2026-10-08 5:54 ` Guo Ren
2026-10-08 15:38 ` Paul E. McKenney
2026-10-07 20:36 ` [PATCH 5/5] xtensa: " Paul E. McKenney
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=40f3c095-4202-4d2b-93e3-376a231d4fe8@kernel.org \
--to=vgupta@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@kernel.org \
--cc=brads@mainlining.org \
--cc=chris@zankel.net \
--cc=dalias@libc.org \
--cc=david.laight.linux@gmail.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=guoren@kernel.org \
--cc=jcmvbkbc@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=paulmck@kernel.org \
--cc=ysato@users.sourceforge.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox