From: Andrea Parri <parri.andrea@gmail.com>
To: Xu Lu <luxu.kernel@bytedance.com>
Cc: corbet@lwn.net, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, paul.walmsley@sifive.com,
palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com,
mark.rutland@arm.com, ajones@ventanamicro.com, brs@rivosinc.com,
anup@brainfault.org, atish.patra@linux.dev, pbonzini@redhat.com,
shuah@kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
apw@canonical.com, joe@perches.com, linux-doc@vger.kernel.org,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-kselftest@vger.kernel.org
Subject: Re: [External] Re: [PATCH v3 0/8] riscv: Add Zalasr ISA extension support
Date: Fri, 19 Sep 2025 13:06:15 +0200 [thread overview]
Message-ID: <aM05J6FU0xG3SBzR@andrea> (raw)
In-Reply-To: <CAPYmKFsV_ZPifJBtvPOdqM6_Mzhac9A4-PH9zt8TirOqAwKGhw@mail.gmail.com>
> > > (not a review, just looking at this diff stat) is changing the fastpath
> > >
> > > read_unlock()
> > > read_lock()
> > >
> > > from something like
> > >
> > > fence rw,w
> > > amodadd.w
> > > amoadd.w
> > > fence r,rw
> > >
> > > to
> > >
> > > fence rw,rw
> > > amoadd.w
> > > amoadd.w
> > > fence rw,rw
> > >
> > > no matter Zalasr or !Zalasr. Similarly for other atomic operations with
> > > release or acquire semantics. I guess the change was not intentional?
> > > If it was intentional, it should be properly mentioned in the changelog.
> >
> > Sorry about that. It is intended. The atomic operation before
> > __atomic_acquire_fence or operation after __atomic_release_fence can
> > be just a single ld or sd instruction instead of amocas or amoswap. In
> > such cases, when the store release operation becomes 'sd.rl', the
> > __atomic_acquire_fence via 'fence r, rw' can not ensure FENCE.TSO
> > anymore. Thus I replace it with 'fence rw, rw'.
But you could apply similar changes you performed for xchg & cmpxchg: use
.AQ and .RL for other atomic RMW operations as well, no? AFAICS, that is
what arm64 actually does in arch/arm64/include/asm/atomic_{ll_sc,lse}.h .
Andrea
> This is also the common implementation on other architectures who use
> aq/rl instructions like ARM. And you certainly already knew it~
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Parri <parri.andrea@gmail.com>
To: Xu Lu <luxu.kernel@bytedance.com>
Cc: corbet@lwn.net, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, paul.walmsley@sifive.com,
palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com,
mark.rutland@arm.com, ajones@ventanamicro.com, brs@rivosinc.com,
anup@brainfault.org, atish.patra@linux.dev, pbonzini@redhat.com,
shuah@kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
apw@canonical.com, joe@perches.com, linux-doc@vger.kernel.org,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-kselftest@vger.kernel.org
Subject: Re: [External] Re: [PATCH v3 0/8] riscv: Add Zalasr ISA extension support
Date: Fri, 19 Sep 2025 13:06:15 +0200 [thread overview]
Message-ID: <aM05J6FU0xG3SBzR@andrea> (raw)
In-Reply-To: <CAPYmKFsV_ZPifJBtvPOdqM6_Mzhac9A4-PH9zt8TirOqAwKGhw@mail.gmail.com>
> > > (not a review, just looking at this diff stat) is changing the fastpath
> > >
> > > read_unlock()
> > > read_lock()
> > >
> > > from something like
> > >
> > > fence rw,w
> > > amodadd.w
> > > amoadd.w
> > > fence r,rw
> > >
> > > to
> > >
> > > fence rw,rw
> > > amoadd.w
> > > amoadd.w
> > > fence rw,rw
> > >
> > > no matter Zalasr or !Zalasr. Similarly for other atomic operations with
> > > release or acquire semantics. I guess the change was not intentional?
> > > If it was intentional, it should be properly mentioned in the changelog.
> >
> > Sorry about that. It is intended. The atomic operation before
> > __atomic_acquire_fence or operation after __atomic_release_fence can
> > be just a single ld or sd instruction instead of amocas or amoswap. In
> > such cases, when the store release operation becomes 'sd.rl', the
> > __atomic_acquire_fence via 'fence r, rw' can not ensure FENCE.TSO
> > anymore. Thus I replace it with 'fence rw, rw'.
But you could apply similar changes you performed for xchg & cmpxchg: use
.AQ and .RL for other atomic RMW operations as well, no? AFAICS, that is
what arm64 actually does in arch/arm64/include/asm/atomic_{ll_sc,lse}.h .
Andrea
> This is also the common implementation on other architectures who use
> aq/rl instructions like ARM. And you certainly already knew it~
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Parri <parri.andrea@gmail.com>
To: Xu Lu <luxu.kernel@bytedance.com>
Cc: corbet@lwn.net, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, paul.walmsley@sifive.com,
palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com,
mark.rutland@arm.com, ajones@ventanamicro.com, brs@rivosinc.com,
anup@brainfault.org, atish.patra@linux.dev, pbonzini@redhat.com,
shuah@kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
apw@canonical.com, joe@perches.com, linux-doc@vger.kernel.org,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-kselftest@vger.kernel.org
Subject: Re: [External] Re: [PATCH v3 0/8] riscv: Add Zalasr ISA extension support
Date: Fri, 19 Sep 2025 13:06:15 +0200 [thread overview]
Message-ID: <aM05J6FU0xG3SBzR@andrea> (raw)
In-Reply-To: <CAPYmKFsV_ZPifJBtvPOdqM6_Mzhac9A4-PH9zt8TirOqAwKGhw@mail.gmail.com>
> > > (not a review, just looking at this diff stat) is changing the fastpath
> > >
> > > read_unlock()
> > > read_lock()
> > >
> > > from something like
> > >
> > > fence rw,w
> > > amodadd.w
> > > amoadd.w
> > > fence r,rw
> > >
> > > to
> > >
> > > fence rw,rw
> > > amoadd.w
> > > amoadd.w
> > > fence rw,rw
> > >
> > > no matter Zalasr or !Zalasr. Similarly for other atomic operations with
> > > release or acquire semantics. I guess the change was not intentional?
> > > If it was intentional, it should be properly mentioned in the changelog.
> >
> > Sorry about that. It is intended. The atomic operation before
> > __atomic_acquire_fence or operation after __atomic_release_fence can
> > be just a single ld or sd instruction instead of amocas or amoswap. In
> > such cases, when the store release operation becomes 'sd.rl', the
> > __atomic_acquire_fence via 'fence r, rw' can not ensure FENCE.TSO
> > anymore. Thus I replace it with 'fence rw, rw'.
But you could apply similar changes you performed for xchg & cmpxchg: use
.AQ and .RL for other atomic RMW operations as well, no? AFAICS, that is
what arm64 actually does in arch/arm64/include/asm/atomic_{ll_sc,lse}.h .
Andrea
> This is also the common implementation on other architectures who use
> aq/rl instructions like ARM. And you certainly already knew it~
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2025-09-19 11:06 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 7:37 [PATCH v3 0/8] riscv: Add Zalasr ISA extension support Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 1/8] riscv: add ISA extension parsing for Zalasr Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 2/8] dt-bindings: riscv: Add Zalasr ISA extension description Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 3/8] riscv: hwprobe: Export Zalasr extension Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 4/8] riscv: Introduce Zalasr instructions Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 5/8] riscv: Use Zalasr for smp_load_acquire/smp_store_release Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 6/8] riscv: Apply acquire/release semantics to arch_xchg/arch_cmpxchg operations Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-20 14:52 ` kernel test robot
2025-09-20 14:52 ` kernel test robot
2025-09-20 14:52 ` kernel test robot
2025-09-19 7:37 ` [PATCH v3 7/8] RISC-V: KVM: Allow Zalasr extensions for Guest/VM Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` [PATCH v3 8/8] KVM: riscv: selftests: Add Zalasr extensions to get-reg-list test Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 7:37 ` Xu Lu
2025-09-19 10:04 ` [PATCH v3 0/8] riscv: Add Zalasr ISA extension support Andrea Parri
2025-09-19 10:04 ` Andrea Parri
2025-09-19 10:04 ` Andrea Parri
2025-09-19 10:39 ` [External] " Xu Lu
2025-09-19 10:39 ` Xu Lu
2025-09-19 10:39 ` Xu Lu
2025-09-19 10:53 ` Xu Lu
2025-09-19 10:53 ` Xu Lu
2025-09-19 10:53 ` Xu Lu
2025-09-19 11:06 ` Andrea Parri [this message]
2025-09-19 11:06 ` Andrea Parri
2025-09-19 11:06 ` Andrea Parri
2025-09-19 12:12 ` Xu Lu
2025-09-19 12:12 ` Xu Lu
2025-09-19 12:12 ` Xu Lu
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=aM05J6FU0xG3SBzR@andrea \
--to=parri.andrea@gmail.com \
--cc=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=apw@canonical.com \
--cc=atish.patra@linux.dev \
--cc=boqun.feng@gmail.com \
--cc=brs@rivosinc.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=joe@perches.com \
--cc=krzk+dt@kernel.org \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luxu.kernel@bytedance.com \
--cc=mark.rutland@arm.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=shuah@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.