lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [patch V6 00/37] x86/entry: Rework leftovers and merge plan

    So on top of you entry-v8-full; I had to chase one of those
    instrumentation_end() escapes an (extended) basic block chase (again!).

    How about we do something like the below; that fixes the current case
    (rcu_eqs_enter) but also kills the entire class.

    ---
    arch/x86/include/asm/bug.h | 2 +-
    include/linux/compiler.h | 16 +++++++++++++---
    include/linux/compiler_types.h | 4 ----
    3 files changed, 14 insertions(+), 8 deletions(-)

    diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
    index f128e5c2ed42..fb34ff641e0a 100644
    --- a/arch/x86/include/asm/bug.h
    +++ b/arch/x86/include/asm/bug.h
    @@ -79,8 +79,8 @@ do { \
    do { \
    instrumentation_begin(); \
    _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \
    - instrumentation_end(); \
    annotate_reachable(); \
    + instrumentation_end(); \
    } while (0)

    #include <asm-generic/bug.h>
    diff --git a/include/linux/compiler.h b/include/linux/compiler.h
    index 7db5902f8f6e..b4c248e6b76a 100644
    --- a/include/linux/compiler.h
    +++ b/include/linux/compiler.h
    @@ -120,25 +120,35 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
    /* Annotate a C jump table to allow objtool to follow the code flow */
    #define __annotate_jump_table __section(.rodata..c_jump_table)

    +#ifdef CONFIG_DEBUG_ENTRY
    +/* Section for code which can't be instrumented at all */
    +#define noinstr \
    + noinline notrace __attribute((__section__(".noinstr.text")))
    +
    /* Begin/end of an instrumentation safe region */
    -#define instrumentation_begin() ({ \
    +#define instrumentation_begin() ({ \
    asm volatile("%c0:\n\t" \
    ".pushsection .discard.instr_begin\n\t" \
    ".long %c0b - .\n\t" \
    ".popsection\n\t" : : "i" (__COUNTER__)); \
    })

    -#define instrumentation_end() ({ \
    - asm volatile("%c0:\n\t" \
    +#define instrumentation_end() ({ \
    + asm volatile("%c0: nop\n\t" \
    ".pushsection .discard.instr_end\n\t" \
    ".long %c0b - .\n\t" \
    ".popsection\n\t" : : "i" (__COUNTER__)); \
    })
    +#endif /* CONFIG_DEBUG_ENTRY */

    #else
    #define annotate_reachable()
    #define annotate_unreachable()
    #define __annotate_jump_table
    +#endif
    +
    +#ifndef noinstr
    +#define noinstr noinline notrace
    #define instrumentation_begin() do { } while(0)
    #define instrumentation_end() do { } while(0)
    #endif
    diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
    index ea15ea99efb4..6ed0612bc143 100644
    --- a/include/linux/compiler_types.h
    +++ b/include/linux/compiler_types.h
    @@ -118,10 +118,6 @@ struct ftrace_likely_data {
    #define notrace __attribute__((__no_instrument_function__))
    #endif

    -/* Section for code which can't be instrumented at all */
    -#define noinstr \
    - noinline notrace __attribute((__section__(".noinstr.text")))
    -
    /*
    * it doesn't make sense on ARM (currently the only user of __naked)
    * to trace naked functions because then mcount is called without
    \
     
     \ /
      Last update: 2020-05-18 18:11    [W:2.901 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site