lkml.org 
[lkml]   [2020]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V2 08/13] ftrace: Add perf text poke events for ftrace trampolines
    Date
    Add perf text poke events for ftrace trampolines when created and when
    freed.

    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    ---
    arch/x86/kernel/ftrace.c | 5 +++++
    1 file changed, 5 insertions(+)

    diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
    index 34e1dd495ce4..cec2ffae9e60 100644
    --- a/arch/x86/kernel/ftrace.c
    +++ b/arch/x86/kernel/ftrace.c
    @@ -410,6 +410,8 @@ static void create_trampoline(struct ftrace_ops *ops)
    ftrace_add_trampoline_to_kallsyms(ops);
    perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL, (u64)trampoline,
    tramp_size, false, FTRACE_TRAMPOLINE_SYM);
    + /* Record the perf text poke event after the ksymbol register event */
    + perf_event_text_poke(trampoline, NULL, 0, trampoline, tramp_size);

    set_vm_flush_reset_perms(trampoline);

    @@ -537,6 +539,9 @@ void arch_ftrace_trampoline_free(struct ftrace_ops *ops)
    if (!ops || !(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
    return;

    + /* Record the text poke event before the ksymbol unregister event */
    + perf_event_text_poke((void *)ops->trampoline, (void *)ops->trampoline,
    + ops->trampoline_size, NULL, 0);
    perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL, (u64)ops->trampoline,
    ops->trampoline_size, true, FTRACE_TRAMPOLINE_SYM);
    /* Remove from kallsyms after the perf events */
    --
    2.17.1
    \
     
     \ /
      Last update: 2020-02-12 13:51    [W:3.779 / U:0.104 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site