lkml.org 
[lkml]   [2018]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 2/4] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
    Date
    From: Changbin Du <changbin.du@intel.com>

    This patch add a new kernel hacking option NO_AUTO_INLINE. Selecting
    this option 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.

    Signed-off-by: Changbin Du <changbin.du@intel.com>
    Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

    ---
    v2: Some grammar updates from Steven.
    ---
    Makefile | 6 ++++++
    lib/Kconfig.debug | 17 +++++++++++++++++
    2 files changed, 23 insertions(+)

    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
    --
    2.7.4
    \
     
     \ /
      Last update: 2018-05-11 10:22    [W:6.740 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site