All of lore.kernel.org
 help / color / mirror / Atom feed
* [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
@ 2022-03-30  6:53 kernel test robot
  2022-03-30 21:47   ` Roman Gushchin
  0 siblings, 1 reply; 11+ messages in thread
From: kernel test robot @ 2022-03-30  6:53 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: llvm, kbuild-all, GNU/Weeb Mailing List, linux-kernel,
	Suren Baghdasaryan, Mike Rapoport, Andrew Morton,
	Linux Memory Management List, Minchan Kim

Hi Roman,

FYI, the error/warning still remains.

tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
        git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
The function memblock_bottom_up() references
the variable __meminitdata memblock.
This is often because memblock_bottom_up lacks a __meminitdata
annotation or the annotation of memblock is wrong.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
  2022-03-30  6:53 [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock kernel test robot
@ 2022-03-30 21:47   ` Roman Gushchin
  0 siblings, 0 replies; 11+ messages in thread
From: Roman Gushchin @ 2022-03-30 21:47 UTC (permalink / raw)
  To: Mike Rapoport, kernel test robot
  Cc: Roman Gushchin, llvm, kbuild-all, GNU/Weeb Mailing List,
	linux-kernel, Suren Baghdasaryan, Mike Rapoport, Andrew Morton,
	Linux Memory Management List, Minchan Kim

On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> Hi Roman,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
>         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
>         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> The function memblock_bottom_up() references
> the variable __meminitdata memblock.
> This is often because memblock_bottom_up lacks a __meminitdata
> annotation or the annotation of memblock is wrong.

I guess this patch should fix it, however I fail to reproduce the original issue.
Maybe it's up to the specific compiler version.

--

From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
From: Roman Gushchin <roman.gushchin@linux.dev>
Date: Wed, 30 Mar 2022 14:42:12 -0700
Subject: [PATCH] memblock: fix memblock_bottom_up() and
 memblock_set_bottom_up() annotations

memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
annotations causing compiler warnings like:
  WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
  variable .meminit.data:memblock

Fix it by adding the missing annotation and removing the wrong
__meminit annotation.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 include/linux/memblock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 50ad19662a32..536bc2fc31e6 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
 /*
  * Set the allocation direction to bottom-up or top-down.
  */
-static inline __init_memblock void memblock_set_bottom_up(bool enable)
+static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
 {
 	memblock.bottom_up = enable;
 }
@@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
  * if this is true, that said, memblock will allocate memory
  * in bottom-up direction.
  */
-static inline __init_memblock bool memblock_bottom_up(void)
+static inline __initdata_memblock bool memblock_bottom_up(void)
 {
 	return memblock.bottom_up;
 }
-- 
2.30.2


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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
@ 2022-03-30 21:47   ` Roman Gushchin
  0 siblings, 0 replies; 11+ messages in thread
From: Roman Gushchin @ 2022-03-30 21:47 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3783 bytes --]

On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> Hi Roman,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp(a)intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
>         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
>         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> The function memblock_bottom_up() references
> the variable __meminitdata memblock.
> This is often because memblock_bottom_up lacks a __meminitdata
> annotation or the annotation of memblock is wrong.

I guess this patch should fix it, however I fail to reproduce the original issue.
Maybe it's up to the specific compiler version.

--

>From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
From: Roman Gushchin <roman.gushchin@linux.dev>
Date: Wed, 30 Mar 2022 14:42:12 -0700
Subject: [PATCH] memblock: fix memblock_bottom_up() and
 memblock_set_bottom_up() annotations

memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
annotations causing compiler warnings like:
  WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
  variable .meminit.data:memblock

Fix it by adding the missing annotation and removing the wrong
__meminit annotation.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 include/linux/memblock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 50ad19662a32..536bc2fc31e6 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
 /*
  * Set the allocation direction to bottom-up or top-down.
  */
-static inline __init_memblock void memblock_set_bottom_up(bool enable)
+static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
 {
 	memblock.bottom_up = enable;
 }
@@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
  * if this is true, that said, memblock will allocate memory
  * in bottom-up direction.
  */
-static inline __init_memblock bool memblock_bottom_up(void)
+static inline __initdata_memblock bool memblock_bottom_up(void)
 {
 	return memblock.bottom_up;
 }
-- 
2.30.2

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
  2022-03-30 21:47   ` Roman Gushchin
@ 2022-03-31  9:42     ` Mike Rapoport
  -1 siblings, 0 replies; 11+ messages in thread
From: Mike Rapoport @ 2022-03-31  9:42 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: kernel test robot, Roman Gushchin, llvm, kbuild-all,
	GNU/Weeb Mailing List, linux-kernel, Suren Baghdasaryan,
	Andrew Morton, Linux Memory Management List, Minchan Kim,
	Nathan Chancellor, Nick Desaulniers

(added llvm folks)

Hi,

On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
> On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> > Hi Roman,
> > 
> > FYI, the error/warning still remains.
> > 
> > tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> > head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> > commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> > config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> > 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> >         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> >         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
> >         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> > The function memblock_bottom_up() references
> > the variable __meminitdata memblock.
> > This is often because memblock_bottom_up lacks a __meminitdata
> > annotation or the annotation of memblock is wrong.
> 
> I guess this patch should fix it, however I fail to reproduce the original issue.
> Maybe it's up to the specific compiler version.
> 
> --
> 
> From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
> From: Roman Gushchin <roman.gushchin@linux.dev>
> Date: Wed, 30 Mar 2022 14:42:12 -0700
> Subject: [PATCH] memblock: fix memblock_bottom_up() and
>  memblock_set_bottom_up() annotations
> 
> memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
> annotations causing compiler warnings like:
>   WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
>   variable .meminit.data:memblock
> 
> Fix it by adding the missing annotation and removing the wrong
> __meminit annotation.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> ---
>  include/linux/memblock.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index 50ad19662a32..536bc2fc31e6 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
>  /*
>   * Set the allocation direction to bottom-up or top-down.
>   */
> -static inline __init_memblock void memblock_set_bottom_up(bool enable)
> +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)

I think putting __initdata_memlock won't help here, because there should be
nothing wrong with __meminit function accessing __meminitdata data.

My guesstimate would be that the compiler decided not to inline this and
still dropped section attribute because of 'inline'.

If this is the case we I think we should 

	s/inline __init_memblock/__always_inline/

>  {
>  	memblock.bottom_up = enable;
>  }
> @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
>   * if this is true, that said, memblock will allocate memory
>   * in bottom-up direction.
>   */
> -static inline __init_memblock bool memblock_bottom_up(void)
> +static inline __initdata_memblock bool memblock_bottom_up(void)
>  {
>  	return memblock.bottom_up;
>  }
> -- 
> 2.30.2
> 

-- 
Sincerely yours,
Mike.

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
@ 2022-03-31  9:42     ` Mike Rapoport
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Rapoport @ 2022-03-31  9:42 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4443 bytes --]

(added llvm folks)

Hi,

On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
> On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> > Hi Roman,
> > 
> > FYI, the error/warning still remains.
> > 
> > tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> > head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> > commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> > config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp(a)intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> > 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> >         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> >         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
> >         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> > The function memblock_bottom_up() references
> > the variable __meminitdata memblock.
> > This is often because memblock_bottom_up lacks a __meminitdata
> > annotation or the annotation of memblock is wrong.
> 
> I guess this patch should fix it, however I fail to reproduce the original issue.
> Maybe it's up to the specific compiler version.
> 
> --
> 
> From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
> From: Roman Gushchin <roman.gushchin@linux.dev>
> Date: Wed, 30 Mar 2022 14:42:12 -0700
> Subject: [PATCH] memblock: fix memblock_bottom_up() and
>  memblock_set_bottom_up() annotations
> 
> memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
> annotations causing compiler warnings like:
>   WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
>   variable .meminit.data:memblock
> 
> Fix it by adding the missing annotation and removing the wrong
> __meminit annotation.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> ---
>  include/linux/memblock.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index 50ad19662a32..536bc2fc31e6 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
>  /*
>   * Set the allocation direction to bottom-up or top-down.
>   */
> -static inline __init_memblock void memblock_set_bottom_up(bool enable)
> +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)

I think putting __initdata_memlock won't help here, because there should be
nothing wrong with __meminit function accessing __meminitdata data.

My guesstimate would be that the compiler decided not to inline this and
still dropped section attribute because of 'inline'.

If this is the case we I think we should 

	s/inline __init_memblock/__always_inline/

>  {
>  	memblock.bottom_up = enable;
>  }
> @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
>   * if this is true, that said, memblock will allocate memory
>   * in bottom-up direction.
>   */
> -static inline __init_memblock bool memblock_bottom_up(void)
> +static inline __initdata_memblock bool memblock_bottom_up(void)
>  {
>  	return memblock.bottom_up;
>  }
> -- 
> 2.30.2
> 

