linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative
@ 2025-05-09  7:48 kernel test robot
  2025-05-09 20:43 ` Juan Yescas
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2025-05-09  7:48 UTC (permalink / raw)
  To: Juan Yescas; +Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head:   930c125f685d7e8eef566fcd563390b76a28d824
commit: 16994f2b09a22523885d371caa59f17999686805 [333/334] mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order
config: powerpc64-randconfig-003-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505091548.FuKO4b4v-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/vdso/const.h:5,
                    from include/linux/const.h:4,
                    from include/linux/bits.h:5,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:22,
                    from arch/powerpc/include/asm/bug.h:116,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:6,
                    from mm/sparse.c:5:
   mm/sparse.c: In function 'usemap_size':
>> include/linux/mmzone.h:1816:8: warning: left shift count is negative [-Wshift-count-negative]
    1816 |  ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
         |        ^~
   include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
      51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
         |                                        ^
   mm/sparse.c:301:9: note: in expansion of macro 'BITS_TO_LONGS'
     301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
         |         ^~~~~~~~~~~~~
   mm/sparse.c:301:23: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
     301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
         |                       ^~~~~~~~~~~~~~~~~~~~~~~


vim +1816 include/linux/mmzone.h

d41dee369bff3b Andy Whitcroft 2005-06-23  1814  
835c134ec4dd75 Mel Gorman     2007-10-16  1815  #define SECTION_BLOCKFLAGS_BITS \
d9c2340052278d Mel Gorman     2007-10-16 @1816  	((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
835c134ec4dd75 Mel Gorman     2007-10-16  1817  

:::::: The code at line 1816 was first introduced by commit
:::::: d9c2340052278d8eb2ffb16b0484f8f794def4de Do not depend on MAX_ORDER when grouping pages by mobility

:::::: TO: Mel Gorman <mel@csn.ul.ie>
:::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative
  2025-05-09  7:48 [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative kernel test robot
@ 2025-05-09 20:43 ` Juan Yescas
  2025-05-12  1:10   ` Philip Li
  0 siblings, 1 reply; 4+ messages in thread
From: Juan Yescas @ 2025-05-09 20:43 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List

On Fri, May 9, 2025 at 12:49 AM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> head:   930c125f685d7e8eef566fcd563390b76a28d824
> commit: 16994f2b09a22523885d371caa59f17999686805 [333/334] mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order
> config: powerpc64-randconfig-003-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
> compiler: powerpc64-linux-gcc (GCC) 10.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202505091548.FuKO4b4v-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>    In file included from include/vdso/const.h:5,
>                     from include/linux/const.h:4,
>                     from include/linux/bits.h:5,
>                     from include/linux/ratelimit_types.h:5,
>                     from include/linux/printk.h:9,
>                     from include/asm-generic/bug.h:22,
>                     from arch/powerpc/include/asm/bug.h:116,
>                     from include/linux/bug.h:5,
>                     from include/linux/mmdebug.h:5,
>                     from include/linux/mm.h:6,
>                     from mm/sparse.c:5:
>    mm/sparse.c: In function 'usemap_size':
> >> include/linux/mmzone.h:1816:8: warning: left shift count is negative [-Wshift-count-negative]
>     1816 |  ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
>          |        ^~
>    include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
>       51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
>          |                                        ^
>    mm/sparse.c:301:9: note: in expansion of macro 'BITS_TO_LONGS'
>      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
>          |         ^~~~~~~~~~~~~
>    mm/sparse.c:301:23: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
>      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
>          |                       ^~~~~~~~~~~~~~~~~~~~~~~
>
>
> vim +1816 include/linux/mmzone.h
>
> d41dee369bff3b Andy Whitcroft 2005-06-23  1814
> 835c134ec4dd75 Mel Gorman     2007-10-16  1815  #define SECTION_BLOCKFLAGS_BITS \
> d9c2340052278d Mel Gorman     2007-10-16 @1816          ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
> 835c134ec4dd75 Mel Gorman     2007-10-16  1817
>

Thanks for testing,

The reason for the warning is because CONFIG_PAGE_BLOCK_ORDER >
CONFIG_ARCH_FORCE_MAX_ORDER.

This config: powerpc64-randconfig-003-20250509
(https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)

is not respecting the range config below. Should the test make sure
that the ranges are valid?

config PAGE_BLOCK_ORDER
int "Page Block Order"
range 1 10 if !ARCH_FORCE_MAX_ORDER
default 10 if !ARCH_FORCE_MAX_ORDER
range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER
default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER

I can add a check in include/linux/pageblock-flags.h

/*
 * The PAGE_BLOCK_ORDER, which defines the order for the number of pages
 * that can have a migrate type, must be less or equal to the MAX_PAGE_ORDER,
 * which defines the max order of pages to be allocated by the buddy allocator.
 */
BUILD_BUG_ON_MSG(PAGE_BLOCK_ORDER > MAX_PAGE_ORDER,
        "MAX_PAGE_ORDER must be >= PAGE_BLOCK_ORDER");

Is there any preference?

> :::::: The code at line 1816 was first introduced by commit
> :::::: d9c2340052278d8eb2ffb16b0484f8f794def4de Do not depend on MAX_ORDER when grouping pages by mobility
>
> :::::: TO: Mel Gorman <mel@csn.ul.ie>
> :::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative
  2025-05-09 20:43 ` Juan Yescas
