lkml.org 
[lkml]   [2020]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch V4 part 1 20/36] vmlinux.lds.h: Create section for protection against instrumentation
    On Wed, May 06, 2020 at 09:08:31AM -0700, Sean Christopherson wrote:
    > On Tue, May 05, 2020 at 03:16:22PM +0200, Thomas Gleixner wrote:
    > > Provide also a set of markers: instr_begin()/end()
    > >
    > > These are used to mark code inside a noinstr function which calls
    > > into regular instrumentable text section as safe.
    >
    > ...
    >
    > > --- a/include/linux/compiler.h
    > > +++ b/include/linux/compiler.h
    > > @@ -120,10 +120,27 @@ void ftrace_likely_update(struct ftrace_
    > > /* Annotate a C jump table to allow objtool to follow the code flow */
    > > #define __annotate_jump_table __section(.rodata..c_jump_table)
    > >
    > > +/* Begin/end of an instrumentation safe region */
    > > +#define instr_begin() ({ \
    > > + asm volatile("%c0:\n\t" \
    > > + ".pushsection .discard.instr_begin\n\t" \
    > > + ".long %c0b - .\n\t" \
    > > + ".popsection\n\t" : : "i" (__COUNTER__)); \
    > > +})
    > > +
    > > +#define instr_end() ({ \
    > > + asm volatile("%c0:\n\t" \
    > > + ".pushsection .discard.instr_end\n\t" \
    > > + ".long %c0b - .\n\t" \
    > > + ".popsection\n\t" : : "i" (__COUNTER__)); \
    > > +})
    >
    > Any chance we could spell these out, i.e. instrumentation_begin/end()? I
    > can't help but read these as "instruction_begin/end". At a glance, the
    > long names shouldn't cause any wrap/indentation issues.

    The kernel naming convention is insn for instruction, not instr. That
    said, you're not the first to be confused by this.

    \
     
     \ /
      Last update: 2020-05-06 18:29    [W:4.335 / U:0.652 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site