-- 
Sincerely yours,
Mike.

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
  2022-03-31  9:42     ` Mike Rapoport
@ 2022-03-31 16:11       ` Nathan Chancellor
  -1 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-31 16:11 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Roman Gushchin, kernel test robot, Roman Gushchin, llvm,
	kbuild-all, GNU/Weeb Mailing List, linux-kernel,
	Suren Baghdasaryan, Andrew Morton, Linux Memory Management List,
	Minchan Kim, Nick Desaulniers

On Thu, Mar 31, 2022 at 12:42:04PM +0300, Mike Rapoport wrote:
> (added llvm folks)
> 
> Hi,
> 
> On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
> > On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> > > Hi Roman,
> > > 
> > > FYI, the error/warning still remains.
> > > 
> > > tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> > > head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> > > commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> > > config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp@intel.com/config)
> > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> > > 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > >         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> > >         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
> > >         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > >         # save the config file to linux build tree
> > >         mkdir build_dir
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > > 
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > 
> > > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > > 
> > > >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> > > The function memblock_bottom_up() references
> > > the variable __meminitdata memblock.
> > > This is often because memblock_bottom_up lacks a __meminitdata
> > > annotation or the annotation of memblock is wrong.
> > 
> > I guess this patch should fix it, however I fail to reproduce the original issue.
> > Maybe it's up to the specific compiler version.
> > 
> > --
> > 
> > From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
> > From: Roman Gushchin <roman.gushchin@linux.dev>
> > Date: Wed, 30 Mar 2022 14:42:12 -0700
> > Subject: [PATCH] memblock: fix memblock_bottom_up() and
> >  memblock_set_bottom_up() annotations
> > 
> > memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
> > annotations causing compiler warnings like:
> >   WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
> >   variable .meminit.data:memblock
> > 
> > Fix it by adding the missing annotation and removing the wrong
> > __meminit annotation.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> > ---
> >  include/linux/memblock.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > index 50ad19662a32..536bc2fc31e6 100644
> > --- a/include/linux/memblock.h
> > +++ b/include/linux/memblock.h
> > @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
> >  /*
> >   * Set the allocation direction to bottom-up or top-down.
> >   */
> > -static inline __init_memblock void memblock_set_bottom_up(bool enable)
> > +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
> 
> I think putting __initdata_memlock won't help here, because there should be
> nothing wrong with __meminit function accessing __meminitdata data.
> 
> My guesstimate would be that the compiler decided not to inline this and
> still dropped section attribute because of 'inline'.
> 
> If this is the case we I think we should 
> 
> 	s/inline __init_memblock/__always_inline/
> 
> >  {
> >  	memblock.bottom_up = enable;
> >  }
> > @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
> >   * if this is true, that said, memblock will allocate memory
> >   * in bottom-up direction.
> >   */
> > -static inline __init_memblock bool memblock_bottom_up(void)
> > +static inline __initdata_memblock bool memblock_bottom_up(void)
> >  {
> >  	return memblock.bottom_up;
> >  }
> > -- 
> > 2.30.2
> > 
> 

For the record, I cannot reproduce this on mainline, which has commits
34dc2efb39a2 ("memblock: fix section mismatch warning") and a024b7c2850d
("mm: memblock: fix section mismatch warning again"). That first commit
has the same exact warning as this report, which is against an Android
tree (android12-trusty-5.10).

While I do not see the commit that 34dc2efb39a2 claims to fix in
android12-trusty-5.10, I do see the three commits in android12-5.10:

a46e3fa13968 ("UPSTREAM: mm: memblock: drop __init from memblock functions to make it inline")
5f7ec0f4c383 ("UPSTREAM: memblock: fix section mismatch warning")
8cf5bb6946a2 ("UPSTREAM: mm: memblock: fix section mismatch warning again")

I think we can just discard this report for now, unless someone from
Google's trusty team wants to address it in that branch.

Cheers,
Nathan

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
@ 2022-03-31 16:11       ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-31 16:11 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5528 bytes --]

