BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yury Norov" <ynorov@nvidia.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 2/6] lib/bitrev: Introduce GENERIC_BITREVERSE and cleanup Kconfig
Date: Fri, 01 May 2026 21:15:32 +0000	[thread overview]
Message-ID: <20260501211532.CB003C2BCB4@smtp.kernel.org> (raw)
In-Reply-To: <20260430211351.658193-3-ynorov@nvidia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Build and linking failure for modules using bitreverse when CONFIG_BITREVERSE is compiled as a module ('m').
- [Medium] Kconfig unmet direct dependencies warning when GENERIC_BITREVERSE is selected by architectures.
--

commit 43d61911d4e52b31128989028f6541618dd3291b
Author: Jinjie Ruan <ruanjinjie@huawei.com>

lib/bitrev: Introduce GENERIC_BITREVERSE and cleanup Kconfig

This commit introduces the GENERIC_BITREVERSE config option to explicitly
manage the generic bit reversal lookup table, replacing the previous check for
!HAVE_ARCH_BITREVERSE. It updates lib/bitrev.c to use this new symbol and
makes it dependent on the BITREVERSE config.

> diff --git a/lib/Kconfig b/lib/Kconfig
> index 00a9509636c18..3ac12308eb765 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -62,6 +62,24 @@ config HAVE_ARCH_BITREVERSE
>  	  This option enables the use of hardware bit-reversal instructions on
>  	  architectures which support such operations.
>  
> +config GENERIC_BITREVERSE
> +	def_bool !HAVE_ARCH_BITREVERSE
> +	depends on BITREVERSE

Because BITREVERSE is a tristate symbol and GENERIC_BITREVERSE is defined as a
bool, what happens when BITREVERSE is configured as a module (=m)?

Kconfig evaluates a bool depending on a module as 'n'. This means when
CONFIG_BITREVERSE=m, CONFIG_GENERIC_BITREVERSE evaluates to 'n' and remains
undefined.

Will this result in missing declarations and linker failures for any modules
relying on the bitreverse library?

Additionally, does this strict dependency cause Kconfig unmet direct dependency
warnings if an architecture subsequently uses select GENERIC_BITREVERSE but
the kernel configuration has BITREVERSE disabled (such as in allnoconfig)?

> +	help
> +	  This option provides the standard software-based bit reversal

[ ... ]

> diff --git a/lib/bitrev.c b/lib/bitrev.c
> index 81b56e0a7f325..3a53ff67aebaa 100644
> --- a/lib/bitrev.c
> +++ b/lib/bitrev.c
> @@ -1,5 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> -#ifndef CONFIG_HAVE_ARCH_BITREVERSE
> +#ifdef CONFIG_GENERIC_BITREVERSE

If CONFIG_GENERIC_BITREVERSE evaluates to 'n' when CONFIG_BITREVERSE=m,
this file will be compiled empty. Does this prevent byte_rev_table from being
exported for modules that need it, causing a modpost linking failure?

>  #include <linux/types.h>
>  #include <linux/module.h>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260430211351.658193-1-ynorov@nvidia.com?part=2

  reply	other threads:[~2026-05-01 21:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 21:13 [PATCH 0/6] lib: rework bitreverse Yury Norov
2026-04-30 21:13 ` [PATCH 1/6] lib: include crc32.h conditionally on CONFIG_CRC32 Yury Norov
2026-05-01 21:15   ` sashiko-bot
2026-05-04  8:03   ` Arnd Bergmann
2026-05-04 12:43     ` David Laight
2026-05-04 16:46     ` Yury Norov
2026-05-04 17:18       ` Arnd Bergmann
2026-05-04 18:32         ` Yury Norov
2026-05-04 19:05           ` Arnd Bergmann
2026-05-05 19:03             ` Yury Norov
2026-05-06  6:30             ` Eric Biggers
2026-04-30 21:13 ` [PATCH 2/6] lib/bitrev: Introduce GENERIC_BITREVERSE and cleanup Kconfig Yury Norov
2026-05-01 21:15   ` sashiko-bot [this message]
2026-04-30 21:13 ` [PATCH 3/6] bitops: Define generic __bitrev8/16/32 for reuse Yury Norov
2026-05-01 21:15   ` sashiko-bot
2026-04-30 21:13 ` [PATCH 4/6] arch/riscv: Add bitrev.h file to support rev8 and brev8 Yury Norov
2026-05-01 21:15   ` sashiko-bot
2026-04-30 21:13 ` [PATCH 5/6] lib: compile generic bitrev.c conditionally on GENERIC_BITREVERSE Yury Norov
2026-05-01 21:15   ` sashiko-bot
2026-04-30 21:13 ` [PATCH 6/6] MAINTAINERS: BITOPS: include bitrev.[ch] Yury Norov
2026-05-02  1:40 ` [PATCH 0/6] lib: rework bitreverse Yury Norov

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=20260501211532.CB003C2BCB4@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    --cc=ynorov@nvidia.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