Re: [PATCH 09/22] init: lto: ensure initcall ordering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sami,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 26e122e97a3d0390ebec389347f64f3730fdf48f]

url:    https://github.com/0day-ci/linux/commits/Sami-Tolvanen/add-support-for-Clang-LTO/20200625-043816
base:    26e122e97a3d0390ebec389347f64f3730fdf48f
config: m68k-defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

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

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

   In file included from arch/m68k/include/asm/io_mm.h:25,
                    from arch/m68k/include/asm/io.h:8,
                    from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:13,
                    from ./arch/m68k/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from drivers/ide/gayle.c:13:
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
   arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      83 |  ({u8 __w, __v = (b);  u32 _addr = ((u32) (addr)); \
         |       ^~~
   arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
     430 |   rom_out_8(port, *buf++);
         |   ^~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
   arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      86 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro 'rom_out_be16'
     448 |   rom_out_be16(port, *buf++);
         |   ^~~~~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
   arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      90 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro 'rom_out_le16'
     466 |   rom_out_le16(port, *buf++);
         |   ^~~~~~~~~~~~
   In file included from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from drivers/ide/gayle.c:12:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/asm-generic/bug.h:144:27: note: in definition of macro 'WARN_ON_ONCE'
     144 |  int __ret_warn_once = !!(condition);   \
         |                           ^~~~~~~~~
   arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro 'virt_addr_valid'
     170 | #define pfn_valid(pfn)  virt_addr_valid(pfn_to_virt(pfn))
         |                         ^~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
     352 |  if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
         |                   ^~~~~~~~~
   In file included from <command-line>:
   drivers/ide/gayle.c: At top level:
>> arch/m68k/include/asm/amigayle.h:57:66: error: pasting ")" and "__279_185_amiga_gayle_ide_driver_init" does not give a valid preprocessing token
      57 | #define gayle (*(volatile struct GAYLE *)(zTwoBase+GAYLE_ADDRESS))
         |                                                                  ^
   include/linux/compiler_types.h:53:23: note: in definition of macro '___PASTE'
      53 | #define ___PASTE(a,b) a##b
         |                       ^
>> include/linux/init.h:189:2: note: in expansion of macro '__PASTE'
     189 |  __PASTE(__KBUILD_MODNAME,    \
         |  ^~~~~~~
>> <command-line>: note: in expansion of macro 'gayle'
>> include/linux/init.h:189:10: note: in expansion of macro '__KBUILD_MODNAME'
     189 |  __PASTE(__KBUILD_MODNAME,    \
         |          ^~~~~~~~~~~~~~~~
>> include/linux/init.h:236:35: note: in expansion of macro '__initcall_id'
     236 |  __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |                                   ^~~~~~~~~~~~~
   include/linux/init.h:238:35: note: in expansion of macro '___define_initcall'
     238 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:267:30: note: in expansion of macro '__define_initcall'
     267 | #define device_initcall(fn)  __define_initcall(fn, 6)
         |                              ^~~~~~~~~~~~~~~~~
>> include/linux/init.h:272:24: note: in expansion of macro 'device_initcall'
     272 | #define __initcall(fn) device_initcall(fn)
         |                        ^~~~~~~~~~~~~~~
>> include/linux/module.h:88:24: note: in expansion of macro '__initcall'
      88 | #define module_init(x) __initcall(x);
         |                        ^~~~~~~~~~
   include/linux/platform_device.h:271:1: note: in expansion of macro 'module_init'
     271 | module_init(__platform_driver##_init); \
         | ^~~~~~~~~~~
   drivers/ide/gayle.c:185:1: note: in expansion of macro 'module_platform_driver_probe'
     185 | module_platform_driver_probe(amiga_gayle_ide_driver, amiga_gayle_ide_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/init.h:200:10: error: pasting "__" and "(" does not give a valid preprocessing token
     200 |  __PASTE(__,      \
         |          ^~
   include/linux/compiler_types.h:53:23: note: in definition of macro '___PASTE'
      53 | #define ___PASTE(a,b) a##b
         |                       ^
   include/linux/init.h:200:2: note: in expansion of macro '__PASTE'
     200 |  __PASTE(__,      \
         |  ^~~~~~~
>> include/linux/init.h:232:3: note: in expansion of macro '__initcall_name'
     232 |   __initcall_name(initcall, __iid, id),  \
         |   ^~~~~~~~~~~~~~~
>> include/linux/init.h:236:2: note: in expansion of macro '__unique_initcall'
     236 |  __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |  ^~~~~~~~~~~~~~~~~
   include/linux/init.h:238:35: note: in expansion of macro '___define_initcall'
     238 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:267:30: note: in expansion of macro '__define_initcall'
     267 | #define device_initcall(fn)  __define_initcall(fn, 6)
         |                              ^~~~~~~~~~~~~~~~~
>> include/linux/init.h:272:24: note: in expansion of macro 'device_initcall'
     272 | #define __initcall(fn) device_initcall(fn)
         |                        ^~~~~~~~~~~~~~~
>> include/linux/module.h:88:24: note: in expansion of macro '__initcall'
      88 | #define module_init(x) __initcall(x);
         |                        ^~~~~~~~~~
   include/linux/platform_device.h:271:1: note: in expansion of macro 'module_init'
     271 | module_init(__platform_driver##_init); \
         | ^~~~~~~~~~~
   drivers/ide/gayle.c:185:1: note: in expansion of macro 'module_platform_driver_probe'
     185 | module_platform_driver_probe(amiga_gayle_ide_driver, amiga_gayle_ide_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:6,
                    from include/linux/kernel.h:15,
                    from include/asm-generic/bug.h:19,
                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from drivers/ide/gayle.c:12:
>> arch/m68k/include/asm/amigayle.h:57:16: error: expected declaration specifiers or '...' before '*' token
      57 | #define gayle (*(volatile struct GAYLE *)(zTwoBase+GAYLE_ADDRESS))
         |                ^
   include/linux/init.h:226:20: note: in definition of macro '____define_initcall'
     226 |  static initcall_t __name __used    \
         |                    ^~~~~~
   include/linux/compiler_types.h:54:22: note: in expansion of macro '___PASTE'
      54 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:198:2: note: in expansion of macro '__PASTE'
     198 |  __PASTE(__,      \
         |  ^~~~~~~
   include/linux/compiler_types.h:54:22: note: in expansion of macro '___PASTE'
      54 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:199:2: note: in expansion of macro '__PASTE'
     199 |  __PASTE(prefix,      \
         |  ^~~~~~~
   include/linux/compiler_types.h:54:22: note: in expansion of macro '___PASTE'
      54 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:200:2: note: in expansion of macro '__PASTE'
     200 |  __PASTE(__,      \
         |  ^~~~~~~
   include/linux/compiler_types.h:54:22: note: in expansion of macro '___PASTE'
      54 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:201:2: note: in expansion of macro '__PASTE'
     201 |  __PASTE(__iid, id))))
         |  ^~~~~~~
>> include/linux/init.h:232:3: note: in expansion of macro '__initcall_name'
     232 |   __initcall_name(initcall, __iid, id),  \
         |   ^~~~~~~~~~~~~~~
>> include/linux/init.h:236:2: note: in expansion of macro '__unique_initcall'
     236 |  __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |  ^~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:54:22: note: in expansion of macro '___PASTE'
      54 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
>> include/linux/init.h:189:2: note: in expansion of macro '__PASTE'
     189 |  __PASTE(__KBUILD_MODNAME,    \
         |  ^~~~~~~
>> <command-line>: note: in expansion of macro 'gayle'
>> include/linux/init.h:189:10: note: in expansion of macro '__KBUILD_MODNAME'
     189 |  __PASTE(__KBUILD_MODNAME,    \
         |          ^~~~~~~~~~~~~~~~
>> include/linux/init.h:236:35: note: in expansion of macro '__initcall_id'
     236 |  __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |                                   ^~~~~~~~~~~~~
   include/linux/init.h:238:35: note: in expansion of macro '___define_initcall'
     238 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:267:30: note: in expansion of macro '__define_initcall'
     267 | #define device_initcall(fn)  __define_initcall(fn, 6)
         |                              ^~~~~~~~~~~~~~~~~
>> include/linux/init.h:272:24: note: in expansion of macro 'device_initcall'
     272 | #define __initcall(fn) device_initcall(fn)
         |                        ^~~~~~~~~~~~~~~
   include/linux/module.h:88:24: note: in expansion of macro '__initcall'
      88 | #define module_init(x) __initcall(x);
         |                        ^~~~~~~~~~
   include/linux/platform_device.h:271:1: note: in expansion of macro 'module_init'
     271 | module_init(__platform_driver##_init); \
         | ^~~~~~~~~~~
   drivers/ide/gayle.c:185:1: note: in expansion of macro 'module_platform_driver_probe'
     185 | module_platform_driver_probe(amiga_gayle_ide_driver, amiga_gayle_ide_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/ide/gayle.c:19:
   drivers/ide/gayle.c:185:30: warning: 'amiga_gayle_ide_driver_init' defined but not used [-Wunused-function]
     185 | module_platform_driver_probe(amiga_gayle_ide_driver, amiga_gayle_ide_probe);
         |                              ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/platform_device.h:266:19: note: in definition of macro 'module_platform_driver_probe'
     266 | static int __init __platform_driver##_init(void) \
         |                   ^~~~~~~~~~~~~~~~~

vim +200 include/linux/init.h

   170	
   171	/*
   172	 * initcalls are now grouped by functionality into separate
   173	 * subsections. Ordering inside the subsections is determined
   174	 * by link order. 
   175	 * For backwards compatibility, initcall() puts the call in 
   176	 * the device init subsection.
   177	 *
   178	 * The `id' arg to __define_initcall() is needed so that multiple initcalls
   179	 * can point at the same handler without causing duplicate-symbol build errors.
   180	 *
   181	 * Initcalls are run by placing pointers in initcall sections that the
   182	 * kernel iterates at runtime. The linker can do dead code / data elimination
   183	 * and remove that completely, so the initcall sections have to be marked
   184	 * as KEEP() in the linker script.
   185	 */
   186	
   187	/* Format: <modname>__<counter>_<line>_<fn> */
   188	#define __initcall_id(fn)					\
 > 189		__PASTE(__KBUILD_MODNAME,				\
   190		__PASTE(__,						\
   191		__PASTE(__COUNTER__,					\
   192		__PASTE(_,						\
   193		__PASTE(__LINE__,					\
   194		__PASTE(_, fn))))))
   195	
   196	/* Format: __<prefix>__<iid><id> */
   197	#define __initcall_name(prefix, __iid, id)			\
   198		__PASTE(__,						\
   199		__PASTE(prefix,						\
 > 200		__PASTE(__,						\
   201		__PASTE(__iid, id))))
   202	
   203	#ifdef CONFIG_LTO_CLANG
   204	/*
   205	 * With LTO, the compiler doesn't necessarily obey link order for
   206	 * initcalls. In order to preserve the correct order, we add each
   207	 * variable into its own section and generate a linker script (in
   208	 * scripts/link-vmlinux.sh) to specify the order of the sections.
   209	 */
   210	#define __initcall_section(__sec, __iid)			\
   211		#__sec ".init.." #__iid
   212	#else
   213	#define __initcall_section(__sec, __iid)			\
   214		#__sec ".init"
   215	#endif
   216	
   217	#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
   218	#define ____define_initcall(fn, __name, __sec)			\
   219		__ADDRESSABLE(fn)					\
   220		asm(".section	\"" __sec "\", \"a\"		\n"	\
   221		    __stringify(__name) ":			\n"	\
   222		    ".long	" #fn " - .			\n"	\
   223		    ".previous					\n");
   224	#else
   225	#define ____define_initcall(fn, __name, __sec)			\
   226		static initcall_t __name __used 			\
   227			__attribute__((__section__(__sec))) = fn;
   228	#endif
   229	
   230	#define __unique_initcall(fn, id, __sec, __iid)			\
   231		____define_initcall(fn,					\
 > 232			__initcall_name(initcall, __iid, id),		\
   233			__initcall_section(__sec, __iid))
   234	
   235	#define ___define_initcall(fn, id, __sec)			\
 > 236		__unique_initcall(fn, id, __sec, __initcall_id(fn))
   237	
   238	#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
   239	
   240	/*
   241	 * Early initcalls run before initializing SMP.
   242	 *
   243	 * Only for built-in code, not modules.
   244	 */
   245	#define early_initcall(fn)		__define_initcall(fn, early)
   246	
   247	/*
   248	 * A "pure" initcall has no dependencies on anything else, and purely
   249	 * initializes variables that couldn't be statically initialized.
   250	 *
   251	 * This only exists for built-in code, not for modules.
   252	 * Keep main.c:initcall_level_names[] in sync.
   253	 */
   254	#define pure_initcall(fn)		__define_initcall(fn, 0)
   255	
   256	#define core_initcall(fn)		__define_initcall(fn, 1)
   257	#define core_initcall_sync(fn)		__define_initcall(fn, 1s)
   258	#define postcore_initcall(fn)		__define_initcall(fn, 2)
   259	#define postcore_initcall_sync(fn)	__define_initcall(fn, 2s)
   260	#define arch_initcall(fn)		__define_initcall(fn, 3)
   261	#define arch_initcall_sync(fn)		__define_initcall(fn, 3s)
   262	#define subsys_initcall(fn)		__define_initcall(fn, 4)
   263	#define subsys_initcall_sync(fn)	__define_initcall(fn, 4s)
   264	#define fs_initcall(fn)			__define_initcall(fn, 5)
   265	#define fs_initcall_sync(fn)		__define_initcall(fn, 5s)
   266	#define rootfs_initcall(fn)		__define_initcall(fn, rootfs)
   267	#define device_initcall(fn)		__define_initcall(fn, 6)
   268	#define device_initcall_sync(fn)	__define_initcall(fn, 6s)
   269	#define late_initcall(fn)		__define_initcall(fn, 7)
   270	#define late_initcall_sync(fn)		__define_initcall(fn, 7s)
   271	
 > 272	#define __initcall(fn) device_initcall(fn)
   273	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux