From: Conor Dooley <conor@kernel.org>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>,
Jonathan Corbet <corbet@lwn.net>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Andrea Parri <parri.andrea@gmail.com>,
Nathan Chancellor <nathan@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
Leonardo Bras <leobras@redhat.com>, Guo Ren <guoren@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH v3 03/11] riscv: Implement cmpxchg8/16() using Zabha
Date: Wed, 17 Jul 2024 16:29:41 +0100 [thread overview]
Message-ID: <20240717-enroll-snowless-e722e367789b@spud> (raw)
In-Reply-To: <20240717-e7104dac172d9f2cbc25d9c6@orel>
[-- Attachment #1: Type: text/plain, Size: 2156 bytes --]
On Wed, Jul 17, 2024 at 10:26:34AM -0500, Andrew Jones wrote:
> On Wed, Jul 17, 2024 at 08:19:49AM GMT, Alexandre Ghiti wrote:
> > -#define __arch_cmpxchg_masked(sc_sfx, prepend, append, r, p, o, n) \
> > +#define __arch_cmpxchg_masked(sc_sfx, cas_sfx, prepend, append, r, p, o, n) \
> > ({ \
> > + __label__ no_zabha_zacas, end; \
> > + \
> > + if (IS_ENABLED(CONFIG_RISCV_ISA_ZABHA) && \
> > + IS_ENABLED(CONFIG_RISCV_ISA_ZACAS)) { \
> > + asm goto(ALTERNATIVE("j %[no_zabha_zacas]", "nop", 0, \
> > + RISCV_ISA_EXT_ZABHA, 1) \
> > + : : : : no_zabha_zacas); \
> > + asm goto(ALTERNATIVE("j %[no_zabha_zacas]", "nop", 0, \
> > + RISCV_ISA_EXT_ZACAS, 1) \
> > + : : : : no_zabha_zacas); \
>
> I came late to the call, but I guess trying to get rid of these asm gotos
> was the topic of the discussion. The proposal was to try and use static
> branches, but keep in mind that we've had trouble with static branches
> inside macros in the past when those macros are used in many places[1]
>
> [1] commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y")
The other half of the suggestion was not using an asm goto, but instead
trying to patch the whole thing in the alternative, for the problematic
section with llvm < 17.
>
> > + \
> > + __asm__ __volatile__ ( \
> > + prepend \
> > + " amocas" cas_sfx " %0, %z2, %1\n" \
> > + append \
> > + : "+&r" (r), "+A" (*(p)) \
> > + : "rJ" (n) \
> > + : "memory"); \
> > + goto end; \
> > + } \
> > + \
> > +no_zabha_zacas:; \
>
> unnecessary ;
>
> > u32 *__ptr32b = (u32 *)((ulong)(p) & ~0x3); \
> > ulong __s = ((ulong)(p) & (0x4 - sizeof(*p))) * BITS_PER_BYTE; \
> > ulong __mask = GENMASK(((sizeof(*p)) * BITS_PER_BYTE) - 1, 0) \
> > @@ -133,6 +155,8 @@
> > : "memory"); \
> > \
> > r = (__typeof__(*(p)))((__retx & __mask) >> __s); \
> > + \
> > +end:; \
> > })
> >
> > #define __arch_cmpxchg(lr_sfx, sc_cas_sfx, prepend, append, r, p, co, o, n) \
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Conor Dooley <conor@kernel.org>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>,
Jonathan Corbet <corbet@lwn.net>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Andrea Parri <parri.andrea@gmail.com>,
Nathan Chancellor <nathan@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
Leonardo Bras <leobras@redhat.com>, Guo Ren <guoren@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH v3 03/11] riscv: Implement cmpxchg8/16() using Zabha
Date: Wed, 17 Jul 2024 16:29:41 +0100 [thread overview]
Message-ID: <20240717-enroll-snowless-e722e367789b@spud> (raw)
In-Reply-To: <20240717-e7104dac172d9f2cbc25d9c6@orel>
[-- Attachment #1.1: Type: text/plain, Size: 2156 bytes --]
On Wed, Jul 17, 2024 at 10:26:34AM -0500, Andrew Jones wrote:
> On Wed, Jul 17, 2024 at 08:19:49AM GMT, Alexandre Ghiti wrote:
> > -#define __arch_cmpxchg_masked(sc_sfx, prepend, append, r, p, o, n) \
> > +#define __arch_cmpxchg_masked(sc_sfx, cas_sfx, prepend, append, r, p, o, n) \
> > ({ \
> > + __label__ no_zabha_zacas, end; \
> > + \
> > + if (IS_ENABLED(CONFIG_RISCV_ISA_ZABHA) && \
> > + IS_ENABLED(CONFIG_RISCV_ISA_ZACAS)) { \
> > + asm goto(ALTERNATIVE("j %[no_zabha_zacas]", "nop", 0, \
> > + RISCV_ISA_EXT_ZABHA, 1) \
> > + : : : : no_zabha_zacas); \
> > + asm goto(ALTERNATIVE("j %[no_zabha_zacas]", "nop", 0, \
> > + RISCV_ISA_EXT_ZACAS, 1) \
> > + : : : : no_zabha_zacas); \
>
> I came late to the call, but I guess trying to get rid of these asm gotos
> was the topic of the discussion. The proposal was to try and use static
> branches, but keep in mind that we've had trouble with static branches
> inside macros in the past when those macros are used in many places[1]
>
> [1] commit 0b1d60d6dd9e ("riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y")
The other half of the suggestion was not using an asm goto, but instead
trying to patch the whole thing in the alternative, for the problematic
section with llvm < 17.
>
> > + \
> > + __asm__ __volatile__ ( \
> > + prepend \
> > + " amocas" cas_sfx " %0, %z2, %1\n" \
> > + append \
> > + : "+&r" (r), "+A" (*(p)) \
> > + : "rJ" (n) \
> > + : "memory"); \
> > + goto end; \
> > + } \
> > + \
> > +no_zabha_zacas:; \
>
> unnecessary ;
>
> > u32 *__ptr32b = (u32 *)((ulong)(p) & ~0x3); \
> > ulong __s = ((ulong)(p) & (0x4 - sizeof(*p))) * BITS_PER_BYTE; \
> > ulong __mask = GENMASK(((sizeof(*p)) * BITS_PER_BYTE) - 1, 0) \
> > @@ -133,6 +155,8 @@
> > : "memory"); \
> > \
> > r = (__typeof__(*(p)))((__retx & __mask) >> __s); \
> > + \
> > +end:; \
> > })
> >
> > #define __arch_cmpxchg(lr_sfx, sc_cas_sfx, prepend, append, r, p, co, o, n) \
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-07-17 15:29 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-17 6:19 [PATCH v3 00/11] Zacas/Zabha support and qspinlocks Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 01/11] riscv: Implement cmpxchg32/64() using Zacas Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 15:08 ` Andrew Jones
2024-07-17 15:08 ` Andrew Jones
2024-07-17 15:18 ` Alexandre Ghiti
2024-07-17 15:18 ` Alexandre Ghiti
2024-07-19 0:45 ` Samuel Holland
2024-07-19 0:45 ` Samuel Holland
2024-07-19 11:48 ` Alexandre Ghiti
2024-07-19 11:48 ` Alexandre Ghiti
2024-07-19 11:53 ` Alexandre Ghiti
2024-07-19 11:53 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 02/11] dt-bindings: riscv: Add Zabha ISA extension description Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:42 ` Krzysztof Kozlowski
2024-07-17 6:42 ` Krzysztof Kozlowski
2024-07-17 9:32 ` Guo Ren
2024-07-17 9:32 ` Guo Ren
2024-07-17 6:19 ` [PATCH v3 03/11] riscv: Implement cmpxchg8/16() using Zabha Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 15:26 ` Andrew Jones
2024-07-17 15:26 ` Andrew Jones
2024-07-17 15:29 ` Conor Dooley [this message]
2024-07-17 15:29 ` Conor Dooley
2024-07-17 15:34 ` Alexandre Ghiti
2024-07-17 15:34 ` Alexandre Ghiti
2024-07-18 12:50 ` Alexandre Ghiti
2024-07-18 12:50 ` Alexandre Ghiti
2024-07-18 16:06 ` Andrew Jones
2024-07-18 16:06 ` Andrew Jones
2024-07-18 16:20 ` Alexandre Ghiti
2024-07-18 16:20 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 04/11] riscv: Improve zacas fully-ordered cmpxchg() Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 05/11] riscv: Implement arch_cmpxchg128() using Zacas Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 20:34 ` Andrew Jones
2024-07-17 20:34 ` Andrew Jones
2024-07-18 7:48 ` Alexandre Ghiti
2024-07-18 7:48 ` Alexandre Ghiti
2024-07-18 8:33 ` Conor Dooley
2024-07-18 8:33 ` Conor Dooley
2024-07-18 9:35 ` Arnd Bergmann
2024-07-18 9:35 ` Arnd Bergmann
2024-07-17 6:19 ` [PATCH v3 06/11] riscv: Implement xchg8/16() using Zabha Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 07/11] asm-generic: ticket-lock: Reuse arch_spinlock_t of qspinlock Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 08/11] asm-generic: ticket-lock: Add separate ticket-lock.h Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 09/11] riscv: Add ISA extension parsing for Ziccrse Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-19 0:53 ` Samuel Holland
2024-07-19 0:53 ` Samuel Holland
2024-07-19 9:11 ` Alexandre Ghiti
2024-07-19 9:11 ` Alexandre Ghiti
2024-07-17 6:19 ` [PATCH v3 10/11] dt-bindings: riscv: Add Ziccrse ISA extension description Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 6:55 ` Krzysztof Kozlowski
2024-07-17 6:55 ` Krzysztof Kozlowski
2024-07-17 9:42 ` Guo Ren
2024-07-17 9:42 ` Guo Ren
2024-07-17 6:19 ` [PATCH v3 11/11] riscv: Add qspinlock support Alexandre Ghiti
2024-07-17 6:19 ` Alexandre Ghiti
2024-07-17 9:30 ` Guo Ren
2024-07-17 9:30 ` Guo Ren
2024-07-18 13:11 ` Alexandre Ghiti
2024-07-18 13:11 ` Alexandre Ghiti
2024-07-17 16:29 ` Andrea Parri
2024-07-17 16:29 ` Andrea Parri
2024-07-18 13:08 ` Alexandre Ghiti
2024-07-18 13:08 ` Alexandre Ghiti
2024-07-19 1:05 ` Samuel Holland
2024-07-19 1:05 ` Samuel Holland
2024-07-19 9:06 ` Alexandre Ghiti
2024-07-19 9:06 ` Alexandre Ghiti
2024-07-17 16:37 ` [PATCH v3 00/11] Zacas/Zabha support and qspinlocks Andrea Parri
2024-07-17 16:37 ` Andrea Parri
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=20240717-enroll-snowless-e722e367789b@spud \
--to=conor@kernel.org \
--cc=ajones@ventanamicro.com \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=boqun.feng@gmail.com \
--cc=corbet@lwn.net \
--cc=guoren@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=leobras@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=palmer@dabbelt.com \
--cc=parri.andrea@gmail.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.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 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.