17 May, 2011

14 commits

  • Do the mcount offset adjustment in the recordmcount.pl/recordmcount.[ch]
    at compile time and not in ftrace_call_adjust at run time.

    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Steven Rostedt

    Martin Schwidefsky
     
  • Do the mcount offset adjustment in the recordmcount.pl/recordmcount.[ch]
    at compile time and not in ftrace_call_adjust at run time.

    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Steven Rostedt

    Martin Schwidefsky
     
  • Introduce mcount_adjust{,_32,_64} to the C implementation of
    recordmcount analog to $mcount_adjust in the perl script.
    The adjustment is added to the address of the relocations
    against the mcount symbol. If this adjustment is done by
    recordmcount at compile time the ftrace_call_adjust function
    can be turned into a nop.

    Cc: John Reiser
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Steven Rostedt

    Martin Schwidefsky
     
  • The code to get the symbol, string, and relp pointers in the two functions
    sift_rel_mcount() and nop_mcount() are identical and also non-trivial.
    Moving this duplicate code into a single helper function makes the code
    easier to read and more maintainable.

    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023739.723658553@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • The code in sift_rel_mcount() and nop_mcount() to get the mcount symbol
    number is identical. Replace the two locations with a call to a function
    that does the work.

    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023739.488093407@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • The section called .discard.text has tracing attached to it and is
    currently ignored by ftrace. But it does include a call to the mcount
    stub. Adding a notrace to the code keeps gcc from adding the useless
    mcount caller to it.

    Link: http://lkml.kernel.org/r/20110421023739.243651696@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • The init and exit sections should not be traced and adding a call to
    mcount to them is a waste of text and instruction cache. Have the
    macro section attributes include notrace to ignore these functions
    for tracing from the build.

    Link: http://lkml.kernel.org/r/20110421023738.953028219@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • When mcount is called in a section that ftrace will not modify it into
    a nop, we want to warn about this. But not warn about this always. Now
    if the user builds the kernel with the option RECORDMCOUNT_WARN=1 then
    the build will warn about mcount callers that are ignored and will just
    waste execution time.

    Acked-by: Michal Marek
    Cc: linux-kbuild@vger.kernel.org
    Link: http://lkml.kernel.org/r/20110421023738.714956282@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • There's some sections that should not have mcount recorded and should not have
    modifications to the that code. But currently they waste some time by calling
    mcount anyway (which simply returns). As the real answer should be to
    either whitelist the section or have gcc ignore it fully.

    This change adds a option to recordmcount to warn when it finds a section
    that is ignored by ftrace but still contains mcount callers. This is not on
    by default as developers may not know if the section should be completely
    ignored or added to the whitelist.

    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023738.476989377@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • There are sections that are ignored by ftrace for the function tracing because
    the text is in a section that can be removed without notice. The mcount calls
    in these sections are ignored and ftrace never sees them. The downside of this
    is that the functions in these sections still call mcount. Although the mcount
    function is defined in assembly simply as a return, this added overhead is
    unnecessary.

    The solution is to convert these callers into nops at compile time.
    A better solution is to add 'notrace' to the section markers, but as new sections
    come up all the time, it would be nice that they are delt with when they
    are created.

    Later patches will deal with finding these sections and doing the proper solution.

    Thanks to H. Peter Anvin for giving me the right nops to use for x86.

    Cc: "H. Peter Anvin"
    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023738.237101176@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • PROGBITS is not enough to determine if the section should be modified
    or not. Only process sections that are marked as executable.

    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023737.991485123@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • The .kprobe.text section is safe to modify mcount to nop and tracing.
    Add it to the whitelist in recordmcount.c and recordmcount.pl.

    Cc: John Reiser
    Cc: Masami Hiramatsu
    Link: http://lkml.kernel.org/r/20110421023737.743350547@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • The Linux style for switch statements is:

    switch (var) {
    case x:
    [...]
    break;
    }

    Not:
    switch (var) {
    case x: {
    [...]
    } break;

    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023737.523968644@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • The Linux ftrace subsystem style for comparing is:

    var == 1
    var > 0

    and not:

    1 == var
    0 < var

    It is considered that Linux developers are smart enough not to do the

    if (var = 1)

    mistake.

    Cc: John Reiser
    Link: http://lkml.kernel.org/r/20110421023737.290712238@goodmis.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

12 May, 2011

1 commit

  • Both warning and warning_symbol are nowhere used.
    Let's get rid of them.

    Signed-off-by: Richard Weinberger
    Cc: Oleg Nesterov
    Cc: Andrew Morton
    Cc: Huang Ying
    Cc: Soeren Sandmann Pedersen
    Cc: Namhyung Kim
    Cc: x86
    Cc: H. Peter Anvin
    Cc: Thomas Gleixner
    Cc: Robert Richter
    Cc: Paul Mundt
    Link: http://lkml.kernel.org/r/1305205872-10321-2-git-send-email-richard@nod.at
    Signed-off-by: Frederic Weisbecker

    Richard Weinberger
     

10 May, 2011

25 commits