On Thu, Mar 31, 2022 at 12:42:04PM +0300, Mike Rapoport wrote:
> (added llvm folks)
> 
> Hi,
> 
> On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
> > On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> > > Hi Roman,
> > > 
> > > FYI, the error/warning still remains.
> > > 
> > > tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> > > head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> > > commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> > > config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp(a)intel.com/config)
> > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> > > 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > >         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> > >         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
> > >         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > >         # save the config file to linux build tree
> > >         mkdir build_dir
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > > 
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > 
> > > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > > 
> > > >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> > > The function memblock_bottom_up() references
> > > the variable __meminitdata memblock.
> > > This is often because memblock_bottom_up lacks a __meminitdata
> > > annotation or the annotation of memblock is wrong.
> > 
> > I guess this patch should fix it, however I fail to reproduce the original issue.
> > Maybe it's up to the specific compiler version.
> > 
> > --
> > 
> > From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
> > From: Roman Gushchin <roman.gushchin@linux.dev>
> > Date: Wed, 30 Mar 2022 14:42:12 -0700
> > Subject: [PATCH] memblock: fix memblock_bottom_up() and
> >  memblock_set_bottom_up() annotations
> > 
> > memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
> > annotations causing compiler warnings like:
> >   WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
> >   variable .meminit.data:memblock
> > 
> > Fix it by adding the missing annotation and removing the wrong
> > __meminit annotation.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> > ---
> >  include/linux/memblock.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > index 50ad19662a32..536bc2fc31e6 100644
> > --- a/include/linux/memblock.h
> > +++ b/include/linux/memblock.h
> > @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
> >  /*
> >   * Set the allocation direction to bottom-up or top-down.
> >   */
> > -static inline __init_memblock void memblock_set_bottom_up(bool enable)
> > +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
> 
> I think putting __initdata_memlock won't help here, because there should be
> nothing wrong with __meminit function accessing __meminitdata data.
> 
> My guesstimate would be that the compiler decided not to inline this and
> still dropped section attribute because of 'inline'.
> 
> If this is the case we I think we should 
> 
> 	s/inline __init_memblock/__always_inline/
> 
> >  {
> >  	memblock.bottom_up = enable;
> >  }
> > @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
> >   * if this is true, that said, memblock will allocate memory
> >   * in bottom-up direction.
> >   */
> > -static inline __init_memblock bool memblock_bottom_up(void)
> > +static inline __initdata_memblock bool memblock_bottom_up(void)
> >  {
> >  	return memblock.bottom_up;
> >  }
> > -- 
> > 2.30.2
> > 
> 

For the record, I cannot reproduce this on mainline, which has commits
34dc2efb39a2 ("memblock: fix section mismatch warning") and a024b7c2850d
("mm: memblock: fix section mismatch warning again"). That first commit
has the same exact warning as this report, which is against an Android
tree (android12-trusty-5.10).

While I do not see the commit that 34dc2efb39a2 claims to fix in
android12-trusty-5.10, I do see the three commits in android12-5.10:

a46e3fa13968 ("UPSTREAM: mm: memblock: drop __init from memblock functions to make it inline")
5f7ec0f4c383 ("UPSTREAM: memblock: fix section mismatch warning")
8cf5bb6946a2 ("UPSTREAM: mm: memblock: fix section mismatch warning again")

I think we can just discard this report for now, unless someone from
Google's trusty team wants to address it in that branch.

Cheers,
Nathan

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
  2022-03-31 16:11       ` Nathan Chancellor
@ 2022-03-31 16:59         ` Roman Gushchin
  -1 siblings, 0 replies; 11+ messages in thread
From: Roman Gushchin @ 2022-03-31 16:59 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Mike Rapoport, kernel test robot, Roman Gushchin, llvm,
	kbuild-all, GNU/Weeb Mailing List, linux-kernel,
	Suren Baghdasaryan, Andrew Morton, Linux Memory Management List,
	Minchan Kim, Nick Desaulniers


