Skip to contentSkip to conversation

arch,mm: cleanup Kconfig entries for ARCH_FORCE_MAX_ORDER

PATCH Superseded Mike Rapoport 7 participants 24 messages Mar 23, 2023

Subsystems (10)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover arch,mm: cleanup Kconfig entries for ARCH_FORCE_MAX_ORDER

From: "Mike Rapoport (IBM)" <[email protected]>

Hi,

Several architectures have ARCH_FORCE_MAX_ORDER in their Kconfig and they all have wrong and misleading prompt and help text for this option.

Besides, some define insane limits for possible values of ARCH_FORCE_MAX_ORDER, some carefully define ranges only for a subset of possible configurations, some make this option configurable by users for no good reason.

This set updates the prompt and help text everywhere and does its best to update actual definitions of ranges where applicable.

Mike Rapoport (IBM) (14):
arm: reword ARCH_FORCE_MAX_ORDER prompt and help text
arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER
arm64: reword ARCH_FORCE_MAX_ORDER prompt and help text
csky: drop ARCH_FORCE_MAX_ORDER
ia64: don't allow users to override ARCH_FORCE_MAX_ORDER
m68k: reword ARCH_FORCE_MAX_ORDER prompt and help text
nios2: reword ARCH_FORCE_MAX_ORDER prompt and help text
nios2: drop ranges for definition of ARCH_FORCE_MAX_ORDER
powerpc: reword ARCH_FORCE_MAX_ORDER prompt and help text
powerpc: drop ranges for definition of ARCH_FORCE_MAX_ORDER
sh: reword ARCH_FORCE_MAX_ORDER prompt and help text
sh: drop ranges for definition of ARCH_FORCE_MAX_ORDER
sparc: reword ARCH_FORCE_MAX_ORDER prompt and help text
xtensa: reword ARCH_FORCE_MAX_ORDER prompt and help text

 arch/arm/Kconfig      | 16 +++++++++-------
 arch/arm64/Kconfig    | 27 ++++++++++++---------------
 arch/csky/Kconfig     |  4 ----
 arch/ia64/Kconfig     |  3 +--
 arch/m68k/Kconfig.cpu | 16 +++++++++-------
 arch/nios2/Kconfig    | 17 +++++++++--------
 arch/powerpc/Kconfig  | 22 +++++++++-------------
 arch/sh/mm/Kconfig    | 19 +++++++++----------
 arch/sparc/Kconfig    | 16 +++++++++-------
 arch/xtensa/Kconfig   | 16 +++++++++-------
 10 files changed, 76 insertions(+), 80 deletions(-)

base-commit: 51551d71edbc998fd8c8afa7312db3d270f5998e

Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/14 arm: reword ARCH_FORCE_MAX_ORDER prompt and help text

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/arm/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/arm/Kconfig +9 -7
index 929e646e84b9..0b15384c62e6 100644
@@ -1354,17 +1354,19 @@ config ARM_MODULE_PLTS
 	  configurations. If unsure, say y.
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
+	int "Order of maximal physically contiguous allocations"
 	default "11" if SOC_AM33XX
 	default "8" if SA1111
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
+
+	  Don't change if unsure.
 
 config ALIGNMENT_TRAP
 	def_bool CPU_CP15_MMU
Signature · 1 line
2.35.1
#2 lore raw

PATCH 2/14 arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

It is not a good idea to change fundamental parameters of core memory management. Having predefined ranges suggests that the values within those ranges are sensible, but one has to *really* understand implications of changing MAX_ORDER before actually amending it and ranges don't help here.

Drop ranges in definition of ARCH_FORCE_MAX_ORDER

---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/Kconfig +0 -2
index e60baf7859d1..bab6483e4317 100644
@@ -1489,9 +1489,7 @@ config XEN
 config ARCH_FORCE_MAX_ORDER
 	int "Maximum zone order" if ARM64_4K_PAGES || ARM64_16K_PAGES
 	default "13" if ARM64_64K_PAGES
-	range 11 13 if ARM64_16K_PAGES
 	default "11" if ARM64_16K_PAGES
-	range 10 15 if ARM64_4K_PAGES
 	default "10"
 	help
 	  The kernel memory allocator divides physically contiguous memory
Signature · 1 line
2.35.1
maintainer
#3 lore raw

Re: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

Quoted 20 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

It is not a good idea to change fundamental parameters of core memory management. Having predefined ranges suggests that the values within those ranges are sensible, but one has to *really* understand implications of changing MAX_ORDER before actually amending it and ranges don't help here.

Drop ranges in definition of ARCH_FORCE_MAX_ORDER

---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/Kconfig +0 -0
index e60baf7859d1..bab6483e4317 100644

arch/arm64/Kconfig config XEN · line 1493

Quoted 7 lines
arch/arm64/Kconfig +0 -2
@@ -1489,9 +1489,7 @@ config XEN
 config ARCH_FORCE_MAX_ORDER
 	int "Maximum zone order" if ARM64_4K_PAGES || ARM64_16K_PAGES
 	default "13" if ARM64_64K_PAGES
-	range 11 13 if ARM64_16K_PAGES
 	default "11" if ARM64_16K_PAGES
