From: Conor Dooley <conor@kernel.org>
To: Samuel Holland <samuel.holland@sifive.com>
Cc: Andrew Jones <ajones@ventanamicro.com>,
Xu Lu <luxu.kernel@bytedance.com>,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, andy.chiu@sifive.com, guoren@kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
lihangjing@bytedance.com, dengliang.1214@bytedance.com,
xieyongji@bytedance.com, chaiwen.cc@bytedance.com
Subject: Re: [RFC 1/2] riscv: process: Introduce idle thread using Zawrs extension
Date: Thu, 18 Apr 2024 23:09:57 +0100 [thread overview]
Message-ID: <20240418-smilingly-overplant-c5f3a698fdc2@spud> (raw)
In-Reply-To: <33de5d8f-5ccb-4dd0-9915-720e6f800560@sifive.com>
[-- Attachment #1: Type: text/plain, Size: 3571 bytes --]
On Thu, Apr 18, 2024 at 05:00:42PM -0500, Samuel Holland wrote:
> Hi Drew,
>
> On 2024-04-18 2:10 PM, Andrew Jones wrote:
> > On Thu, Apr 18, 2024 at 04:05:55PM +0100, Conor Dooley wrote:
> >> + Drew,
> >>
> >> On Thu, Apr 18, 2024 at 07:49:41PM +0800, Xu Lu wrote:
> >>> The Zawrs extension introduces a new instruction WRS.NTO, which will
> >>> register a reservation set and causes the hart to temporarily stall
> >>> execution in a low-power state until a store occurs to the reservation
> >>> set or an interrupt is observed.
> >>>
> >>> This commit implements new version of idle thread for RISC-V via Zawrs
> >>> extension.
> >>>
> >>> Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
> >>> Reviewed-by: Hangjing Li <lihangjing@bytedance.com>
> >>> Reviewed-by: Liang Deng <dengliang.1214@bytedance.com>
> >>> Reviewed-by: Wen Chai <chaiwen.cc@bytedance.com>
> >>> ---
> >>> arch/riscv/Kconfig | 24 +++++++++++++++++
> >>> arch/riscv/include/asm/cpuidle.h | 11 +-------
> >>> arch/riscv/include/asm/hwcap.h | 1 +
> >>> arch/riscv/include/asm/processor.h | 17 +++++++++++++
> >>> arch/riscv/kernel/cpu.c | 5 ++++
> >>> arch/riscv/kernel/cpufeature.c | 1 +
> >>> arch/riscv/kernel/process.c | 41 +++++++++++++++++++++++++++++-
> >>> 7 files changed, 89 insertions(+), 11 deletions(-)
> >>>
> >>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> >>> index be09c8836d56..a0d344e9803f 100644
> >>> --- a/arch/riscv/Kconfig
> >>> +++ b/arch/riscv/Kconfig
> >>> @@ -19,6 +19,7 @@ config RISCV
> >>> select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
> >>> select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
> >>> select ARCH_HAS_BINFMT_FLAT
> >>> + select ARCH_HAS_CPU_FINALIZE_INIT
> >>> select ARCH_HAS_CURRENT_STACK_POINTER
> >>> select ARCH_HAS_DEBUG_VIRTUAL if MMU
> >>> select ARCH_HAS_DEBUG_VM_PGTABLE
> >>> @@ -525,6 +526,20 @@ config RISCV_ISA_SVPBMT
> >>>
> >>> If you don't know what to do here, say Y.
> >>>
> >>> +config RISCV_ISA_ZAWRS
> >>> + bool "Zawrs extension support for wait-on-reservation-set instructions"
> >>> + depends on RISCV_ALTERNATIVE
> >>> + default y
> >>> + help
> >>> + Adds support to dynamically detect the presence of the Zawrs
> >>> + extension and enable its usage.
> >>
> >> Drew, could you, in your update, use the wording:
> >> Add support for enabling optimisations in the kernel when the
> >> Zawrs extension is detected at boot.
> >
> > How about
Probably should have said, this was just a replacement for the first
paragraph, not the entire text.
> >
> > The Zawrs extension defines a pair of instructions to be used in
> > polling loops which allow a hart to enter a low-power state or to
> > trap to the hypervisor while waiting on a store to a memory location.
> > Enable the use of these instructions when the Zawrs extension is
>
> ^ in the kernel
>
> I believe "in the kernel" was an important part of the clarification that these
> Kconfig options do not affect whether userspace can use these instructions.
Meant to reply earlier but forgot. Samuel's correct, it is indeed the
key bit I wanted, I just suggest what's above to match what was in the
patch I had sent earlier today. Don't really care all that much if it
is a match nor not, but I do care about the help text actually
describing /who/ gets to use the extension when the option is enabled.
Thanks,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-04-18 22:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 11:49 [RFC 0/2] riscv: Idle thread using Zawrs extension Xu Lu
2024-04-18 11:49 ` [RFC 1/2] riscv: process: Introduce idle " Xu Lu
2024-04-18 15:05 ` Conor Dooley
2024-04-18 16:14 ` [External] " Xu Lu
2024-04-22 8:21 ` Conor Dooley
2024-04-18 19:10 ` Andrew Jones
2024-04-18 22:00 ` Samuel Holland
2024-04-18 22:09 ` Conor Dooley [this message]
2024-04-18 11:49 ` [RFC 2/2] riscv: Use Zawrs to accelerate IPI to idle cpu Xu Lu
2024-04-18 12:26 ` [RFC 0/2] riscv: Idle thread using Zawrs extension Christoph Müllner
2024-04-18 12:44 ` [External] " Xu Lu
2024-04-18 12:56 ` Christoph Müllner
2024-04-18 13:09 ` Xu Lu
2024-04-18 14:08 ` Conor Dooley
2024-04-18 14:10 ` Andrew Jones
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=20240418-smilingly-overplant-c5f3a698fdc2@spud \
--to=conor@kernel.org \
--cc=ajones@ventanamicro.com \
--cc=andy.chiu@sifive.com \
--cc=aou@eecs.berkeley.edu \
--cc=chaiwen.cc@bytedance.com \
--cc=dengliang.1214@bytedance.com \
--cc=guoren@kernel.org \
--cc=lihangjing@bytedance.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luxu.kernel@bytedance.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=xieyongji@bytedance.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).