> On Mar 31, 2022, at 9:11 AM, Nathan Chancellor <nathan@kernel.org> wrote:
> 
> On Thu, Mar 31, 2022 at 12:42:04PM +0300, Mike Rapoport wrote:
>> (added llvm folks)
>> 
>> Hi,
>> 
>>> On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
>>> On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
>>>> Hi Roman,
>>>> 
>>>> FYI, the error/warning still remains.
>>>> 
>>>> tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
>>>> head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
>>>> commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
>>>> config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp@intel.com/config)
>>>> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
>>>> 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>>>>        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
>>>>        git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
>>>>        git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>>>>        # save the config file to linux build tree
>>>>        mkdir build_dir
>>>>        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
>>>> 
>>>> If you fix the issue, kindly add following tag as appropriate
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>> 
>>>> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>>>> 
>>>>>> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
>>>> The function memblock_bottom_up() references
>>>> the variable __meminitdata memblock.
>>>> This is often because memblock_bottom_up lacks a __meminitdata
>>>> annotation or the annotation of memblock is wrong.
>>> 
>>> I guess this patch should fix it, however I fail to reproduce the original issue.
>>> Maybe it's up to the specific compiler version.
>>> 
>>> --
>>> 
>>> From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
>>> From: Roman Gushchin <roman.gushchin@linux.dev>
>>> Date: Wed, 30 Mar 2022 14:42:12 -0700
>>> Subject: [PATCH] memblock: fix memblock_bottom_up() and
>>> memblock_set_bottom_up() annotations
>>> 
>>> memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
>>> annotations causing compiler warnings like:
>>>  WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
>>>  variable .meminit.data:memblock
>>> 
>>> Fix it by adding the missing annotation and removing the wrong
>>> __meminit annotation.
>>> 
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
>>> ---
>>> include/linux/memblock.h | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
>>> index 50ad19662a32..536bc2fc31e6 100644
>>> --- a/include/linux/memblock.h
>>> +++ b/include/linux/memblock.h
>>> @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
>>> /*
>>>  * Set the allocation direction to bottom-up or top-down.
>>>  */
>>> -static inline __init_memblock void memblock_set_bottom_up(bool enable)
>>> +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
>> 
>> I think putting __initdata_memlock won't help here, because there should be
>> nothing wrong with __meminit function accessing __meminitdata data.
>> 
>> My guesstimate would be that the compiler decided not to inline this and
>> still dropped section attribute because of 'inline'.
>> 
>> If this is the case we I think we should 
>> 
>>    s/inline __init_memblock/__always_inline/
>> 
>>> {
>>>    memblock.bottom_up = enable;
>>> }
>>> @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
>>>  * if this is true, that said, memblock will allocate memory
>>>  * in bottom-up direction.
>>>  */
>>> -static inline __init_memblock bool memblock_bottom_up(void)
>>> +static inline __initdata_memblock bool memblock_bottom_up(void)
>>> {
>>>    return memblock.bottom_up;
>>> }
>>> -- 
>>> 2.30.2
>>> 
>> 
> 
> For the record, I cannot reproduce this on mainline, which has commits
> 34dc2efb39a2 ("memblock: fix section mismatch warning") and a024b7c2850d
> ("mm: memblock: fix section mismatch warning again"). That first commit
> has the same exact warning as this report, which is against an Android
> tree (android12-trusty-5.10).
> 
> While I do not see the commit that 34dc2efb39a2 claims to fix in
> android12-trusty-5.10, I do see the three commits in android12-5.10:
> 
> a46e3fa13968 ("UPSTREAM: mm: memblock: drop __init from memblock functions to make it inline")
> 5f7ec0f4c383 ("UPSTREAM: memblock: fix section mismatch warning")
> 8cf5bb6946a2 ("UPSTREAM: mm: memblock: fix section mismatch warning again")
> 
> I think we can just discard this report for now, unless someone from
> Google's trusty team wants to address it in that branch.

I agree. Or at least help us with the testing of the proposed fixes.