@ 2025-05-12  1:10   ` Philip Li
  2025-05-12 19:06     ` Juan Yescas
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Li @ 2025-05-12  1:10 UTC (permalink / raw)
  To: Juan Yescas
  Cc: kernel test robot, oe-kbuild-all, Andrew Morton,
	Linux Memory Management List

On Fri, May 09, 2025 at 01:43:33PM -0700, Juan Yescas wrote:
> On Fri, May 9, 2025 at 12:49 AM kernel test robot <lkp@intel.com> wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> > head:   930c125f685d7e8eef566fcd563390b76a28d824
> > commit: 16994f2b09a22523885d371caa59f17999686805 [333/334] mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order
> > config: powerpc64-randconfig-003-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
> > compiler: powerpc64-linux-gcc (GCC) 10.5.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202505091548.FuKO4b4v-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> >    In file included from include/vdso/const.h:5,
> >                     from include/linux/const.h:4,
> >                     from include/linux/bits.h:5,
> >                     from include/linux/ratelimit_types.h:5,
> >                     from include/linux/printk.h:9,
> >                     from include/asm-generic/bug.h:22,
> >                     from arch/powerpc/include/asm/bug.h:116,
> >                     from include/linux/bug.h:5,
> >                     from include/linux/mmdebug.h:5,
> >                     from include/linux/mm.h:6,
> >                     from mm/sparse.c:5:
> >    mm/sparse.c: In function 'usemap_size':
> > >> include/linux/mmzone.h:1816:8: warning: left shift count is negative [-Wshift-count-negative]
> >     1816 |  ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
> >          |        ^~
> >    include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
> >       51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> >          |                                        ^
> >    mm/sparse.c:301:9: note: in expansion of macro 'BITS_TO_LONGS'
> >      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
> >          |         ^~~~~~~~~~~~~
> >    mm/sparse.c:301:23: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
> >      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
> >          |                       ^~~~~~~~~~~~~~~~~~~~~~~
> >
> >
> > vim +1816 include/linux/mmzone.h
> >
> > d41dee369bff3b Andy Whitcroft 2005-06-23  1814
> > 835c134ec4dd75 Mel Gorman     2007-10-16  1815  #define SECTION_BLOCKFLAGS_BITS \
> > d9c2340052278d Mel Gorman     2007-10-16 @1816          ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
> > 835c134ec4dd75 Mel Gorman     2007-10-16  1817
> >
> 
> Thanks for testing,
> 
> The reason for the warning is because CONFIG_PAGE_BLOCK_ORDER >
> CONFIG_ARCH_FORCE_MAX_ORDER.
> 
> This config: powerpc64-randconfig-003-20250509
> (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
> 
> is not respecting the range config below. Should the test make sure
> that the ranges are valid?

Thanks for the information, I will check the bot side to resolve the problem.

Sorry for the false positive.

> 
> config PAGE_BLOCK_ORDER
> int "Page Block Order"
> range 1 10 if !ARCH_FORCE_MAX_ORDER
> default 10 if !ARCH_FORCE_MAX_ORDER
> range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER
> default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER
> 
> I can add a check in include/linux/pageblock-flags.h
> 
> /*
>  * The PAGE_BLOCK_ORDER, which defines the order for the number of pages
>  * that can have a migrate type, must be less or equal to the MAX_PAGE_ORDER,
>  * which defines the max order of pages to be allocated by the buddy allocator.
>  */
> BUILD_BUG_ON_MSG(PAGE_BLOCK_ORDER > MAX_PAGE_ORDER,
>         "MAX_PAGE_ORDER must be >= PAGE_BLOCK_ORDER");
> 
> Is there any preference?
> 
> > :::::: The code at line 1816 was first introduced by commit
> > :::::: d9c2340052278d8eb2ffb16b0484f8f794def4de Do not depend on MAX_ORDER when grouping pages by mobility
> >
> > :::::: TO: Mel Gorman <mel@csn.ul.ie>
> > :::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative
  2025-05-12  1:10   ` Philip Li
@ 2025-05-12 19:06     ` Juan Yescas
  0 siblings, 0 replies; 4+ messages in thread
From: Juan Yescas @ 2025-05-12 19:06 UTC (permalink / raw)
  To: Philip Li
  Cc: kernel test robot, oe-kbuild-all, Andrew Morton,
	Linux Memory Management List

On Sun, May 11, 2025 at 6:10 PM Philip Li <philip.li@intel.com> wrote:
>
> On Fri, May 09, 2025 at 01:43:33PM -0700, Juan Yescas wrote:
> > On Fri, May 9, 2025 at 12:49 AM kernel test robot <lkp@intel.com> wrote:
> > >
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> > > head:   930c125f685d7e8eef566fcd563390b76a28d824
> > > commit: 16994f2b09a22523885d371caa59f17999686805 [333/334] mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order
> > > config: powerpc64-randconfig-003-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
> > > compiler: powerpc64-linux-gcc (GCC) 10.5.0
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202505091548.FuKO4b4v-lkp@intel.com/
> > >
> > > All warnings (new ones prefixed by >>):
> > >
> > >    In file included from include/vdso/const.h:5,
> > >                     from include/linux/const.h:4,
> > >                     from include/linux/bits.h:5,
> > >                     from include/linux/ratelimit_types.h:5,
> > >                     from include/linux/printk.h:9,
> > >                     from include/asm-generic/bug.h:22,
> > >                     from arch/powerpc/include/asm/bug.h:116,
> > >                     from include/linux/bug.h:5,
> > >                     from include/linux/mmdebug.h:5,
> > >                     from include/linux/mm.h:6,
> > >                     from mm/sparse.c:5:
> > >    mm/sparse.c: In function 'usemap_size':
> > > >> include/linux/mmzone.h:1816:8: warning: left shift count is negative [-Wshift-count-negative]
> > >     1816 |  ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
> > >          |        ^~
> > >    include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
> > >       51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> > >          |                                        ^
> > >    mm/sparse.c:301:9: note: in expansion of macro 'BITS_TO_LONGS'
> > >      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
> > >          |         ^~~~~~~~~~~~~
> > >    mm/sparse.c:301:23: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
> > >      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
> > >          |                       ^~~~~~~~~~~~~~~~~~~~~~~
> > >
> > >
> > > vim +1816 include/linux/mmzone.h
> > >
> > > d41dee369bff3b Andy Whitcroft 2005-06-23  1814
> > > 835c134ec4dd75 Mel Gorman     2007-10-16  1815  #define SECTION_BLOCKFLAGS_BITS \
> > > d9c2340052278d Mel Gorman     2007-10-16 @1816          ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
> > > 835c134ec4dd75 Mel Gorman     2007-10-16  1817
> > >
> >
> > Thanks for testing,
> >
> > The reason for the warning is because CONFIG_PAGE_BLOCK_ORDER >
> > CONFIG_ARCH_FORCE_MAX_ORDER.
> >
> > This config: powerpc64-randconfig-003-20250509
> > (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
> >
> > is not respecting the range config below. Should the test make sure
> > that the ranges are valid?
>
> Thanks for the information, I will check the bot side to resolve the problem.
>
> Sorry for the false positive.
>
Thanks Philip,

I tried to reproduce the issue in an ARM64 build by modifying the
.config manually

 $ vim .config
 $ cat .config | grep MAX_ORDER
CONFIG_ARCH_FORCE_MAX_ORDER=8
 $ cat .config | grep PAGE_BLOCK
CONFIG_PAGE_BLOCK_ORDER=10
 $ make -j40 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
  CALL    scripts/checksyscalls.sh

However, after I built the kernel, the CONFIG_PAGE_BLOCK_ORDER got
overridden with
a valid value.

 $ cat .config | grep MAX_ORDER
CONFIG_ARCH_FORCE_MAX_ORDER=10
 $ cat .config | grep PAGE_BLOCK
CONFIG_PAGE_BLOCK_ORDER=10

Is there a parameter or configuration in the test that indicates not
to fix the .config files?


> >
> > config PAGE_BLOCK_ORDER
> > int "Page Block Order"
> > range 1 10 if !ARCH_FORCE_MAX_ORDER
> > default 10 if !ARCH_FORCE_MAX_ORDER
> > range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER
> > default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER
> >
> > I can add a check in include/linux/pageblock-flags.h
> >
> > /*
> >  * The PAGE_BLOCK_ORDER, which defines the order for the number of pages
> >  * that can have a migrate type, must be less or equal to the MAX_PAGE_ORDER,
> >  * which defines the max order of pages to be allocated by the buddy allocator.
> >  */
> > BUILD_BUG_ON_MSG(PAGE_BLOCK_ORDER > MAX_PAGE_ORDER,
> >         "MAX_PAGE_ORDER must be >= PAGE_BLOCK_ORDER");
> >
> > Is there any preference?
> >
> > > :::::: The code at line 1816 was first introduced by commit
> > > :::::: d9c2340052278d8eb2ffb16b0484f8f794def4de Do not depend on MAX_ORDER when grouping pages by mobility
> > >
> > > :::::: TO: Mel Gorman <mel@csn.ul.ie>
> > > :::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
> > >
> > > --
> > > 0-DAY CI Kernel Test Service
> > > https://github.com/intel/lkp-tests/wiki
> >


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-12 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-09  7:48 [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative kernel test robot
2025-05-09 20:43 ` Juan Yescas
2025-05-12  1:10   ` Philip Li
2025-05-12 19:06     ` Juan Yescas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox