public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Ignacio Encinas <ignacio@iencinas.com>
To: Ben Dooks <ben.dooks@codethink.co.uk>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alexandre Ghiti <alex@ghiti.fr>, Arnd Bergmann <arnd@arndb.de>
Cc: "Eric Biggers" <ebiggers@kernel.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org,
	"Zhihang Shao" <zhihang.shao.iscas@gmail.com>,
	"Björn Töpel" <bjorn@kernel.org>,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH v3 2/2] riscv: introduce asm/swab.h
Date: Fri, 4 Apr 2025 19:53:46 +0200	[thread overview]
Message-ID: <5348670b-1bbf-4948-9b3a-9da210debf03@iencinas.com> (raw)
In-Reply-To: <aa29e983-78b9-430b-b8a6-e64de5f4ca12@codethink.co.uk>



On 4/4/25 17:47, Ben Dooks wrote:
> I was having a look at this as well, using the alternatives macros.
> 
> It would be nice to have a __zbb_swab defined so that you could do some
> time checks with this, because it would be interesting to see the
> benchmark of how much these improve byteswapping.

I get your point, but isn't what you propose equivalent to benchmarking 
__arch_swab vs ___constant_swab? 
 
> Also, I wonder if it is possible to say to the build system we must
> have ZBB therefore only emit ZBB for cases where you are building a
> kernel for an known ZBB system.

You can disable ZBB instructions if you do RISCV_ISA_ZBB=n. 

config RISCV_ISA_ZBB
	bool "Zbb extension support for bit manipulation instructions"
	depends on TOOLCHAIN_HAS_ZBB
	depends on RISCV_ALTERNATIVE
	default y
	help
	   Adds support to dynamically detect the presence of the ZBB
	   extension (basic bit manipulation) and enable its usage.

	   The Zbb extension provides instructions to accelerate a number
	   of bit-specific operations (count bit population, sign extending,
	   bitrotation, etc).

	   If you don't know what to do here, say Y.

However, statically assuming ZBB instruction support is another beast
and I don't really have an informed opinion about this. Perhaps in a few
years?

Thanks for the review!

  reply	other threads:[~2025-04-04 17:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 20:34 [PATCH v3 0/2] Implement endianess swap macros for RISC-V Ignacio Encinas
2025-04-03 20:34 ` [PATCH v3 1/2] include/uapi/linux/swab.h: move default implementation for swab macros into asm-generic Ignacio Encinas
2025-04-04 15:31   ` kernel test robot
2025-04-03 20:34 ` [PATCH v3 2/2] riscv: introduce asm/swab.h Ignacio Encinas
2025-04-04  5:58   ` Arnd Bergmann
2025-04-04 15:54     ` Ben Dooks
2025-04-04 17:35     ` Ignacio Encinas
2025-04-23 11:08       ` Alexandre Ghiti
2025-04-24 17:27         ` Ignacio Encinas Rubio
2025-04-04 15:47   ` Ben Dooks
2025-04-04 17:53     ` Ignacio Encinas [this message]
2025-04-04 19:28     ` Eric Biggers
2025-04-04 15:55   ` Ben Dooks
2025-04-04 18:13     ` Ignacio Encinas
2025-04-04 15:56 ` [PATCH v3 0/2] Implement endianess swap macros for RISC-V Ben Dooks

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=5348670b-1bbf-4948-9b3a-9da210debf03@iencinas.com \
    --to=ignacio@iencinas.com \
    --cc=alex@ghiti.fr \
    --cc=arnd@arndb.de \
    --cc=ben.dooks@codethink.co.uk \
    --cc=bjorn@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=skhan@linuxfoundation.org \
    --cc=zhihang.shao.iscas@gmail.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