Thanks!

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
@ 2022-03-31 16:59         ` Roman Gushchin
  0 siblings, 0 replies; 11+ messages in thread
From: Roman Gushchin @ 2022-03-31 16:59 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5679 bytes --]


> On Mar 31, 2022, at 9:11 AM, Nathan Chancellor <nathan@kernel.org> wrote:
> 
> On Thu, Mar 31, 2022 at 12:42:04PM +0300, Mike Rapoport wrote:
>> (added llvm folks)
>> 
>> Hi,
>> 
>>> On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
>>> On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
>>>> Hi Roman,
>>>> 
>>>> FYI, the error/warning still remains.
>>>> 
>>>> tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
>>>> head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
>>>> commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
>>>> config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp(a)intel.com/config)
>>>> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
>>>> 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>>>>        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
>>>>        git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
>>>>        git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
>>>>        # save the config file to linux build tree
>>>>        mkdir build_dir
>>>>        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
>>>> 
>>>> If you fix the issue, kindly add following tag as appropriate
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>> 
>>>> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>>>> 
>>>>>> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
>>>> The function memblock_bottom_up() references
>>>> the variable __meminitdata memblock.
>>>> This is often because memblock_bottom_up lacks a __meminitdata
>>>> annotation or the annotation of memblock is wrong.
>>> 
>>> I guess this patch should fix it, however I fail to reproduce the original issue.
>>> Maybe it's up to the specific compiler version.
>>> 
>>> --
>>> 
>>> From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
>>> From: Roman Gushchin <roman.gushchin@linux.dev>
>>> Date: Wed, 30 Mar 2022 14:42:12 -0700
>>> Subject: [PATCH] memblock: fix memblock_bottom_up() and
>>> memblock_set_bottom_up() annotations
>>> 
>>> memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
>>> annotations causing compiler warnings like:
>>>  WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
>>>  variable .meminit.data:memblock
>>> 
>>> Fix it by adding the missing annotation and removing the wrong
>>> __meminit annotation.
>>> 
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
>>> ---
>>> include/linux/memblock.h | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
>>> index 50ad19662a32..536bc2fc31e6 100644
>>> --- a/include/linux/memblock.h
>>> +++ b/include/linux/memblock.h
>>> @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
>>> /*
>>>  * Set the allocation direction to bottom-up or top-down.
>>>  */
>>> -static inline __init_memblock void memblock_set_bottom_up(bool enable)
>>> +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
>> 
>> I think putting __initdata_memlock won't help here, because there should be
>> nothing wrong with __meminit function accessing __meminitdata data.
>> 
>> My guesstimate would be that the compiler decided not to inline this and
>> still dropped section attribute because of 'inline'.
>> 
>> If this is the case we I think we should 
>> 
>>    s/inline __init_memblock/__always_inline/
>> 
>>> {
>>>    memblock.bottom_up = enable;
>>> }
>>> @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
>>>  * if this is true, that said, memblock will allocate memory
>>>  * in bottom-up direction.
>>>  */
>>> -static inline __init_memblock bool memblock_bottom_up(void)
>>> +static inline __initdata_memblock bool memblock_bottom_up(void)
>>> {
>>>    return memblock.bottom_up;
>>> }
>>> -- 
>>> 2.30.2
>>> 
>> 
> 
> For the record, I cannot reproduce this on mainline, which has commits
> 34dc2efb39a2 ("memblock: fix section mismatch warning") and a024b7c2850d
> ("mm: memblock: fix section mismatch warning again"). That first commit
> has the same exact warning as this report, which is against an Android
> tree (android12-trusty-5.10).
> 
> While I do not see the commit that 34dc2efb39a2 claims to fix in
> android12-trusty-5.10, I do see the three commits in android12-5.10:
> 
> a46e3fa13968 ("UPSTREAM: mm: memblock: drop __init from memblock functions to make it inline")
> 5f7ec0f4c383 ("UPSTREAM: memblock: fix section mismatch warning")
> 8cf5bb6946a2 ("UPSTREAM: mm: memblock: fix section mismatch warning again")
> 
> I think we can just discard this report for now, unless someone from
> Google's trusty team wants to address it in that branch.

I agree. Or at least help us with the testing of the proposed fixes.

Thanks!

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
  2022-03-31 16:11       ` Nathan Chancellor