-	range 10 15 if ARM64_4K_PAGES
 	default "10"

I don't mind rewriting the help text as in the subsequent patch but I'd keep the ranges as a safety measure. It's less wasted time explaining to people why some random max order doesn't work. Alternatively, we can drop the ranges but make this option configurable only if EXPERT.

Signature · 1 line
Catalin
#4 lore raw

Re: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

Quoted 25 lines · Catalin Marinas
Quoted 24 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

It is not a good idea to change fundamental parameters of core memory management. Having predefined ranges suggests that the values within those ranges are sensible, but one has to *really* understand implications of changing MAX_ORDER before actually amending it and ranges don't help here.

Drop ranges in definition of ARCH_FORCE_MAX_ORDER

---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/Kconfig +0 -1
index e60baf7859d1..bab6483e4317 100644
@@ -1489,9 +1489,7 @@ config XEN
 config ARCH_FORCE_MAX_ORDER
 	int "Maximum zone order" if ARM64_4K_PAGES || ARM64_16K_PAGES
 	default "13" if ARM64_64K_PAGES
-	range 11 13 if ARM64_16K_PAGES
Quoted 8 lines

arch/arm64/Kconfig config XEN · line 1493

Quoted 3 lines
arch/arm64/Kconfig +0 -1
 	default "11" if ARM64_16K_PAGES
-	range 10 15 if ARM64_4K_PAGES
 	default "10"

I don't mind rewriting the help text as in the subsequent patch but I'd keep the ranges as a safety measure. It's less wasted time explaining to people why some random max order doesn't work. Alternatively, we can drop the ranges but make this option configurable only if EXPERT.

I like the EXPERT alternative more. I'll add it in v2.

Quoted 2 lines
Signature · 1 line
Catalin
Signature · 2 lines
Sincerely yours,
Mike.
#5 lore raw

Re: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

Quoted 35 lines · Mike Rapoport
Quoted 25 lines · Catalin Marinas
Quoted 24 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

It is not a good idea to change fundamental parameters of core memory management. Having predefined ranges suggests that the values within those ranges are sensible, but one has to *really* understand implications of changing MAX_ORDER before actually amending it and ranges don't help here.

Drop ranges in definition of ARCH_FORCE_MAX_ORDER

---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/Kconfig +0 -1
index e60baf7859d1..bab6483e4317 100644
@@ -1489,9 +1489,7 @@ config XEN
 config ARCH_FORCE_MAX_ORDER
 	int "Maximum zone order" if ARM64_4K_PAGES || ARM64_16K_PAGES
 	default "13" if ARM64_64K_PAGES
-	range 11 13 if ARM64_16K_PAGES
Quoted 8 lines

arch/arm64/Kconfig config XEN · line 1493

Quoted 3 lines
arch/arm64/Kconfig +0 -1
 	default "11" if ARM64_16K_PAGES
-	range 10 15 if ARM64_4K_PAGES
 	default "10"

I don't mind rewriting the help text as in the subsequent patch but I'd keep the ranges as a safety measure. It's less wasted time explaining to people why some random max order doesn't work. Alternatively, we can drop the ranges but make this option configurable only if EXPERT.

Quoted 1 line

I like the EXPERT alternative more. I'll add it in v2.

I got an error report from kernel test robot, which set -1 to ARCH_FORCE_MAX_ORDER via random config generator[1].

Does the EXPERT option prevent kernel test robot from generating such config? Or we should fix random config generator?

[1] https://lore.kernel.org/linux-mm/[email protected]/

--
Best Regards,
Yan, Zi

#6 lore raw

Re: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport
Thank you for the patch! Yet something to improve:

Hi Mike,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 51551d71edbc998fd8c8afa7312db3d270f5998e]

