lkml.org 
[lkml]   [2017]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 4/5 v3] ftrace/x86_32: Clean up ftrace_regs_caller
    On Thu, 16 Mar 2017 11:19:44 -0700
    Linus Torvalds <torvalds@linux-foundation.org> wrote:

    > On Thu, Mar 16, 2017 at 11:09 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
    > > +
    > > + /* Since we don't care about cs, move flags there to simplify return */
    > > + movl 14*4(%esp), %eax
    > > + movl %eax, 13*4(%esp)
    > > +
    > > + /* Move return ip back to its original location */
    > > + movl 12*4(%esp), %eax
    > > + movl %eax, 14*4(%esp)
    >
    > Could this perhaps be removed entirely?
    >
    > The return code could instead do:
    >
    > ... restore all the normal registers ..
    >
    > # Now restore flags that is under the return address and our
    > fake __KERNEL_CS
    > pushl 8(%esp)
    > popfl
    >
    > # and then return, skipping __KERNEL_CS and %flasg
    > ret $8
    >
    > which is smaller and simpler than (again) playing games with stack entries.
    >
    > Linus


    The thing is we don't return, we jump to the location that may be
    modified to run the function graph tracer.

    .Lftrace_ret:
    #ifdef CONFIG_FUNCTION_GRAPH_TRACER
    .globl ftrace_graph_call
    ftrace_graph_call:
    jmp ftrace_stub <- this can turn to a jump to function graph tracing
    #endif

    WEAK(ftrace_stub)
    ret
    END(ftrace_caller)


    [...]

    popf /* flags is in the cs location */
    jmp .Lftrace_ret


    -- Steve

    \
     
     \ /
      Last update: 2017-03-16 20:20    [W:4.270 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site