Message ID | 1525855396-7908-3-git-send-email-changbin.du@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Changbin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.17-rc4 next-20180509] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180509-213955 config: arm64-allmodconfig (attached as .config) compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: 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 make.cross ARCH=arm64 All warnings (new ones prefixed by >>): >> WARNING: vmlinux.o(.text+0x6223c): Section mismatch in reference from the function init_subsystems() to the function .init.text:hyp_cpu_pm_init() The function init_subsystems() references the function __init hyp_cpu_pm_init(). This is often because init_subsystems lacks a __init annotation or the annotation of hyp_cpu_pm_init is wrong. -- >> WARNING: vmlinux.o(.text+0x62378): Section mismatch in reference from the function teardown_hyp_mode() to the function .init.text:hyp_cpu_pm_exit() The function teardown_hyp_mode() references the function __init hyp_cpu_pm_exit(). This is often because teardown_hyp_mode lacks a __init annotation or the annotation of hyp_cpu_pm_exit is wrong. -- >> WARNING: vmlinux.o(.text+0x968978): Section mismatch in reference from the function kirin_pcie_probe() to the function .init.text:kirin_add_pcie_port.isra.4() The function kirin_pcie_probe() references the function __init kirin_add_pcie_port.isra.4(). This is often because kirin_pcie_probe lacks a __init annotation or the annotation of kirin_add_pcie_port.isra.4 is wrong. --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Changbin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.17-rc4 next-20180509] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180509-213955 config: i386-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): >> WARNING: vmlinux.o(.text.unlikely+0xce5): Section mismatch in reference from the function init_xstate_size() to the function .init.text:get_xsave_size() The function init_xstate_size() references the function __init get_xsave_size(). This is often because init_xstate_size lacks a __init annotation or the annotation of get_xsave_size is wrong. -- >> WARNING: vmlinux.o(.text.unlikely+0xcf7): Section mismatch in reference from the function init_xstate_size() to the function .init.text:get_xsaves_size() The function init_xstate_size() references the function __init get_xsaves_size(). This is often because init_xstate_size lacks a __init annotation or the annotation of get_xsaves_size is wrong. -- >> WARNING: vmlinux.o(.text.unlikely+0x22a6): Section mismatch in reference from the function percpu_setup_debug_store() to the function .init.text:cea_map_percpu_pages() The function percpu_setup_debug_store() references the function __init cea_map_percpu_pages(). This is often because percpu_setup_debug_store lacks a __init annotation or the annotation of cea_map_percpu_pages is wrong. -- >> WARNING: vmlinux.o(.text.unlikely+0x2564): Section mismatch in reference from the function can_free_region() to the function .init.text:e820__mapped_all() The function can_free_region() references the function __init e820__mapped_all(). This is often because can_free_region lacks a __init annotation or the annotation of e820__mapped_all is wrong. --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/Makefile b/Makefile index d0d2652..6720c40 100644 --- a/Makefile +++ b/Makefile @@ -775,6 +775,12 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ $(call cc-option,-fno-var-tracking) endif +ifdef CONFIG_NO_AUTO_INLINE +KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions) \ + $(call cc-option, -fno-inline-small-functions) \ + $(call cc-option, -fno-inline-functions-called-once) +endif + ifdef CONFIG_FUNCTION_TRACER ifndef CC_FLAGS_FTRACE CC_FLAGS_FTRACE := -pg diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index c40c7b7..da52243 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -198,6 +198,23 @@ config GDB_SCRIPTS instance. See Documentation/dev-tools/gdb-kernel-debugging.rst for further details. +config NO_AUTO_INLINE + bool "Disable compiler auto-inline optimizations" + help + This will prevent the compiler from optimizing the kernel by + auto-inlining functions not marked with the inline keyword. + With this option, only functions explicitly marked with + "inline" will be inlined. This will allow the function tracer + to trace more functions because it only traces functions that + the compiler has not inlined. + + Enabling this function can help debugging a kernel if using + the function tracer. But it can also change how the kernel + works, because inlining functions may change the timing, + which could make it difficult while debugging race conditions. + + If unsure, select N. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y