url:    https://github.com/intel-lab-lkp/linux/commits/Mike-Rapoport/arm-reword-ARCH_FORCE_MAX_ORDER-prompt-and-help-text/20230323-172512
base:   51551d71edbc998fd8c8afa7312db3d270f5998e
patch link:    https://lore.kernel.org/r/20230323092156.2545741-3-rppt%40kernel.org
patch subject: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER
config: arm64-randconfig-r022-20230322 (https://download.01.org/0day-ci/archive/20230323/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/0522f943c071abf1610651ea40405b7489c50987
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mike-Rapoport/arm-reword-ARCH_FORCE_MAX_ORDER-prompt-and-help-text/20230323-172512
git checkout 0522f943c071abf1610651ea40405b7489c50987
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/base/regmap/ drivers/iommu/ fs/proc/ mm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:25,

                    from mm/mm_init.c:9:
   mm/mm_init.c: In function 'find_zone_movable_pfns_for_nodes':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/math.h:61:25: note: in definition of macro 'roundup'
      61 |         typeof(y) __y = y;                              \
         |                         ^
   mm/mm_init.c:429:55: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     429 |                         roundup(required_movablecore, MAX_ORDER_NR_PAGES);
         |                                                       ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/math.h:61:25: note: in definition of macro 'roundup'
      61 |         typeof(y) __y = y;                              \
         |                         ^
   mm/mm_init.c:540:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     540 |                         roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES);
         |                                                        ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/gfp.h:7,
                    from include/linux/mm.h:7,
                    from mm/debug.c:10:
   mm/debug.c: In function '__dump_page':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   mm/debug.c:70:44: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
      70 |         if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) {
         |                                            ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/smp.h:12,
                    from include/linux/kernel_stat.h:5,
                    from mm/memory.c:42:
   mm/memory.c: In function 'clear_huge_page':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
      78 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   mm/memory.c:5791:44: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
    5791 |         if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
         |                                            ^~~~~~~~~~~~~~~~~~
   mm/memory.c: In function 'copy_user_huge_page':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
      78 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   mm/memory.c:5843:44: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
    5843 |         if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
         |                                            ^~~~~~~~~~~~~~~~~~
--
   mm/shuffle.c: In function '__shuffle_zone':
>> mm/shuffle.c:86:35: warning: left shift count is negative [-Wshift-count-negative]
      86 |         const int order_pages = 1 << order;
         |                                 ~~^~~~~~~~
--
   In file included from include/vdso/const.h:5,
                    from include/linux/const.h:4,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from mm/page_owner.c:2:
   mm/page_owner.c: In function 'pagetypeinfo_showmixedcount_print':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
      32 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_owner.c:298:31: note: in expansion of macro 'ALIGN'
     298 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                               ^~~~~
   mm/page_owner.c:298:46: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     298 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                                              ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/uapi/linux/const.h:32:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
      32 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_owner.c:298:31: note: in expansion of macro 'ALIGN'
     298 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                               ^~~~~
   mm/page_owner.c:298:46: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     298 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                                              ^~~~~~~~~~~~~~~~~~
   In file included from include/linux/gfp.h:7,
                    from include/linux/xarray.h:15,
                    from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13:
   mm/page_owner.c: In function 'read_page_owner':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   mm/page_owner.c:526:43: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     526 |         while (!pfn_valid(pfn) && (pfn & (MAX_ORDER_NR_PAGES - 1)) != 0)
         |                                           ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   mm/page_owner.c:543:29: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     543 |                 if ((pfn & (MAX_ORDER_NR_PAGES - 1)) = 0 && !pfn_valid(pfn)) {
         |                             ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   mm/page_owner.c:544:32: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     544 |                         pfn += MAX_ORDER_NR_PAGES - 1;
         |                                ^~~~~~~~~~~~~~~~~~
   mm/page_owner.c: In function 'init_pages_in_zone':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
      32 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_owner.c:636:31: note: in expansion of macro 'ALIGN'
     636 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                               ^~~~~
   mm/page_owner.c:636:46: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     636 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                                              ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/uapi/linux/const.h:32:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
      32 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_owner.c:636:31: note: in expansion of macro 'ALIGN'
     636 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                               ^~~~~
   mm/page_owner.c:636:46: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     636 |                         pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
         |                                              ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kernel.h:26,
                    from arch/arm64/include/asm/cpufeature.h:22,
                    from arch/arm64/include/asm/ptrace.h:11,
                    from arch/arm64/include/asm/irqflags.h:10,
                    from include/linux/irqflags.h:16,
                    from include/linux/spinlock.h:59,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/mm.h:7,
                    from mm/page_isolation.c:6:
   mm/page_isolation.c: In function 'isolate_single_pageblock':
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:28:27: note: in definition of macro '__cmp'
      28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
         |                           ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:28:27: note: in definition of macro '__cmp'
      28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
         |                           ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:28:27: note: in definition of macro '__cmp'
      28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
         |                           ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:28:40: note: in definition of macro '__cmp'
      28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
         |                                        ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:28:40: note: in definition of macro '__cmp'
      28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
         |                                        ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:28:40: note: in definition of macro '__cmp'
      28 | #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
         |                                        ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once'
      31 |                 typeof(x) unique_x = (x);               \
         |                                       ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once'
      31 |                 typeof(x) unique_x = (x);               \
         |                                       ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~
   mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                          ^~~~~~~~~~
   mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                                                        ^~~~~~~~~~~~~~~~~~
>> include/linux/mmzone.h:33:31: warning: left shift count is negative [-Wshift-count-negative]
      33 | #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
         |                               ^~
   include/linux/minmax.h:31:39: note: in definition of macro '__cmp_once'
      31 |                 typeof(x) unique_x = (x);               \
         |                                       ^
   include/linux/minmax.h:74:25: note: in expansion of macro '__careful_cmp'
      74 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   mm/page_isolation.c:329:22: note: in expansion of macro 'max'
     329 |         start_pfn  = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
         |                      ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:9:33: note: in expansion of macro '__ALIGN_KERNEL'
       9 | #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
         |                                 ^~~~~~~~~~~~~~

mm/page_isolation.c:329:26: note: in expansion of macro 'ALIGN_DOWN'
329 | start_pfn = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
| ^~~~~~~~~~
mm/page_isolation.c:329:56: note: in expansion of macro 'MAX_ORDER_NR_PAGES'
329 | start_pfn = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES),
| ^~~~~~~~~~~~~~~~~~
..

vim +16 include/linux/build_bug.h

bc6245e5efd70c Ian Abbott       2017-07-10   6  
bc6245e5efd70c Ian Abbott       2017-07-10   7  #ifdef __CHECKER__
bc6245e5efd70c Ian Abbott       2017-07-10   8  #define BUILD_BUG_ON_ZERO(e) (0)
bc6245e5efd70c Ian Abbott       2017-07-10   9  #else /* __CHECKER__ */
bc6245e5efd70c Ian Abbott       2017-07-10  10  /*
bc6245e5efd70c Ian Abbott       2017-07-10  11   * Force a compilation error if condition is true, but also produce a
8788994376d84d Rikard Falkeborn 2019-12-04  12   * result (of value 0 and type int), so the expression can be used
bc6245e5efd70c Ian Abbott       2017-07-10  13   * e.g. in a structure initializer (or where-ever else comma expressions
bc6245e5efd70c Ian Abbott       2017-07-10  14   * aren't permitted).
bc6245e5efd70c Ian Abbott       2017-07-10  15   */
8788994376d84d Rikard Falkeborn 2019-12-04 @16  #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
527edbc18a70e7 Masahiro Yamada  2019-01-03  17  #endif /* __CHECKER__ */
527edbc18a70e7 Masahiro Yamada  2019-01-03  18  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#7 lore raw

Re: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport
Thank you for the patch! Yet something to improve:

Hi Mike,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 51551d71edbc998fd8c8afa7312db3d270f5998e]

