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

2023-03-23 Thread kernel test robot
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/202303240155.01y6t6fj-...@intel.com/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 
| Link: 
https://lore.kernel.org/oe-kbuild-all/202303240155.01y6t6fj-...@intel.com/

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'

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

2023-03-23 Thread kernel test robot
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/202303232149.chh6khii-...@intel.com/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 
| Link: 
https://lore.kernel.org/oe-kbuild-all/202303232149.chh6khii-...@intel.com/

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

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

2023-03-23 Thread Zi Yan
On 23 Mar 2023, at 6:37, Mike Rapoport wrote:

> On Thu, Mar 23, 2023 at 10:15:33AM +, Catalin Marinas wrote:
>> On Thu, Mar 23, 2023 at 11:21:44AM +0200, Mike Rapoport wrote:
>>> From: "Mike Rapoport (IBM)" 
>>>
>>> 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
>>>
>>> Signed-off-by: Mike Rapoport (IBM) 
>>> ---
>>>  arch/arm64/Kconfig | 2 --
>>>  1 file changed, 2 deletions(-)
>>>
>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>> index e60baf7859d1..bab6483e4317 100644
>>> --- a/arch/arm64/Kconfig
>>> +++ b/arch/arm64/Kconfig
>>> @@ -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.
>
> 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/91e887e4-0867-421f-9c75-fb9cff15c...@nvidia.com/


--
Best Regards,
Yan, Zi


signature.asc
Description: OpenPGP digital signature


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

2023-03-23 Thread Mike Rapoport
On Thu, Mar 23, 2023 at 10:15:33AM +, Catalin Marinas wrote:
> On Thu, Mar 23, 2023 at 11:21:44AM +0200, Mike Rapoport wrote:
> > From: "Mike Rapoport (IBM)" 
> > 
> > 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
> > 
> > Signed-off-by: Mike Rapoport (IBM) 
> > ---
> >  arch/arm64/Kconfig | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index e60baf7859d1..bab6483e4317 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -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.

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

-- 
Sincerely yours,
Mike.


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

2023-03-23 Thread Catalin Marinas
On Thu, Mar 23, 2023 at 11:21:44AM +0200, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" 
> 
> 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
> 
> Signed-off-by: Mike Rapoport (IBM) 
> ---
>  arch/arm64/Kconfig | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index e60baf7859d1..bab6483e4317 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -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.

-- 
Catalin


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

2023-03-23 Thread Mike Rapoport
From: "Mike Rapoport (IBM)" 

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

Signed-off-by: Mike Rapoport (IBM) 
---
 arch/arm64/Kconfig | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e60baf7859d1..bab6483e4317 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -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
-- 
2.35.1