@ 2022-03-31 17:06         ` Nick Desaulniers
  -1 siblings, 0 replies; 11+ messages in thread
From: Nick Desaulniers @ 2022-03-31 17:06 UTC (permalink / raw)
  To: Tri Vo, Arve Hjønnevåg
  Cc: Mike Rapoport, Roman Gushchin, kernel test robot, Roman Gushchin,
	llvm, kbuild-all, GNU/Weeb Mailing List, linux-kernel,
	Suren Baghdasaryan, Andrew Morton, Linux Memory Management List,
	Minchan Kim, Nathan Chancellor

On Thu, Mar 31, 2022 at 9:11 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Thu, Mar 31, 2022 at 12:42:04PM +0300, Mike Rapoport wrote:
> > (added llvm folks)
> >
> > Hi,
> >
> > On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
> > > On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> > > > Hi Roman,
> > > >
> > > > FYI, the error/warning still remains.
> > > >
> > > > tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> > > > head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> > > > commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> > > > config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp@intel.com/config)
> > > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> > > > 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > > >         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> > > >         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
> > > >         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > > >         # save the config file to linux build tree
> > > >         mkdir build_dir
> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > >
> > > > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > > >
> > > > >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> > > > The function memblock_bottom_up() references
> > > > the variable __meminitdata memblock.
> > > > This is often because memblock_bottom_up lacks a __meminitdata
> > > > annotation or the annotation of memblock is wrong.
> > >
> > > I guess this patch should fix it, however I fail to reproduce the original issue.
> > > Maybe it's up to the specific compiler version.
> > >
> > > --
> > >
> > > From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
> > > From: Roman Gushchin <roman.gushchin@linux.dev>
> > > Date: Wed, 30 Mar 2022 14:42:12 -0700
> > > Subject: [PATCH] memblock: fix memblock_bottom_up() and
> > >  memblock_set_bottom_up() annotations
> > >
> > > memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
> > > annotations causing compiler warnings like:
> > >   WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
> > >   variable .meminit.data:memblock
> > >
> > > Fix it by adding the missing annotation and removing the wrong
> > > __meminit annotation.
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> > > ---
> > >  include/linux/memblock.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > > index 50ad19662a32..536bc2fc31e6 100644
> > > --- a/include/linux/memblock.h
> > > +++ b/include/linux/memblock.h
> > > @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
> > >  /*
> > >   * Set the allocation direction to bottom-up or top-down.
> > >   */
> > > -static inline __init_memblock void memblock_set_bottom_up(bool enable)
> > > +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
> >
> > I think putting __initdata_memlock won't help here, because there should be
> > nothing wrong with __meminit function accessing __meminitdata data.
> >
> > My guesstimate would be that the compiler decided not to inline this and
> > still dropped section attribute because of 'inline'.
> >
> > If this is the case we I think we should
> >
> >       s/inline __init_memblock/__always_inline/
> >
> > >  {
> > >     memblock.bottom_up = enable;
> > >  }
> > > @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
> > >   * if this is true, that said, memblock will allocate memory
> > >   * in bottom-up direction.
> > >   */
> > > -static inline __init_memblock bool memblock_bottom_up(void)
> > > +static inline __initdata_memblock bool memblock_bottom_up(void)
> > >  {
> > >     return memblock.bottom_up;
> > >  }
> > > --
> > > 2.30.2
> > >
> >
>
> For the record, I cannot reproduce this on mainline, which has commits
> 34dc2efb39a2 ("memblock: fix section mismatch warning") and a024b7c2850d
> ("mm: memblock: fix section mismatch warning again"). That first commit
> has the same exact warning as this report, which is against an Android
> tree (android12-trusty-5.10).
>
> While I do not see the commit that 34dc2efb39a2 claims to fix in
> android12-trusty-5.10, I do see the three commits in android12-5.10:
>
> a46e3fa13968 ("UPSTREAM: mm: memblock: drop __init from memblock functions to make it inline")
> 5f7ec0f4c383 ("UPSTREAM: memblock: fix section mismatch warning")
> 8cf5bb6946a2 ("UPSTREAM: mm: memblock: fix section mismatch warning again")

It sounds like trusty just needs to pull down from (or rebase onto)
android12-5.10 into android12-trusty-5.10.

>
> I think we can just discard this report for now, unless someone from
> Google's trusty team wants to address it in that branch.
>
> Cheers,
> Nathan



-- 
Thanks,
~Nick Desaulniers

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

* Re: [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
@ 2022-03-31 17:06         ` Nick Desaulniers
  0 siblings, 0 replies; 11+ messages in thread
From: Nick Desaulniers @ 2022-03-31 17:06 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5984 bytes --]