url:    https://github.com/intel-lab-lkp/linux/commits/Mike-Rapoport/arm-reword-ARCH_FORCE_MAX_ORDER-prompt-and-help-text/20230323-172512
base:   51551d71edbc998fd8c8afa7312db3d270f5998e
patch link:    https://lore.kernel.org/r/20230323092156.2545741-3-rppt%40kernel.org
patch subject: [PATCH 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER
config: arm64-randconfig-r031-20230322 (https://download.01.org/0day-ci/archive/20230324/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/0522f943c071abf1610651ea40405b7489c50987
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mike-Rapoport/arm-reword-ARCH_FORCE_MAX_ORDER-prompt-and-help-text/20230323-172512 git checkout 0522f943c071abf1610651ea40405b7489c50987
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/iommu/ kernel/dma/ mm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

>> mm/memory.c:5791:37: warning: shift count is negative [-Wshift-count-negative]
           if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
                                              ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
>> mm/memory.c:5791:37: warning: shift count is negative [-Wshift-count-negative]
           if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
                                              ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   mm/memory.c:5843:37: warning: shift count is negative [-Wshift-count-negative]
           if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
                                              ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   mm/memory.c:5843:37: warning: shift count is negative [-Wshift-count-negative]
           if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
                                              ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   4 warnings generated.
--
>> drivers/iommu/dma-iommu.c:739:16: error: anonymous bit-field has negative width (-1)
           order_mask &= GENMASK(MAX_ORDER, 0);
                         ^
   include/linux/bits.h:37:3: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
            ^
   include/linux/bits.h:23:3: note: expanded from macro 'GENMASK_INPUT_CHECK'
           (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
            ^
   include/linux/build_bug.h:16:53: note: expanded from macro 'BUILD_BUG_ON_ZERO'
   #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
                                                       ^
>> drivers/iommu/dma-iommu.c:739:16: warning: shift count >= width of type [-Wshift-count-overflow]
           order_mask &= GENMASK(MAX_ORDER, 0);
                         ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bits.h:37:31: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
                                        ^~~~~~~~~~~~~~~
   include/linux/bits.h:35:11: note: expanded from macro '__GENMASK'
            (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
                    ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 1 error generated.
--
>> kernel/dma/pool.c:197:39: warning: shift count is negative [-Wshift-count-negative]
                   pages = min_t(unsigned long, pages, MAX_ORDER_NR_PAGES);
                                                       ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/minmax.h:126:59: note: expanded from macro 'min_t'
   #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                                                   ^
   include/linux/minmax.h:37:12: note: expanded from macro '__careful_cmp'
                   __cmp(x, y, op), \
                            ^
   include/linux/minmax.h:28:34: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                                    ^
>> kernel/dma/pool.c:197:39: warning: shift count is negative [-Wshift-count-negative]
                   pages = min_t(unsigned long, pages, MAX_ORDER_NR_PAGES);
                                                       ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/minmax.h:126:59: note: expanded from macro 'min_t'
   #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                                                   ^
   include/linux/minmax.h:37:12: note: expanded from macro '__careful_cmp'
                   __cmp(x, y, op), \
                            ^
   include/linux/minmax.h:28:46: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                                                ^
>> kernel/dma/pool.c:197:39: warning: shift count is negative [-Wshift-count-negative]
                   pages = min_t(unsigned long, pages, MAX_ORDER_NR_PAGES);
                                                       ^~~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:33:31: note: expanded from macro 'MAX_ORDER_NR_PAGES'
   #define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
                                 ^  ~~~~~~~~~
   include/linux/minmax.h:126:59: note: expanded from macro 'min_t'
   #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                                                   ^
   include/linux/minmax.h:38:17: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                                 ^
   include/linux/minmax.h:32:25: note: expanded from macro '__cmp_once'
                   typeof(y) unique_y = (y);               \
                                         ^

3 warnings generated.

vim +739 drivers/iommu/dma-iommu.c

0db2e5d18f76a6 Robin Murphy        2015-10-01  732  
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  733  static struct page **__iommu_dma_alloc_pages(struct device *dev,
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  734  		unsigned int count, unsigned long order_mask, gfp_t gfp)
0db2e5d18f76a6 Robin Murphy        2015-10-01  735  {
0db2e5d18f76a6 Robin Murphy        2015-10-01  736  	struct page **pages;
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  737  	unsigned int i = 0, nid = dev_to_node(dev);
3b6b7e19e31a81 Robin Murphy        2016-04-13  738  
98d56389a5e38b Kirill A. Shutemov  2023-03-15 @739  	order_mask &= GENMASK(MAX_ORDER, 0);
3b6b7e19e31a81 Robin Murphy        2016-04-13  740  	if (!order_mask)
3b6b7e19e31a81 Robin Murphy        2016-04-13  741  		return NULL;
0db2e5d18f76a6 Robin Murphy        2015-10-01  742  
ab6f4b001c8c72 Gustavo A. R. Silva 2021-09-28  743  	pages = kvcalloc(count, sizeof(*pages), GFP_KERNEL);
0db2e5d18f76a6 Robin Murphy        2015-10-01  744  	if (!pages)
0db2e5d18f76a6 Robin Murphy        2015-10-01  745  		return NULL;
0db2e5d18f76a6 Robin Murphy        2015-10-01  746  
0db2e5d18f76a6 Robin Murphy        2015-10-01  747  	/* IOMMU can map any pages, so himem can also be used here */
0db2e5d18f76a6 Robin Murphy        2015-10-01  748  	gfp |= __GFP_NOWARN | __GFP_HIGHMEM;
0db2e5d18f76a6 Robin Murphy        2015-10-01  749  
0db2e5d18f76a6 Robin Murphy        2015-10-01  750  	while (count) {
0db2e5d18f76a6 Robin Murphy        2015-10-01  751  		struct page *page = NULL;
3b6b7e19e31a81 Robin Murphy        2016-04-13  752  		unsigned int order_size;
0db2e5d18f76a6 Robin Murphy        2015-10-01  753  
0db2e5d18f76a6 Robin Murphy        2015-10-01  754  		/*
0db2e5d18f76a6 Robin Murphy        2015-10-01  755  		 * Higher-order allocations are a convenience rather
0db2e5d18f76a6 Robin Murphy        2015-10-01  756  		 * than a necessity, hence using __GFP_NORETRY until
3b6b7e19e31a81 Robin Murphy        2016-04-13  757  		 * falling back to minimum-order allocations.
0db2e5d18f76a6 Robin Murphy        2015-10-01  758  		 */
a706e6e10225fb Kirill A. Shutemov  2023-03-15  759  		for (order_mask &= GENMASK(__fls(count), 0);
3b6b7e19e31a81 Robin Murphy        2016-04-13  760  		     order_mask; order_mask &= ~order_size) {
3b6b7e19e31a81 Robin Murphy        2016-04-13  761  			unsigned int order = __fls(order_mask);
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  762  			gfp_t alloc_flags = gfp;
3b6b7e19e31a81 Robin Murphy        2016-04-13  763  
3b6b7e19e31a81 Robin Murphy        2016-04-13  764  			order_size = 1U << order;
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  765  			if (order_mask > order_size)
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  766  				alloc_flags |= __GFP_NORETRY;
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  767  			page = alloc_pages_node(nid, alloc_flags, order);
0db2e5d18f76a6 Robin Murphy        2015-10-01  768  			if (!page)
0db2e5d18f76a6 Robin Murphy        2015-10-01  769  				continue;
4604393ca0c6e4 Robin Murphy        2020-09-03  770  			if (order)
0db2e5d18f76a6 Robin Murphy        2015-10-01  771  				split_page(page, order);
0db2e5d18f76a6 Robin Murphy        2015-10-01  772  			break;
0db2e5d18f76a6 Robin Murphy        2015-10-01  773  		}
0db2e5d18f76a6 Robin Murphy        2015-10-01  774  		if (!page) {
0db2e5d18f76a6 Robin Murphy        2015-10-01  775  			__iommu_dma_free_pages(pages, i);
0db2e5d18f76a6 Robin Murphy        2015-10-01  776  			return NULL;
0db2e5d18f76a6 Robin Murphy        2015-10-01  777  		}
3b6b7e19e31a81 Robin Murphy        2016-04-13  778  		count -= order_size;
3b6b7e19e31a81 Robin Murphy        2016-04-13  779  		while (order_size--)
0db2e5d18f76a6 Robin Murphy        2015-10-01  780  			pages[i++] = page++;
0db2e5d18f76a6 Robin Murphy        2015-10-01  781  	}
0db2e5d18f76a6 Robin Murphy        2015-10-01  782  	return pages;
0db2e5d18f76a6 Robin Murphy        2015-10-01  783  }
0db2e5d18f76a6 Robin Murphy        2015-10-01  784  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#8 lore raw

PATCH 3/14 arm64: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/arm64/Kconfig | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
arch/arm64/Kconfig +12 -13
index bab6483e4317..75af4c329224 100644
@@ -1487,24 +1487,24 @@ config XEN
 # 16K |       27          |      14      |       13        |         11         |
 # 64K |       29          |      16      |       13        |         13         |
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order" if ARM64_4K_PAGES || ARM64_16K_PAGES
+	int "Order of maximal physically contiguous allocations" if ARM64_4K_PAGES || ARM64_16K_PAGES
 	default "13" if ARM64_64K_PAGES
 	default "11" if ARM64_16K_PAGES
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
 
-	  We make sure that we can allocate up to a HugePage size for each configuration.
-	  Hence we have :
-		MAX_ORDER = PMD_SHIFT - PAGE_SHIFT  => PAGE_SHIFT - 3
+	  The maximal size of allocation cannot exceed the size of the
+	  section, so the value of MAX_ORDER should satisfy
 
-	  However for 4K, we choose a higher default value, 10 as opposed to 9, giving us
-	  4M allocations matching the default size used by generic code.
+	    MAX_ORDER + PAGE_SHIFT <= SECTION_SIZE_BITS
+
+	  Don't change if unsure.
 
 config UNMAP_KERNEL_AT_EL0
 	bool "Unmap kernel when running in userspace (aka \"KAISER\")" if EXPERT
@@ -2298,4 +2298,3 @@ endmenu # "CPU Power Management"
 source "drivers/acpi/Kconfig"
 
 source "arch/arm64/kvm/Kconfig"
-
Signature · 1 line
2.35.1
#10 lore raw

PATCH 4/14 csky: drop ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The default value of ARCH_FORCE_MAX_ORDER matches the generic default defined in the MM code, the architecture does not support huge pages, so there is no need to keep ARCH_FORCE_MAX_ORDER option available.

Drop it.

---
 arch/csky/Kconfig | 4 ----
 1 file changed, 4 deletions(-)
arch/csky/Kconfig +0 -4
index c694fac43bed..00379a843c37 100644
@@ -332,10 +332,6 @@ config HIGHMEM
 	select KMAP_LOCAL
 	default y
 
-config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
-	default "10"
-
 config DRAM_BASE
 	hex "DRAM start addr (the same with memory-section in dts)"
 	default 0x0
Signature · 1 line
2.35.1
#11 lore raw

PATCH 5/14 ia64: don't allow users to override ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

It is enough to keep default values for base and huge pages without letting users to override ARCH_FORCE_MAX_ORDER.

Drop the prompt to make the option unvisible in *config.

---
 arch/ia64/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/ia64/Kconfig +1 -2
index 0d2f41fa56ee..b61437cae162 100644
@@ -202,8 +202,7 @@ config IA64_CYCLONE
 	  If you're unsure, answer N.
 
 config ARCH_FORCE_MAX_ORDER
-	int "MAX_ORDER (10 - 16)"  if !HUGETLB_PAGE
-	range 10 16  if !HUGETLB_PAGE
+	int
 	default "16" if HUGETLB_PAGE
 	default "10"
 
Signature · 1 line
2.35.1
#12 lore raw

PATCH 6/14 m68k: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/m68k/Kconfig.cpu | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/m68k/Kconfig.cpu +9 -7
index c9df6572133f..e530bc8f240f 100644
@@ -398,21 +398,23 @@ config SINGLE_MEMORY_CHUNK
 	  Say N if not sure.
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order" if ADVANCED
+	int "Order of maximal physically contiguous allocations" if ADVANCED
 	depends on !SINGLE_MEMORY_CHUNK
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
 
 	  For systems that have holes in their physical address space this
 	  value also defines the minimal size of the hole that allows
 	  freeing unused memory map.
 
+	  Don't change if unsure.
+
 config 060_WRITETHROUGH
 	bool "Use write-through caching for 68060 supervisor accesses"
 	depends on ADVANCED && M68060
Signature · 1 line
2.35.1
maintainer Acked-by on v1 6/14
#13 lore raw

Re: [PATCH 06/14] m68k: reword ARCH_FORCE_MAX_ORDER prompt and help text

Quoted 8 lines · On Thu, Mar 23, 2023 at 10:23 AM Mike Rapoport <[email protected]> wrote:

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#14 lore raw

PATCH 7/14 nios2: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/nios2/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/nios2/Kconfig +9 -7
index 89708b95978c..fcaa6bbda3fc 100644
@@ -45,16 +45,18 @@ menu "Kernel features"
 source "kernel/Kconfig.hz"
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
+	int "Order of maximal physically contiguous allocations"
 	range 8 19
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
+
+	  Don't change if unsure.
 
 endmenu
 
Signature · 1 line
2.35.1
#15 lore raw

PATCH 8/14 nios2: drop ranges for definition of ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

nios2 defines range for ARCH_FORCE_MAX_ORDER allowing MAX_ORDER up to 19, which implies maximal contiguous allocation size of 2^19 pages or 2GiB.

Drop bogus definition of ranges for ARCH_FORCE_MAX_ORDER and leave it a simple integer with sensible default.

Users that *really* need to change the value of ARCH_FORCE_MAX_ORDER will be able to do so but they won't be mislead by the bogus ranges.

---
 arch/nios2/Kconfig | 1 -
 1 file changed, 1 deletion(-)
arch/nios2/Kconfig +0 -1
index fcaa6bbda3fc..e5936417d3cd 100644
@@ -46,7 +46,6 @@ source "kernel/Kconfig.hz"
 
 config ARCH_FORCE_MAX_ORDER
 	int "Order of maximal physically contiguous allocations"
-	range 8 19
 	default "10"
 	help
 	  The kernel page allocator limits the size of maximal physically
Signature · 1 line
2.35.1
#16 lore raw

PATCH 9/14 powerpc: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/powerpc/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/powerpc/Kconfig +9 -7
index 24d56536b269..c0095bf795ca 100644
@@ -896,7 +896,7 @@ config DATA_SHIFT
 	  8M pages will be pinned.
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
+	int "Order of maximal physically contiguous allocations"
 	range 7 8 if PPC64 && PPC_64K_PAGES
 	default "8" if PPC64 && PPC_64K_PAGES
 	range 12 12 if PPC64 && !PPC_64K_PAGES
@@ -910,17 +910,19 @@ config ARCH_FORCE_MAX_ORDER
 	range 10 63
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
 
 	  The page size is not necessarily 4KB.  For example, on 64-bit
 	  systems, 64KB pages can be enabled via CONFIG_PPC_64K_PAGES.  Keep
 	  this in mind when choosing a value for this option.
 
+	  Don't change if unsure.
+
 config PPC_SUBPAGE_PROT
 	bool "Support setting protections for 4k subpages (subpage_prot syscall)"
 	default n
Signature · 1 line
2.35.1
#17 lore raw

PATCH 10/14 powerpc: drop ranges for definition of ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

PowerPC defines ranges for ARCH_FORCE_MAX_ORDER some of which are insanely allowing MAX_ORDER up to 63, which implies maximal contiguous allocation size of 2^63 pages.

Drop bogus definitions of ranges for ARCH_FORCE_MAX_ORDER and leave it a simple integer with sensible defaults.

Users that *really* need to change the value of ARCH_FORCE_MAX_ORDER will be able to do so but they won't be mislead by the bogus ranges.

---
 arch/powerpc/Kconfig | 6 ------
 1 file changed, 6 deletions(-)
arch/powerpc/Kconfig +0 -6
index c0095bf795ca..419be4a71004 100644
@@ -897,17 +897,11 @@ config DATA_SHIFT
 
 config ARCH_FORCE_MAX_ORDER
 	int "Order of maximal physically contiguous allocations"
-	range 7 8 if PPC64 && PPC_64K_PAGES
 	default "8" if PPC64 && PPC_64K_PAGES
-	range 12 12 if PPC64 && !PPC_64K_PAGES
 	default "12" if PPC64 && !PPC_64K_PAGES
-	range 8 63 if PPC32 && PPC_16K_PAGES
 	default "8" if PPC32 && PPC_16K_PAGES
-	range 6 63 if PPC32 && PPC_64K_PAGES
 	default "6" if PPC32 && PPC_64K_PAGES
-	range 4 63 if PPC32 && PPC_256K_PAGES
 	default "4" if PPC32 && PPC_256K_PAGES
-	range 10 63
 	default "10"
 	help
 	  The kernel page allocator limits the size of maximal physically
Signature · 1 line
2.35.1
#18 lore raw

PATCH 11/14 sh: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/sh/mm/Kconfig | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
arch/sh/mm/Kconfig +9 -8
index 40271090bd7d..fb15ba1052ba 100644
@@ -19,8 +19,7 @@ config PAGE_OFFSET
 	default "0x00000000"
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
-	range 8 63 if PAGE_SIZE_16KB
+	int "Order of maximal physically contiguous allocations"
 	default "8" if PAGE_SIZE_16KB
 	range 6 63 if PAGE_SIZE_64KB
 	default "6" if PAGE_SIZE_64KB
@@ -28,16 +27,18 @@ config ARCH_FORCE_MAX_ORDER
 	default "13" if !MMU
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
 
 	  The page size is not necessarily 4KB. Keep this in mind when
 	  choosing a value for this option.
 
+	  Don't change if unsure.
+
 config MEMORY_START
 	hex "Physical memory start address"
 	default "0x08000000"
Signature · 1 line
2.35.1
#19 lore raw

PATCH 12/14 sh: drop ranges for definition of ARCH_FORCE_MAX_ORDER

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

sh defines insane ranges for ARCH_FORCE_MAX_ORDER allowing MAX_ORDER up to 63, which implies maximal contiguous allocation size of 2^63 pages.

Drop bogus definitions of ranges for ARCH_FORCE_MAX_ORDER and leave it a simple integer with sensible defaults.

Users that *really* need to change the value of ARCH_FORCE_MAX_ORDER will be able to do so but they won't be mislead by the bogus ranges.

---
 arch/sh/mm/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/sh/mm/Kconfig +0 -2
index fb15ba1052ba..511c17aede4a 100644
@@ -21,9 +21,7 @@ config PAGE_OFFSET
 config ARCH_FORCE_MAX_ORDER
 	int "Order of maximal physically contiguous allocations"
 	default "8" if PAGE_SIZE_16KB
-	range 6 63 if PAGE_SIZE_64KB
 	default "6" if PAGE_SIZE_64KB
-	range 10 63
 	default "13" if !MMU
 	default "10"
 	help
Signature · 1 line
2.35.1
#20 lore raw

PATCH 13/14 sparc: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/sparc/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/sparc/Kconfig +9 -7
index e3242bf5a8df..959e43a1aaca 100644
@@ -270,15 +270,17 @@ config ARCH_SPARSEMEM_DEFAULT
 	def_bool y if SPARC64
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
+	int "Order of maximal physically contiguous allocations"
 	default "12"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
+
+	  Don't change if unsure.
 
 if SPARC64 || COMPILE_TEST
 source "kernel/power/Kconfig"
Signature · 1 line
2.35.1
#21 lore raw

PATCH 14/14 xtensa: reword ARCH_FORCE_MAX_ORDER prompt and help text

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Update both to actually describe what this option does.

---
 arch/xtensa/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/xtensa/Kconfig +9 -7
index 3eee334ba873..3c6e5471f025 100644
@@ -772,15 +772,17 @@ config HIGHMEM
 	  If unsure, say Y.
 
 config ARCH_FORCE_MAX_ORDER
-	int "Maximum zone order"
+	int "Order of maximal physically contiguous allocations"
 	default "10"
 	help
-	  The kernel memory allocator divides physically contiguous memory
-	  blocks into "zones", where each zone is a power of two number of
-	  pages.  This option selects the largest power of two that the kernel
-	  keeps in the memory allocator.  If you need to allocate very large
-	  blocks of physically contiguous memory, then you may need to
-	  increase this value.
+	  The kernel page allocator limits the size of maximal physically
+	  contiguous allocations. The limit is called MAX_ORDER and it
+	  defines the maximal power of two of number of pages that can be
+	  allocated as a single contiguous block. This option allows
+	  overriding the default setting when ability to allocate very
+	  large blocks of physically contiguous memory is required.
+
+	  Don't change if unsure.
 
 endmenu
 
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 14/14
#22 lore raw

Re: [PATCH 14/14] xtensa: reword ARCH_FORCE_MAX_ORDER prompt and help text

Quoted 6 lines · On Thu, Mar 23, 2023 at 2:24 AM Mike Rapoport <[email protected]> wrote:

From: "Mike Rapoport (IBM)" <[email protected]>

The prompt and help text of ARCH_FORCE_MAX_ORDER are not even close to describe this configuration option.

Quoted 6 lines

Update both to actually describe what this option does.

---
 arch/xtensa/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
Signature · 2 lines
Thanks.
-- Max
Acked-by on the v1 series
#23 lore raw
In reply to Mike Rapoport
Quoted 31 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

Hi,

Several architectures have ARCH_FORCE_MAX_ORDER in their Kconfig and they all have wrong and misleading prompt and help text for this option.

Besides, some define insane limits for possible values of ARCH_FORCE_MAX_ORDER, some carefully define ranges only for a subset of possible configurations, some make this option configurable by users for no good reason.

This set updates the prompt and help text everywhere and does its best to update actual definitions of ranges where applicable.

Mike Rapoport (IBM) (14):
arm: reword ARCH_FORCE_MAX_ORDER prompt and help text
arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER
arm64: reword ARCH_FORCE_MAX_ORDER prompt and help text
csky: drop ARCH_FORCE_MAX_ORDER
ia64: don't allow users to override ARCH_FORCE_MAX_ORDER
m68k: reword ARCH_FORCE_MAX_ORDER prompt and help text
nios2: reword ARCH_FORCE_MAX_ORDER prompt and help text
nios2: drop ranges for definition of ARCH_FORCE_MAX_ORDER
powerpc: reword ARCH_FORCE_MAX_ORDER prompt and help text
powerpc: drop ranges for definition of ARCH_FORCE_MAX_ORDER
sh: reword ARCH_FORCE_MAX_ORDER prompt and help text
sh: drop ranges for definition of ARCH_FORCE_MAX_ORDER
sparc: reword ARCH_FORCE_MAX_ORDER prompt and help text
xtensa: reword ARCH_FORCE_MAX_ORDER prompt and help text

Quoted 11 lines
 arch/arm/Kconfig      | 16 +++++++++-------
 arch/arm64/Kconfig    | 27 ++++++++++++---------------
 arch/csky/Kconfig     |  4 ----
 arch/ia64/Kconfig     |  3 +--
 arch/m68k/Kconfig.cpu | 16 +++++++++-------
 arch/nios2/Kconfig    | 17 +++++++++--------
 arch/powerpc/Kconfig  | 22 +++++++++-------------
 arch/sh/mm/Kconfig    | 19 +++++++++----------
 arch/sparc/Kconfig    | 16 +++++++++-------
 arch/xtensa/Kconfig   | 16 +++++++++-------
 10 files changed, 76 insertions(+), 80 deletions(-)
Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov