31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    licensed under the terms of the gnu gpl license version 2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 62 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.929121379@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

09 May, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - allow users to invoke 'make' out of the source tree

    - refactor scripts/mkmakefile

    - deprecate KBUILD_SRC, which was used to track the source tree
    location for O= build.

    - fix recordmcount.pl in case objdump output is localized

    - turn unresolved symbols in external modules to errors from warnings
    by default; pass KBUILD_MODPOST_WARN=1 to get them back to warnings

    - generate modules.builtin.modinfo to collect .modinfo data from
    built-in modules

    - misc Makefile cleanups

    * tag 'kbuild-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (21 commits)
    .gitignore: add more all*.config patterns
    moduleparam: Save information about built-in modules in separate file
    Remove MODULE_ALIAS() calls that take undefined macro
    .gitignore: add leading and trailing slashes to generated directories
    scripts/tags.sh: fix direct execution of scripts/tags.sh
    scripts: override locale from environment when running recordmcount.pl
    samples: kobject: allow CONFIG_SAMPLE_KOBJECT to become y
    samples: seccomp: turn CONFIG_SAMPLE_SECCOMP into a bool option
    kbuild: move Documentation to vmlinux-alldirs
    kbuild: move samples/ to KBUILD_VMLINUX_OBJS
    modpost: make KBUILD_MODPOST_WARN also configurable for external modules
    kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build
    kbuild: remove unneeded dependency for include/config/kernel.release
    memory: squash drivers/memory/Makefile.asm-offsets
    kbuild: use $(srctree) instead of KBUILD_SRC to check out-of-tree build
    kbuild: mkmakefile: generate a simple wrapper of top Makefile
    kbuild: mkmakefile: do not check the generated Makefile marker
    kbuild: allow Kbuild to start from any directory
    kbuild: pass $(MAKECMDGOALS) to sub-make as is
    kbuild: fix warning "overriding recipe for target 'Makefile'"
    ...

    Linus Torvalds
     

03 May, 2019

1 commit

  • recordmcount.pl uses a set of regular expressions to parse the output of
    objdump(1). However, if objdump(1) output is localized, it may not match
    the regular expressions, thereby preventing recordmcount.pl from parsing
    object files correctly.

    In order to allow recordmcount.pl to function correctly regardless of the
    current locale settings, set LANG=C when running objdump(1). LC_ALL is
    already unset in the top-level Makefile, so it is not necessary to also
    override that environment variable.

    Signed-off-by: Daniel Dadap
    Reviewed-by: Robert Morell
    Signed-off-by: Masahiro Yamada

    Daniel Dadap
     

22 Apr, 2019

1 commit

  • Support dynamic ftrace including dynamic graph tracer. Gcc-csky with -pg
    will produce call site in every function prologue and we can use these
    call site to hook trace function.

    gcc with -pg origin call site:
    push lr
    jbsr _mcount
    nop32
    nop32

    If the (callee - caller)'s offset is in range of bsr instruction, we'll
    modify code with:
    push lr
    bsr _mcount
    nop32
    nop32
    Else if the (callee - caller)'s offset is out of bsr instrunction, we'll
    modify code with:
    push lr
    movih r26, ...
    ori r26, ...
    jsr r26

    (r26 is reserved for jsr link reg in csky abiv2 spec.)

    Signed-off-by: Guo Ren

    Guo Ren
     

09 Dec, 2018

1 commit

  • When building with -ffunction-sections, the compiler will place each
    function into its own ELF section, prefixed with ".text". For example,
    a simple test module with functions test_module_do_work() and
    test_module_wq_func():

    % objdump --section-headers test_module.o | awk '/\.text/{print $2}'
    .text
    .text.test_module_do_work
    .text.test_module_wq_func
    .init.text
    .exit.text

    Adjust the recordmcount scripts to look for ".text" as a section name
    prefix. This will ensure that those functions will be included in the
    __mcount_loc relocations:

    % objdump --reloc --section __mcount_loc test_module.o
    OFFSET TYPE VALUE
    0000000000000000 R_X86_64_64 .text.test_module_do_work
    0000000000000008 R_X86_64_64 .text.test_module_wq_func
    0000000000000010 R_X86_64_64 .init.text

    Link: http://lkml.kernel.org/r/1542745158-25392-2-git-send-email-joe.lawrence@redhat.com

    Signed-off-by: Joe Lawrence
    Signed-off-by: Steven Rostedt (VMware)

    Joe Lawrence
     

