Re: memory_model.h:64:14: error: implicit declaration of function 'page_to_section'

From: Randy Dunlap
Date: Wed Feb 03 2021 - 14:56:31 EST


On 2/3/21 7:51 AM, Naresh Kamboju wrote:
> Linux next tag 20210203 the mips and sh builds failed due to below errors.
> Following builds failed with gcc-8, gcc-9 and gcc-10,
> - mips (cavium_octeon_defconfig)
> - sh (defconfig)
> - sh (shx3_defconfig)
>
> make --silent --keep-going --jobs=8
> O=/home/tuxbuild/.cache/tuxmake/builds/1/tmp ARCH=mips
> CROSS_COMPILE=mips-linux-gnu- 'CC=sccache mips-linux-gnu-gcc'
> 'HOSTCC=sccache gcc' uImage.gz
> In file included from arch/mips/include/asm/page.h:258,
> from arch/mips/include/asm/io.h:29,
> from include/linux/io.h:13,
> from arch/mips/include/asm/mips-cps.h:10,
> from arch/mips/include/asm/smp-ops.h:16,
> from arch/mips/include/asm/smp.h:21,
> from include/linux/smp.h:84,
> from arch/mips/include/asm/cpu-type.h:12,
> from arch/mips/include/asm/timex.h:19,
> from include/linux/timex.h:65,
> from include/linux/time32.h:13,
> from include/linux/time.h:60,
> from include/linux/compat.h:10,
> from arch/mips/kernel/asm-offsets.c:12:
> include/linux/mm.h: In function 'is_pinnable_page':
> include/asm-generic/memory_model.h:64:14: error: implicit declaration
> of function 'page_to_section'; did you mean 'present_section'?
> [-Werror=implicit-function-declaration]
> int __sec = page_to_section(__pg); \
> ^~~~~~~~~~~~~~~
> include/asm-generic/memory_model.h:81:21: note: in expansion of macro
> '__page_to_pfn'
> #define page_to_pfn __page_to_pfn
> ^~~~~~~~~~~~~
> include/linux/mm.h:1135:15: note: in expansion of macro 'page_to_pfn'
> is_zero_pfn(page_to_pfn(page));
> ^~~~~~~~~~~
> In file included from arch/mips/kernel/asm-offsets.c:15:
> include/linux/mm.h: At top level:
> include/linux/mm.h:1512:29: error: conflicting types for 'page_to_section'
> static inline unsigned long page_to_section(const struct page *page)
> ^~~~~~~~~~~~~~~
> Steps to reproduce:
> --------------------------
> # TuxMake is a command line tool and Python library that provides
> # portable and repeatable Linux kernel builds across a variety of
> # architectures, toolchains, kernel configurations, and make targets.
> #
> # TuxMake supports the concept of runtimes.
> # See https://docs.tuxmake.org/runtimes/, for that to work it requires
> # that you install podman or docker on your system.
> #
> # To install tuxmake on your system globally:
> # sudo pip3 install -U tuxmake
> #
> # See https://docs.tuxmake.org/ for complete documentation.
>
>
> tuxmake --runtime podman --target-arch mips --toolchain gcc-10
> --kconfig cavium_octeon_defconfig

Looks to me like this is due to <linux/mm.h>:

#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
#define SECTION_IN_PAGE_FLAGS
#endif


with
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not set


I'm still digging.

--
~Randy