[PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names

Kent Overstreet posted 7 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by Kent Overstreet 2 months, 2 weeks ago
Give these config options names so that they show up under the "Library
routes" kernel configuration menu, and can be enabled by distributions.

These are needed for bcachefs to be built out of tree.

These libraries are both for RAID5/6.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
 crypto/Kconfig | 2 +-
 lib/Kconfig    | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 23bd98981ae8..da4f072abae0 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -3,7 +3,7 @@
 # Generic algorithms support
 #
 config XOR_BLOCKS
-	tristate
+	tristate "Accelerated block xor algorithm"
 
 #
 # async_tx api: hardware offloaded memory transfer/transform support
diff --git a/lib/Kconfig b/lib/Kconfig
index badcb5ca9efd..e831f4462453 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -9,7 +9,9 @@ config BINARY_PRINTF
 menu "Library routines"
 
 config RAID6_PQ
-	tristate
+	tristate "Reed-solomon RAID5/6 algorithms"
+	help
+	  Provides routines for block level reed-solomon, for RAID5/6
 
 config RAID6_PQ_BENCHMARK
 	bool "Automatically choose fastest RAID6 PQ functions"
-- 
2.51.0
Re: [PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by dan.j.williams@intel.com 2 months, 1 week ago
Kent Overstreet wrote:
> Give these config options names so that they show up under the "Library
> routes" kernel configuration menu, and can be enabled by distributions.

A distribution specifies a kernel configuration. A distribution that
ships a given out-of-tree module can arrange for all its dependencies to
be met.

> These are needed for bcachefs to be built out of tree.
> 
> These libraries are both for RAID5/6.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
> ---
>  crypto/Kconfig | 2 +-
>  lib/Kconfig    | 4 +++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index 23bd98981ae8..da4f072abae0 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -3,7 +3,7 @@
>  # Generic algorithms support
>  #
>  config XOR_BLOCKS
> -	tristate
> +	tristate "Accelerated block xor algorithm"

For example, the approach taken with the CXL unit test modules in
tools/testing/ is to have them assert all their dependencies.
Specifically, tools/testing/cxl/config_check.c validates the test
environment rather than giving the out-of-tree module the ability to
select symbols.

Now in this specific case of XOR_BLOCKS, if a distribution really wants
CONFIG_XOR_BLOCKS=n in its main config *and* wants to ship an
out-of-tree module that depends on CONFIG_XOR_BLOCKS=m, then that
distribution needs to provide an xor.ko to meet that dependency. Not
make upstream carry a patch to make that symbol configurable with no
upstream consumer.

tools/testing/cxl/Kbuild is an example of building a set of in-tree
modules as out-of-tree modules.
Re: [PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by Christoph Hellwig 2 months, 2 weeks ago
On Fri, Oct 03, 2025 at 10:00:48PM -0400, Kent Overstreet wrote:
> Give these config options names so that they show up under the "Library
> routes" kernel configuration menu, and can be enabled by distributions.
> 
> These are needed for bcachefs to be built out of tree.

We do not add hooks for out of tree code, and this applies to you just
like for everyone else.
Re: [PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by Kent Overstreet 2 months, 2 weeks ago
On Fri, Oct 03, 2025 at 09:14:37PM -0700, Christoph Hellwig wrote:
> On Fri, Oct 03, 2025 at 10:00:48PM -0400, Kent Overstreet wrote:
> > Give these config options names so that they show up under the "Library
> > routes" kernel configuration menu, and can be enabled by distributions.
> > 
> > These are needed for bcachefs to be built out of tree.
> 
> We do not add hooks for out of tree code, and this applies to you just
> like for everyone else.

That's been the primary purpose of the lib/ kconfig menu. The current
language is no longer quite as explicit as it used to be, but here's a
recent example:

config CRC16                                                                                                                                                                                                                                                                                                                      
        tristate "CRC16 functions"                                                                                                                                                                                                                                                                                                
        help                                                                                                                                                                                                                                                                                                                      
          This option is provided for the case where no in-kernel-tree                                                                                                                                                                                                                                                            
          modules require CRC16 functions, but a module built outside                                                                                                                                                                                                                                                             
          the kernel tree does. Such modules that use library CRC16                                                                                                                                                                                                                                                               
          functions require M here.
Re: [PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by Christoph Hellwig 2 months, 2 weeks ago
On Sat, Oct 04, 2025 at 12:29:15AM -0400, Kent Overstreet wrote:
> That's been the primary purpose of the lib/ kconfig menu. The current
> language is no longer quite as explicit as it used to be, but here's a
> recent example:

It's not the current kernel where this got fixed.  If you find others
instances, we can fix them as well.
Re: [PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by Kent Overstreet 2 months, 2 weeks ago
On Fri, Oct 03, 2025 at 09:32:25PM -0700, Christoph Hellwig wrote:
> On Sat, Oct 04, 2025 at 12:29:15AM -0400, Kent Overstreet wrote:
> > That's been the primary purpose of the lib/ kconfig menu. The current
> > language is no longer quite as explicit as it used to be, but here's a
> > recent example:
> 
> It's not the current kernel where this got fixed.  If you find others
> instances, we can fix them as well.

The current language is only slightly less explicit, but the underlying
purpose remains the same.
Re: [PATCH 6/7] lib: Give XOR_BLOCKS, RAID6_PQ config opts names
Posted by Christoph Hellwig 2 months, 2 weeks ago
On Sat, Oct 04, 2025 at 12:37:21AM -0400, Kent Overstreet wrote:
> On Fri, Oct 03, 2025 at 09:32:25PM -0700, Christoph Hellwig wrote:
> > On Sat, Oct 04, 2025 at 12:29:15AM -0400, Kent Overstreet wrote:
> > > That's been the primary purpose of the lib/ kconfig menu. The current
> > > language is no longer quite as explicit as it used to be, but here's a
> > > recent example:
> > 
> > It's not the current kernel where this got fixed.  If you find others
> > instances, we can fix them as well.
> 
> The current language is only slightly less explicit, but the underlying
> purpose remains the same.

There is no such current language.  It is a non-selectable symbol with
this standard help text used by all CRC helpers:

	The CRC16 library functions.  Select this if your module uses
	any of the functions from <linux/crc16.h>.