04 Sep, 2018

1 commit


01 Jun, 2018

1 commit

  • The powerpc toolchain can compile combinations of 32/64 bit and
    big/little endian, so it's convenient to consider, e.g.,

    `CC -m64 -mbig-endian`

    To be the C compiler for the purpose of invoking it to build target
    artifacts. So overriding the CC variable to include these flags works
    for this purpose.

    Unfortunately that is not compatible with the way the proposed new
    Kconfig macro language will work.

    After previous patches in this series, these flags can be carefully
    passed in using flags instead.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     

05 Apr, 2018

1 commit

  • …l/git/palmer/riscv-linux

    Pull RISC-V updates from Palmer Dabbelt:
    "This contains the new features we'd like to incorporate into the
    RISC-V port for 4.17. We might have a bit more stuff land later in the
    merge window, but I wanted to get this out earlier just so everyone
    can see where we currently stand.

    A short summary of the changes is:

    - We've added support for dynamic ftrace on RISC-V targets.

    - There have been a handful of cleanups to our atomic and locking
    routines. They now more closely match the released RISC-V memory
    model draft.

    - Our module loading support has been cleaned up and is now enabled
    by default, despite some limitations still existing.

    - A patch to define COMMANDLINE_FORCE instead of COMMANDLINE_OVERRIDE
    so the generic device tree code picks up handling all our command
    line stuff.

    There's more information in the merge commits for each patch set"

    * tag 'riscv-for-linus-4.17-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux: (21 commits)
    RISC-V: Rename CONFIG_CMDLINE_OVERRIDE to CONFIG_CMDLINE_FORCE
    RISC-V: Add definition of relocation types
    RISC-V: Enable module support in defconfig
    RISC-V: Support SUB32 relocation type in kernel module
    RISC-V: Support ADD32 relocation type in kernel module
    RISC-V: Support ALIGN relocation type in kernel module
    RISC-V: Support RVC_BRANCH/JUMP relocation type in kernel modulewq
    RISC-V: Support HI20/LO12_I/LO12_S relocation type in kernel module
    RISC-V: Support CALL relocation type in kernel module
    RISC-V: Support GOT_HI20/CALL_PLT relocation type in kernel module
    RISC-V: Add section of GOT.PLT for kernel module
    RISC-V: Add sections of PLT and GOT for kernel module
    riscv/atomic: Strengthen implementations with fences
    riscv/spinlock: Strengthen implementations with fences
    riscv/barrier: Define __smp_{store_release,load_acquire}
    riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support
    riscv/ftrace: Add DYNAMIC_FTRACE_WITH_REGS support
    riscv/ftrace: Add ARCH_SUPPORTS_FTRACE_OPS support
    riscv/ftrace: Add dynamic function graph tracer support
    riscv/ftrace: Add dynamic function tracer support
    ...

    Linus Torvalds
     

03 Apr, 2018

1 commit


26 Mar, 2018

1 commit


14 May, 2017

1 commit

  • The default NetBSD package manager is pkgsrc and it installs Perl
    along other third party programs under custom and configurable prefix.
    The default prefix for binary prebuilt packages is /usr/pkg, and the
    Perl executable lands in /usr/pkg/bin/perl.

    This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's
    the most portable solution that should work for almost everybody.
    Perl's executable is detected automatically.

    This change switches -w option passed to the executable with more
    modern "use warnings;" approach. There is no functional change to the
    default behavior.

    While there, drop "require 5" from scripts/namespace.pl (Perl from 1994?).

    Signed-off-by: Kamil Rytarowski
    Signed-off-by: Masahiro Yamada

    Kamil Rytarowski
     

25 Mar, 2017

1 commit

  • Adding a hook into free_reserve_area() that informs ftrace that boot up init
    text is being free, lets ftrace safely remove those init functions from its
    records, which keeps ftrace from trying to modify text that no longer
    exists.

    Note, this still does not allow for tracing .init text of modules, as
    modules require different work for freeing its init code.

    Link: http://lkml.kernel.org/r/1488502497.7212.24.camel@linux.intel.com

    Cc: linux-mm@kvack.org
    Cc: Vlastimil Babka
    Cc: Mel Gorman
    Cc: Peter Zijlstra
    Requested-by: Todd Brandt
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

28 Feb, 2017

1 commit

  • Fix typos and add the following to the scripts/spelling.txt:

    swith||switch
    swithable||switchable
    swithed||switched
    swithing||switching

    While we are here, fix the "update" to "updates" in the touched hunk in
    drivers/net/wireless/marvell/mwifiex/wmm.c.

    Link: http://lkml.kernel.org/r/1481573103-11329-2-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

08 Oct, 2016

1 commit

  • When doing an nmi backtrace of many cores, most of which are idle, the
    output is a little overwhelming and very uninformative. Suppress
    messages for cpus that are idling when they are interrupted and just
    emit one line, "NMI backtrace for N skipped: idling at pc 0xNNN".

    We do this by grouping all the cpuidle code together into a new
    .cpuidle.text section, and then checking the address of the interrupted
    PC to see if it lies within that section.

    This commit suitably tags x86 and tile idle routines, and only adds in
    the minimal framework for other architectures.

    Link: http://lkml.kernel.org/r/1472487169-14923-5-git-send-email-cmetcalf@mellanox.com
    Signed-off-by: Chris Metcalf
    Acked-by: Peter Zijlstra (Intel)
    Tested-by: Peter Zijlstra (Intel)
    Tested-by: Daniel Thompson [arm]
    Tested-by: Petr Mladek
    Cc: Aaron Tomlin
    Cc: Peter Zijlstra (Intel)
    Cc: "Rafael J. Wysocki"
    Cc: Russell King
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chris Metcalf
     

29 Sep, 2016

