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
     

14 Dec, 2009

1 commit

  • 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 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.

    For more information please look at code and Documentation/trace folder.

    Steven ACK that scripts/recordmcount.pl part.

    Acked-by: Steven Rostedt
    Signed-off-by: Michal Simek

    Michal Simek
     

18 Nov, 2009

1 commit

  • If the user has an older version of objcopy, that can not handle
    converting local symbols to global and vice versa, then some
    functions will not be part of the dynamic function tracer. The current
    code in recordmcount.pl will print a warning in this case. Unfortunately,
    there exists lots of files that may have this issue with older objcopys
    and this will cause a warning for every file compiled with this
    issue.

    This patch solves this overwhelming output by creating a
    .tmp_quiet_recordmcount file on the first instance the warning is
    encountered. The warning will not print if this file exists.

    The temp file is deleted at the beginning of the compile to ensure that
    the warning will happen once again on new compiles (because the issue
    is still present).

    Reported-by: Andrew Morton
    Cc: Sam Ravnborg
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

30 Oct, 2009

8 commits