• Frederic Weisbecker's avatar
    tracing/function-graph-tracer: support for x86-64 · 48d68b20
    Frederic Weisbecker authored
    Impact: extend and enable the function graph tracer to 64-bit x86
    
    This patch implements the support for function graph tracer under x86-64.
    Both static and dynamic tracing are supported.
    
    This causes some small CPP conditional asm on arch/x86/kernel/ftrace.c I
    wanted to use probe_kernel_read/write to make the return address
    saving/patching code more generic but it causes tracing recursion.
    
    That would be perhaps useful to implement a notrace version of these
    function for other archs ports.
    
    Note that arch/x86/process_64.c is not traced, as in X86-32. I first
    thought __switch_to() was responsible of crashes during tracing because I
    believed current task were changed inside but that's actually not the
    case (actually yes, but not the "current" pointer).
    
    So I will have to investigate to find the functions that harm here, to
    enable tracing of the other functions inside (but there is no issue at
    this time, while process_64.c stays out of -pg flags).
    
    A little possible race condition is fixed inside this patch too. When the
    tracer allocate a return stack dynamically, the current depth is not
    initialized before but after. An interrupt could occur at this time and,
    after seeing that the return stack is allocated, the tracer could try to
    trace it with a random uninitialized depth. It's a prevention, even if I
    hadn't problems with it.
    Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Tim Bird <tim.bird@am.sony.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    48d68b20
Kconfig 61.3 KB