On Thu, Mar 31, 2022 at 9:11 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Thu, Mar 31, 2022 at 12:42:04PM +0300, Mike Rapoport wrote:
> > (added llvm folks)
> >
> > Hi,
> >
> > On Wed, Mar 30, 2022 at 02:47:43PM -0700, Roman Gushchin wrote:
> > > On Wed, Mar 30, 2022 at 02:53:14PM +0800, kbuild test robot wrote:
> > > > Hi Roman,
> > > >
> > > > FYI, the error/warning still remains.
> > > >
> > > > tree:   https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-trusty-5.10
> > > > head:   07055bfd3d810d41a38354693dfaa55a6f8c0025
> > > > commit: 0e0bfc41fdf4d79d39ebe929844cdee44f97366d [4036/5872] UPSTREAM: mm: cma: allocate cma areas bottom-up
> > > > config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220330/202203301412.MZ7wQvQz-lkp(a)intel.com/config)
> > > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
> > > > 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/ammarfaizi2/linux-block/commit/0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > > >         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
> > > >         git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-trusty-5.10
> > > >         git checkout 0e0bfc41fdf4d79d39ebe929844cdee44f97366d
> > > >         # save the config file to linux build tree
> > > >         mkdir build_dir
> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > >
> > > > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > > >
> > > > >> WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
> > > > The function memblock_bottom_up() references
> > > > the variable __meminitdata memblock.
> > > > This is often because memblock_bottom_up lacks a __meminitdata
> > > > annotation or the annotation of memblock is wrong.
> > >
> > > I guess this patch should fix it, however I fail to reproduce the original issue.
> > > Maybe it's up to the specific compiler version.
> > >
> > > --
> > >
> > > From b55a8dd19f4156d7e24ec39b18ede06965ce1c4f Mon Sep 17 00:00:00 2001
> > > From: Roman Gushchin <roman.gushchin@linux.dev>
> > > Date: Wed, 30 Mar 2022 14:42:12 -0700
> > > Subject: [PATCH] memblock: fix memblock_bottom_up() and
> > >  memblock_set_bottom_up() annotations
> > >
> > > memblock_bottom_up() and memblock_set_bottom_up() lack __meminitdata
> > > annotations causing compiler warnings like:
> > >   WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the
> > >   variable .meminit.data:memblock
> > >
> > > Fix it by adding the missing annotation and removing the wrong
> > > __meminit annotation.
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> > > ---
> > >  include/linux/memblock.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > > index 50ad19662a32..536bc2fc31e6 100644
> > > --- a/include/linux/memblock.h
> > > +++ b/include/linux/memblock.h
> > > @@ -460,7 +460,7 @@ static inline void *memblock_alloc_node(phys_addr_t size,
> > >  /*
> > >   * Set the allocation direction to bottom-up or top-down.
> > >   */
> > > -static inline __init_memblock void memblock_set_bottom_up(bool enable)
> > > +static inline __initdata_memblock void memblock_set_bottom_up(bool enable)
> >
> > I think putting __initdata_memlock won't help here, because there should be
> > nothing wrong with __meminit function accessing __meminitdata data.
> >
> > My guesstimate would be that the compiler decided not to inline this and
> > still dropped section attribute because of 'inline'.
> >
> > If this is the case we I think we should
> >
> >       s/inline __init_memblock/__always_inline/
> >
> > >  {
> > >     memblock.bottom_up = enable;
> > >  }
> > > @@ -470,7 +470,7 @@ static inline __init_memblock void memblock_set_bottom_up(bool enable)
> > >   * if this is true, that said, memblock will allocate memory
> > >   * in bottom-up direction.
> > >   */
> > > -static inline __init_memblock bool memblock_bottom_up(void)
> > > +static inline __initdata_memblock bool memblock_bottom_up(void)
> > >  {
> > >     return memblock.bottom_up;
> > >  }
> > > --
> > > 2.30.2
> > >
> >
>
> For the record, I cannot reproduce this on mainline, which has commits
> 34dc2efb39a2 ("memblock: fix section mismatch warning") and a024b7c2850d
> ("mm: memblock: fix section mismatch warning again"). That first commit
> has the same exact warning as this report, which is against an Android
> tree (android12-trusty-5.10).
>
> While I do not see the commit that 34dc2efb39a2 claims to fix in
> android12-trusty-5.10, I do see the three commits in android12-5.10:
>
> a46e3fa13968 ("UPSTREAM: mm: memblock: drop __init from memblock functions to make it inline")
> 5f7ec0f4c383 ("UPSTREAM: memblock: fix section mismatch warning")
> 8cf5bb6946a2 ("UPSTREAM: mm: memblock: fix section mismatch warning again")

It sounds like trusty just needs to pull down from (or rebase onto)
android12-5.10 into android12-trusty-5.10.

>
> I think we can just discard this report for now, unless someone from
> Google's trusty team wants to address it in that branch.
>
> Cheers,
> Nathan



-- 
Thanks,
~Nick Desaulniers

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

end of thread, other threads:[~2022-03-31 17:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30  6:53 [ammarfaizi2-block:google/android/kernel/common/android12-trusty-5.10 4036/5872] WARNING: modpost: vmlinux.o(.text+0x4111c4): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock kernel test robot
2022-03-30 21:47 ` Roman Gushchin
2022-03-30 21:47   ` Roman Gushchin
2022-03-31  9:42   ` Mike Rapoport
2022-03-31  9:42     ` Mike Rapoport
2022-03-31 16:11     ` Nathan Chancellor
2022-03-31 16:11       ` Nathan Chancellor
2022-03-31 16:59       ` Roman Gushchin
2022-03-31 16:59         ` Roman Gushchin
2022-03-31 17:06       ` Nick Desaulniers
2022-03-31 17:06         ` Nick Desaulniers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.