1 commit

  • be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into
    separate sections") added .softirqentry.text section, but it was not added
    to recordmcount. So functions in the section are untracable. Add the
    section to scripts/recordmcount.c and scripts/recordmcount.pl.

    Fixes: be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections")
    Link: http://lkml.kernel.org/r/1474902626-73468-1-git-send-email-dvyukov@google.com
    Signed-off-by: Dmitry Vyukov
    Acked-by: Steve Rostedt
    Cc: [4.6+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Vyukov
     

13 Jan, 2016

1 commit

  • If a text section starts out with a data blob before the first
    function start label, disassembly parsing doing in recordmcount.pl
    gets confused on powerpc, leading to creation of corrupted module
    objects.

    This was not a problem so far since the compiler would never create
    such text sections. However, this has changed with a recent change
    in GCC 6 to support distances of > 2GB between a function and its
    assoicated TOC in the ELFv2 ABI, exposing this problem.

    There is already code in recordmcount.pl to handle such data blobs
    on the sparc64 platform. This patch uses the same method to handle
    those on powerpc as well.

    Cc: stable@vger.kernel.org
    Acked-by: Steven Rostedt
    Signed-off-by: Ulrich Weigand
    Signed-off-by: Michael Ellerman

    Ulrich Weigand
     

12 Feb, 2015

1 commit

  • Pull s390 updates from Martin Schwidefsky:

    - The remaining patches for the z13 machine support: kernel build
    option for z13, the cache synonym avoidance, SMT support,
    compare-and-delay for spinloops and the CES5S crypto adapater.

    - The ftrace support for function tracing with the gcc hotpatch option.
    This touches common code Makefiles, Steven is ok with the changes.

    - The hypfs file system gets an extension to access diagnose 0x0c data
    in user space for performance analysis for Linux running under z/VM.

    - The iucv hvc console gets wildcard spport for the user id filtering.

    - The cacheinfo code is converted to use the generic infrastructure.

    - Cleanup and bug fixes.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (42 commits)
    s390/process: free vx save area when releasing tasks
    s390/hypfs: Eliminate hypfs interval
    s390/hypfs: Add diagnose 0c support
    s390/cacheinfo: don't use smp_processor_id() in preemptible context
    s390/zcrypt: fixed domain scanning problem (again)
    s390/smp: increase maximum value of NR_CPUS to 512
    s390/jump label: use different nop instruction
    s390/jump label: add sanity checks
    s390/mm: correct missing space when reporting user process faults
    s390/dasd: cleanup profiling
    s390/dasd: add locking for global_profile access
    s390/ftrace: hotpatch support for function tracing
    ftrace: let notrace function attribute disable hotpatching if necessary
    ftrace: allow architectures to specify ftrace compile options
    s390: reintroduce diag 44 calls for cpu_relax()
    s390/zcrypt: Add support for new crypto express (CEX5S) adapter.
    s390/zcrypt: Number of supported ap domains is not retrievable.
    s390/spinlock: add compare-and-delay to lock wait loops
    s390/tape: remove redundant if statement
    s390/hvc_iucv: add simple wildcard matches to the iucv allow filter
    ...

    Linus Torvalds
     

29 Jan, 2015

1 commit

  • Make use of gcc's hotpatch support to generate better code for ftrace
    function tracing.
    The generated code now contains only a six byte nop in each function
    prologue instead of a 24 byte code block which will be runtime patched to
    support function tracing.
    With the new code generation the runtime overhead for supporting function
    tracing is close to zero, while the original code did show a significant
    performance impact.

    Acked-by: Steven Rostedt
    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

20 Jan, 2015

1 commit

  • Compiling SH with gcc-4.8 fails due to the -m32 option not being
    supported.

    From http://buildd.debian-ports.org/status/fetch.php?pkg=linux&arch=sh4&ver=3.16.7-ckt4-1&stamp=1421425783

    CC init/main.o
    gcc-4.8: error: unrecognized command line option '-m32'
    ld: cannot find init/.tmp_mc_main.o: No such file or directory
    objcopy: 'init/.tmp_mx_main.o': No such file
    rm: cannot remove 'init/.tmp_mx_main.o': No such file or directory
    rm: cannot remove 'init/.tmp_mc_main.o': No such file or directory

    Link: http://lkml.kernel.org/r/1421537778-29001-1-git-send-email-kernel@mkarcher.dialup.fu-berlin.de
    Link: http://lkml.kernel.org/r/54BCBDD4.10102@physik.fu-berlin.de

    Cc: stable@vger.kernel.org
    Cc: Matt Fleming
    Reported-by: John Paul Adrian Glaubitz
    Signed-off-by: Michael Karcher
    Signed-off-by: Steven Rostedt

    Michael Karcher
     

27 Oct, 2014

1 commit

  • If the function tracer is enabled, allow to set kprobes on the first
    instruction of a function (which is the function trace caller):

    If no kprobe is set handling of enabling and disabling function tracing
    of a function simply patches the first instruction. Either it is a nop
    (right now it's an unconditional branch, which skips the mcount block),
    or it's a branch to the ftrace_caller() function.

    If a kprobe is being placed on a function tracer calling instruction
    we encode if we actually have a nop or branch in the remaining bytes
    after the breakpoint instruction (illegal opcode).
    This is possible, since the size of the instruction used for the nop
    and branch is six bytes, while the size of the breakpoint is only
    two bytes.
    Therefore the first two bytes contain the illegal opcode and the last
    four bytes contain either "0" for nop or "1" for branch. The kprobes
    code will then execute/simulate the correct instruction.

    Instruction patching for kprobes and function tracer is always done
    with stop_machine(). Therefore we don't have any races where an
    instruction is patched concurrently on a different cpu.
    Besides that also the program check handler which executes the function
    trace caller instruction won't be executed concurrently to any
    stop_machine() execution.

    This allows to keep full fault based kprobes handling which generates
    correct pt_regs contents automatically.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

09 Oct, 2014

1 commit


29 May, 2014

1 commit

  • Recordmcount utility under scripts is run, after compiling each object,
    to find out all the locations of calling _mcount() and put them into
    specific seciton named __mcount_loc.
    Then linker collects all such information into a table in the kernel image
    (between __start_mcount_loc and __stop_mcount_loc) for later use by ftrace.

    This patch adds arm64 specific definitions to identify such locations.
    There are two types of implementation, C and Perl. On arm64, only C version
    is used to build the kernel now that CONFIG_HAVE_C_RECORDMCOUNT is on.
    But Perl version is also maintained.

    This patch also contains a workaround just in case where a header file,
    elf.h, on host machine doesn't have definitions of EM_AARCH64 nor
    R_AARCH64_ABS64. Without them, compiling C version of recordmcount will
    fail.

    Acked-by: Will Deacon
    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Will Deacon

    AKASHI Takahiro
     

06 Dec, 2013

1 commit


06 Nov, 2013

1 commit

  • With gcc 4.6.0 the -mfentry feature places the function profiling call
    at the start of the function. When this is used, the call is to
    __fentry__ and not mcount. This is required for Ksplice as the C
    version of recordmcount doesn't insert section symbols for the
    __mcount_loc section so we fall back to the perl version.

    Based on 48bb5dc6cd9d30fe0d594947563da1f8bd9abada (ftrace: Make
    recordmcount.c handle __fentry__).
    Link: http://lkml.kernel.org/r/1383648129-10724-1-git-send-email-jamie.iles@oracle.com

    Signed-off-by: Jamie Iles
    Signed-off-by: Steven Rostedt

    Jamie Iles
     

30 Aug, 2013

1 commit


17 May, 2011

3 commits


10 Mar, 2011

1 commit


02 Sep, 2010

2 commits

  • Handle the different nop and call instructions for Thumb-2. Also, we
    need to adjust the recorded mcount_loc addresses because they have the
    lsb set.

    Cc: Catalin Marinas
    Acked-by: Steven Rostedt [recordmcount.pl change]
    Signed-off-by: Rabin Vincent
    Signed-off-by: Russell King

    Rabin Vincent
     
  • This adds mcount recording and updates dynamic ftrace for ARM to work
    with the new ftrace dyamic tracing implementation. It also adds support
    for the mcount format used by newer ARM compilers.

    With dynamic tracing, mcount() is implemented as a nop. Callsites are
    patched on startup with nops, and dynamically patched to call to the
    ftrace_caller() routine as needed.

    Acked-by: Steven Rostedt [recordmcount.pl change]
    Signed-off-by: Rabin Vincent
    Signed-off-by: Russell King

    Rabin Vincent
     

16 Aug, 2010

1 commit


12 Aug, 2010

1 commit


23 Jul, 2010

1 commit

  • I found this issue in a locally patched 2.6.32.x, current kernels have
    moved the offending code to an __init function which is skipped by
    recordmcount.pl, so the bug is not currently being exercised.
    However, I think the patch is still a good idea, to avoid future
    problems if _mcount were to ever have its address taken in normal
    code.

    This is what I originally saw:

    Although arch/mips/kernel/ftrace.c is built without -pg, and thus
    contains no calls to _mcount, it does use the address of _mcount
    in ftrace_make_nop(). This was causing relocations to be emitted
    for _mcount which recordmcount.pl erronously took to be _mcount
    call sites. The result was that the text of ftrace_make_nop()
    would be patched with garbage leading to a system crash.

    In non-module code, all _mcount call sites will have R_MIPS_26
    relocations, so we restrict $mcount_regex to only match on these.

    Acked-by: Ralf Baechle
    Acked-by: Wu Zhangjin
    Signed-off-by: David Daney
    LKML-Reference:
    Cc: Li Hong
    Cc: Ingo Molnar
    Cc: Matt Fleming
    Signed-off-by: Steven Rostedt

    David Daney
     

26 Feb, 2010

1 commit


12 Jan, 2010

1 commit


07 Jan, 2010

2 commits


17 Dec, 2009

2 commits

  • With dynamic function tracer, by default, _mcount is defined as an
    "empty" function, it returns directly without any more action . When
    enabling it in user-space, it will jump to a real tracing
    function(ftrace_caller), and do the real job for us.

    Differ from the static function tracer, dynamic function tracer provides
    two functions ftrace_make_call()/ftrace_make_nop() to enable/disable the
    tracing of some indicated kernel functions(set_ftrace_filter).

    In the -v4 version, the implementation of this support is basically the same as
    X86 version does: _mcount is implemented as an empty function and ftrace_caller
    is implemented as a real tracing function respectively.

    But in this version, to support module tracing with the help of
    -mlong-calls in arch/mips/Makefile:

    MODFLAGS += -mlong-calls.

    The stuff becomes a little more complex. We need to cope with two
    different type of calling to _mcount.

    For the kernel part, the calling to _mcount(result of "objdump -hdr
    vmlinux"). is like this:

    108: 03e0082d move at,ra
    10c: 0c000000 jal 0
    10c: R_MIPS_26 _mcount
    10c: R_MIPS_NONE *ABS*
    10c: R_MIPS_NONE *ABS*
    110: 00020021 nop

    For the module with -mlong-calls, it looks like this:

    c: 3c030000 lui v1,0x0
    c: R_MIPS_HI16 _mcount
    c: R_MIPS_NONE *ABS*
    c: R_MIPS_NONE *ABS*
    10: 64630000 daddiu v1,v1,0
    10: R_MIPS_LO16 _mcount
    10: R_MIPS_NONE *ABS*
    10: R_MIPS_NONE *ABS*
    14: 03e0082d move at,ra
    18: 0060f809 jalr v1

    In the kernel version, there is only one "_mcount" string for every
    kernel function, so, we just need to match this one in mcount_regex of
    scripts/recordmcount.pl, but in the module version, we need to choose
    one of the two to match. Herein, I choose the first one with
    "R_MIPS_HI16 _mcount".

    and In the kernel verion, without module tracing support, we just need
    to replace "jal _mcount" by "jal ftrace_caller" to do real tracing, and
    filter the tracing of some kernel functions via replacing it by a nop
    instruction.

    but as we have described before, the instruction "jal ftrace_caller" only left
    32bit length for the address of ftrace_caller, it will fail when calling from
    the module space. so, herein, we must replace something else.

    the basic idea is loading the address of ftrace_caller to v1 via changing these
    two instructions:

    lui v1,0x0
    addiu v1,v1,0

    If we want to enable the tracing, we need to replace the above instructions to:

    lui v1, HI_16BIT_ftrace_caller
    addiu v1, v1, LOW_16BIT_ftrace_caller

    If we want to stop the tracing of the indicated kernel functions, we
    just need to replace the "jalr v1" to a nop instruction. but we need to
    replace two instructions and encode the above two instructions
    oursevles.

    Is there a simpler solution? Yes! Here it is, in this version, we put _mcount
    and ftrace_caller together, which means the address of _mcount and
    ftrace_caller is the same:

    _mcount:
    ftrace_caller:
    j ftrace_stub
    nop

    ...(do real tracing here)...

    ftrace_stub:
    jr ra
    move ra, at

    By default, the kernel functions call _mcount, and then jump to ftrace_stub and
    return. and when we want to do real tracing, we just need to remove that "j
    ftrace_stub", and it will run through the two "nop" instructions and then do
    the real tracing job.

    what about filtering job? we just need to do this:

    lui v1, hi_16bit_of_mcount b 1f (0x10000004)
    addiu v1, v1, low_16bit_of_mcount
    move at, ra
    jalr v1
    nop
    1f: (rec->ip + 12)

    In linux-mips64, there will be some local symbols, whose name are
    prefixed by $L, which need to be filtered. thanks goes to Steven for
    writing the mips64-specific function_regex.

    In a conclusion, with RISC, things becomes easier with such a "stupid"
    trick, RISC is something like K.I.S.S, and also, there are lots of
    "simple" tricks in the whole ftrace support, thanks goes to Steven and
    the other folks for providing such a wonderful tracing framework!

    Signed-off-by: Wu Zhangjin
    Cc: Nicholas Mc Guire
    Cc: zhangfx@lemote.com
    Cc: Wu Zhangjin
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Frederic Weisbecker
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: http://patchwork.linux-mips.org/patch/675/
    Acked-by: Steven Rostedt
    Signed-off-by: Ralf Baechle

    Wu Zhangjin
     
  • MIPS and some other architectures need this argument to handle
    big/little endian respectively.

    Signed-off-by: Wu Zhangjin
    Cc: Nicholas Mc Guire
    Cc: zhangfx@lemote.com
    Cc: Wu Zhangjin
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Frederic Weisbecker
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: http://patchwork.linux-mips.org/patch/674/
    Acked-by: Steven Rostedt
    Signed-off-by: Ralf Baechle

    Wu Zhangjin