From: Conor Dooley <conor.dooley@microchip.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: "Wang, Xiao W" <xiao.w.wang@intel.com>,
"paul.walmsley@sifive.com" <paul.walmsley@sifive.com>,
"palmer@dabbelt.com" <palmer@dabbelt.com>,
"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
"luke.r.nels@gmail.com" <luke.r.nels@gmail.com>,
"xi.wang@gmail.com" <xi.wang@gmail.com>,
"bjorn@kernel.org" <bjorn@kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"andrii@kernel.org" <andrii@kernel.org>,
"martin.lau@linux.dev" <martin.lau@linux.dev>,
"eddyz87@gmail.com" <eddyz87@gmail.com>,
"song@kernel.org" <song@kernel.org>,
"yonghong.song@linux.dev" <yonghong.song@linux.dev>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"kpsingh@kernel.org" <kpsingh@kernel.org>,
"sdf@google.com" <sdf@google.com>,
"haoluo@google.com" <haoluo@google.com>,
"jolsa@kernel.org" <jolsa@kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"pulehui@huawei.com" <pulehui@huawei.com>,
"Li, Haicheng" <haicheng.li@intel.com>,
"conor@kernel.org" <conor@kernel.org>,
Ben Dooks <ben.dooks@codethink.co.uk>
Subject: Re: [PATCH v2] riscv, bpf: Optimize zextw insn with Zba extension
Date: Wed, 15 May 2024 10:32:46 +0100 [thread overview]
Message-ID: <20240515-jogger-pummel-19fe4e9e8314@wendy> (raw)
In-Reply-To: <20240515-cone-getting-d17037b51e97@wendy>
[-- Attachment #1.1: Type: text/plain, Size: 2359 bytes --]
On Wed, May 15, 2024 at 09:19:46AM +0100, Conor Dooley wrote:
> On Tue, May 14, 2024 at 03:37:02PM +0200, Andrew Jones wrote:
> > On Tue, May 14, 2024 at 07:36:04AM GMT, Wang, Xiao W wrote:
> > > > From: Andrew Jones <ajones@ventanamicro.com>
> >> > > > +config RISCV_ISA_ZBA
> > > > > + bool "Zba extension support for bit manipulation instructions"
> > > > > + depends on TOOLCHAIN_HAS_ZBA
> > > >
> > > > We handcraft the instruction, so why do we need toolchain support?
> > >
> > > Good point, we don't need toolchain support for this bpf jit case.
> > >
> > > >
> > > > > + depends on RISCV_ALTERNATIVE
> > > >
> > > > Also, while riscv_has_extension_likely() will be accelerated with
> > > > RISCV_ALTERNATIVE, it's not required.
> > >
> > > Agree, it's not required. For this bpf jit case, we should drop these two dependencies.
> > >
> > > BTW, Zbb is used in bpf jit, the usage there also doesn't depend on toolchain and
> > > RISCV_ALTERNATIVE, but the Kconfig for RISCV_ISA_ZBB has forced the dependencies
> > > due to Zbb assembly programming elsewhere.
> > > Maybe we could just dynamically check the existence of RISCV_ISA_ZB* before jit code
> > > emission? or introduce new config options for bpf jit? I prefer the first method and
> > > welcome any comments.
> >
> > My preferences is to remove as much of the TOOLCHAIN_HAS_ stuff as
> > possible. We should audit the extensions which have them to see if
> > they're really necessary.
>
> While I think it is reasonable to allow the "RISCV_ISA_ZBB" option to
> control whether or not bpf is allowed to use it for optimisations, only
> allowing bpf to do that if there's toolchain support feels odd to me..
> Maybe we need to sorta steal from Charlie's patchset and introduce
> some hidden options that have the toolchain dep that are used by the
> alternative macros etc?
>
> I'll have a poke at how bad that looks I think.
I don't love this, in particular my option naming, but it would allow
the Zbb optimisations in the kernel to not depend on toolchain support
while not muddying the Kconfig waters for users:
https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/commit/?h=riscv-zbb_split
A similar model could be followed if there were to be some
optimisations for Zba in the future that do require toolchain support:
[-- 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-05-15 9:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-11 2:34 [PATCH v2] riscv, bpf: Optimize zextw insn with Zba extension Xiao Wang
2024-05-13 16:53 ` Andrew Jones
2024-05-14 7:36 ` Wang, Xiao W
2024-05-14 13:37 ` Andrew Jones
2024-05-15 7:38 ` Wang, Xiao W
2024-05-15 8:19 ` Conor Dooley
2024-05-15 9:32 ` Conor Dooley [this message]
2024-05-15 11:31 ` Wang, Xiao W
2024-05-15 11:51 ` Conor Dooley
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=20240515-jogger-pummel-19fe4e9e8314@wendy \
--to=conor.dooley@microchip.com \
--cc=ajones@ventanamicro.com \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=ben.dooks@codethink.co.uk \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=conor@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haicheng.li@intel.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luke.r.nels@gmail.com \
--cc=martin.lau@linux.dev \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pulehui@huawei.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=xi.wang@gmail.com \
--cc=xiao.w.wang@intel.com \
--cc=yonghong.song@linux.dev \
/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