From: "Arnd Bergmann" <arnd@arndb.de>
To: "Leonardo Bras" <leobras@redhat.com>,
"Will Deacon" <will@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Andrea Parri" <parri.andrea@gmail.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Palmer Dabbelt" <palmer@rivosinc.com>,
guoren <guoren@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [RFC PATCH v5 5/5] riscv/cmpxchg: Implement xchg for variables of size 1 and 2
Date: Thu, 10 Aug 2023 08:51:34 +0200 [thread overview]
Message-ID: <b0cc2cd8-e246-40d1-b091-f40a74b31f61@app.fastmail.com> (raw)
In-Reply-To: <20230810040349.92279-7-leobras@redhat.com>
On Thu, Aug 10, 2023, at 06:03, Leonardo Bras wrote:
> xchg for variables of size 1-byte and 2-bytes is not yet available for
> riscv, even though its present in other architectures such as arm64 and
> x86. This could lead to not being able to implement some locking mechanisms
> or requiring some rework to make it work properly.
>
> Implement 1-byte and 2-bytes xchg in order to achieve parity with other
> architectures.
>
> Signed-off-by: Leonardo Bras <leobras@redhat.com>
Parity with other architectures by itself is not a reason to do this,
in particular the other architectures you listed have the instructions
in hardware while riscv does not.
Emulating the small xchg() through cmpxchg() is particularly tricky
since it's easy to run into a case where this does not guarantee
forward progress. This is also something that almost no architecture
specific code relies on (generic qspinlock being a notable exception).
I would recommend just dropping this patch from the series, at least
until there is a need for it.
Arnd
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-08-10 6:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 4:03 [RFC PATCH v5 0/5] Rework & improve riscv cmpxchg.h and atomic.h Leonardo Bras
2023-08-10 4:03 ` [RFC PATCH v5 1/5] riscv/cmpxchg: Deduplicate xchg() asm functions Leonardo Bras
2023-08-10 4:03 ` [RFC PATCH v5 2/5] riscv/cmpxchg: Deduplicate cmpxchg() asm and macros Leonardo Bras
2023-08-10 4:03 ` [RFC PATCH v5 3/5] riscv/atomic.h : Deduplicate arch_atomic.* Leonardo Bras
2023-08-10 4:03 ` [RFC PATCH v5 4/5] riscv/cmpxchg: Implement cmpxchg for variables of size 1 and 2 Leonardo Bras
2023-08-10 4:03 ` [RFC PATCH v5 5/5] riscv/cmpxchg: Implement xchg " Leonardo Bras
2023-08-10 6:51 ` Arnd Bergmann [this message]
2023-08-10 16:04 ` Leonardo Brás
2023-08-10 16:23 ` Palmer Dabbelt
2023-08-10 19:13 ` Arnd Bergmann
2023-08-11 1:24 ` Guo Ren
2023-08-30 21:51 ` Leonardo Brás
2023-08-11 1:40 ` Guo Ren
2023-08-11 6:27 ` Conor Dooley
2023-08-11 9:48 ` Conor Dooley
2023-08-11 11:10 ` Andrew Jones
2023-08-11 11:16 ` Guo Ren
2023-08-30 21:59 ` Leonardo Brás
2023-09-06 21:15 ` Leonardo Bras Soares Passos
2023-12-06 0:56 ` leobras.c
2024-01-03 11:05 ` Jisheng Zhang
2024-01-03 15:31 ` Leonardo Bras
2023-09-10 8:50 ` [RFC PATCH v5 0/5] Rework & improve riscv cmpxchg.h and atomic.h Guo Ren
2023-09-12 0:22 ` Leonardo Bras Soares Passos
2023-12-23 3:07 ` Leonardo Bras
2023-12-23 3:15 ` Guo Ren
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=b0cc2cd8-e246-40d1-b091-f40a74b31f61@app.fastmail.com \
--to=arnd@arndb.de \
--cc=andrzej.hajda@intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=boqun.feng@gmail.com \
--cc=guoren@kernel.org \
--cc=leobras@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=parri.andrea@gmail.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).