10 Aug, 2020

1 commit

  • Commit ea0eada45632 leads to the following build failure on powerpc:

    HOSTCC scripts/recordmcount
    scripts/recordmcount.c: In function 'arm64_is_fake_mcount':
    scripts/recordmcount.c:440: error: 'R_AARCH64_CALL26' undeclared (first use in this function)
    scripts/recordmcount.c:440: error: (Each undeclared identifier is reported only once
    scripts/recordmcount.c:440: error: for each function it appears in.)
    make[2]: *** [scripts/recordmcount] Error 1

    Make sure R_AARCH64_CALL26 is always defined.

    Fixes: ea0eada45632 ("recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64.")
    Signed-off-by: Christophe Leroy
    Acked-by: Steven Rostedt (VMware)
    Acked-by: Gregory Herrero
    Cc: Gregory Herrero
    Link: https://lore.kernel.org/r/5ca1be21fa6ebf73203b45fd9aadd2bafb5e6b15.1597049145.git.christophe.leroy@csgroup.eu
    Signed-off-by: Catalin Marinas

    Christophe Leroy
     

24 Jul, 2020

1 commit

  • Currently, if a section has a relocation to '_mcount' symbol, a new
    __mcount_loc entry will be added whatever the relocation type is.
    This is problematic when a relocation to '_mcount' is in the middle of a
    section and is not a call for ftrace use.

    Such relocation could be generated with below code for example:
    bool is_mcount(unsigned long addr)
    {
    return (target == (unsigned long) &_mcount);
    }

    With this snippet of code, ftrace will try to patch the mcount location
    generated by this code on module load and fail with:

    Call trace:
    ftrace_bug+0xa0/0x28c
    ftrace_process_locs+0x2f4/0x430
    ftrace_module_init+0x30/0x38
    load_module+0x14f0/0x1e78
    __do_sys_finit_module+0x100/0x11c
    __arm64_sys_finit_module+0x28/0x34
    el0_svc_common+0x88/0x194
    el0_svc_handler+0x38/0x8c
    el0_svc+0x8/0xc
    ---[ end trace d828d06b36ad9d59 ]---
    ftrace failed to modify
    [] 0xffffa2dbf3a3a41c
    actual: 66:a9:3c:90
    Initializing ftrace call sites
    ftrace record flags: 2000000
    (0)
    expected tramp: ffffa2dc6cf66724

    So Limit the relocation type to R_AARCH64_CALL26 as in perl version of
    recordmcount.

    Fixes: af64d2aa872a ("ftrace: Add arm64 support to recordmcount")
    Signed-off-by: Gregory Herrero
    Acked-by: Steven Rostedt (VMware)
    Link: https://lore.kernel.org/r/20200717143338.19302-1-gregory.herrero@oracle.com
    Signed-off-by: Catalin Marinas

    Gregory Herrero
     

20 Jan, 2020

1 commit

  • Scenario 1, ARMv7
    =================

    If code in arch/arm/kernel/ftrace.c would operate on mcount() pointer
    the following may be generated:

    00000230 :
    230: b5f8 push {r3, r4, r5, r6, r7, lr}
    232: b500 push {lr}
    234: f7ff fffe bl 0
    234: R_ARM_THM_CALL __gnu_mcount_nc
    238: f240 0600 movw r6, #0
    238: R_ARM_THM_MOVW_ABS_NC __gnu_mcount_nc
    23c: f8d0 1180 ldr.w r1, [r0, #384] ; 0x180

    FTRACE currently is not able to deal with it:

    WARNING: CPU: 0 PID: 0 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1ad/0x230()
    ...
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.116-... #1
    ...
    [] (unwind_backtrace) from [] (show_stack+0x11/0x14)
    [] (show_stack) from [] (dump_stack+0x81/0xa8)
    [] (dump_stack) from [] (warn_slowpath_common+0x69/0x90)
    [] (warn_slowpath_common) from [] (warn_slowpath_null+0x17/0x1c)
    [] (warn_slowpath_null) from [] (ftrace_bug+0x1ad/0x230)
    [] (ftrace_bug) from [] (ftrace_process_locs+0x27d/0x444)
    [] (ftrace_process_locs) from [] (ftrace_init+0x91/0xe8)
    [] (ftrace_init) from [] (start_kernel+0x34b/0x358)
    [] (start_kernel) from [] (0x308095)
    ---[ end trace cb88537fdc8fa200 ]---
    ftrace failed to modify [] prealloc_fixed_plts+0x8/0x60
    actual: 44:f2:e1:36
    ftrace record flags: 0
    (0) expected tramp: c03143e9

    Scenario 2, ARMv4T
    ==================

    ftrace: allocating 14435 entries in 43 pages
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 0 at kernel/trace/ftrace.c:2029 ftrace_bug+0x204/0x310
    CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.5 #1
    Hardware name: Cirrus Logic EDB9302 Evaluation Board
    [] (unwind_backtrace) from [] (show_stack+0x20/0x2c)
    [] (show_stack) from [] (dump_stack+0x20/0x30)
    [] (dump_stack) from [] (__warn+0xdc/0x104)
    [] (__warn) from [] (warn_slowpath_null+0x4c/0x5c)
    [] (warn_slowpath_null) from [] (ftrace_bug+0x204/0x310)
    [] (ftrace_bug) from [] (ftrace_init+0x3b4/0x4d4)
    [] (ftrace_init) from [] (start_kernel+0x20c/0x410)
    [] (start_kernel) from [] ( (null))
    ---[ end trace 0506a2f5dae6b341 ]---
    ftrace failed to modify
    [] perf_trace_sys_exit+0x5c/0xe8
    actual: 1e:ff:2f:e1
    Initializing ftrace call sites
    ftrace record flags: 0
    (0)
    expected tramp: c000fb24

    The analysis for this problem has been already performed previously,
    refer to the link below.

    Fix the above problems by allowing only selected reloc types in
    __mcount_loc. The list itself comes from the legacy recordmcount.pl
    script.

    Link: https://lore.kernel.org/lkml/56961010.6000806@pengutronix.de/
    Cc: stable@vger.kernel.org
    Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount")
    Signed-off-by: Alexander Sverdlin
    Acked-by: Steven Rostedt (VMware)
    Signed-off-by: Russell King

    Alex Sverdlin
     

01 Sep, 2019

8 commits

  • cleanup() mostly frees/unmaps the malloc'd/privately-mapped
    copy of the ELF file recordmcount is working on, which is
    set up in mmap_file(). It also deals with positioning within
    the pseduo prive-mapping of the file and appending to the ELF
    file.

    Split into two steps:
    mmap_cleanup() for the mapping itself
    file_append_cleanup() for allocations storing the
    appended ELF data.

    Also, move the global variable initializations out of the main,
    per-object-file loop and nearer to the alloc/init (mmap_file())
    and two cleanup functions so we can more clearly see how they're
    related.

    Link: http://lkml.kernel.org/r/2a387ac86d133d22c68f57b9933c32bab1d09a2d.1564596289.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • Redundant cleanup calls were introduced when transitioning from
    the old error/success handling via setjmp/longjmp -- the longjmp
    ensured the cleanup() call only happened once but replacing
    the success_file()/fail_file() calls with cleanup() meant that
    multiple cleanup() calls can happen as we return from function
    calls.

    In do_file(), looking just before and after the "goto out" jumps we
    can see that multiple cleanups() are being performed. We remove
    cleanup() calls from the nested functions because it makes the code
    easier to review -- the resources being cleaned up are generally
    allocated and initialized in the callers so freeing them there
    makes more sense.

    Other redundant cleanup() calls:

    mmap_file() is only called from do_file() and, if mmap_file() fails,
    then we goto out and do cleanup() there too.

    write_file() is only called from do_file() and do_file()
    calls cleanup() unconditionally after returning from write_file()
    therefore the cleanup() calls in write_file() are not necessary.

    find_secsym_ndx(), called from do_func()'s for-loop, when we are
    cleaning up here it's obvious that we break out of the loop and
    do another cleanup().

    __has_rel_mcount() is called from two parts of do_func()
    and calls cleanup(). In theory we move them into do_func(), however
    these in turn prove redundant so another simplification step
    removes them as well.

    Link: http://lkml.kernel.org/r/de197e17fc5426623a847ea7cf3a1560a7402a4b.1564596289.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • Fix up the whitespace irregularity in the ELF switch
    blocks.

    Swapping the initial value of gpfx allows us to
    simplify all but one of the one-line switch cases even
    further.

    Link: http://lkml.kernel.org/r/647f21f43723d3e831cedd3238c893db03eea6f0.1564596289.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • The uwrite() and ulseek() functions are formatted inconsistently
    with the rest of the file and the kernel overall. While we're
    making other changes here let's fix this.

    Link: http://lkml.kernel.org/r/4c67698f734be9867a2aba7035fe0ce59e1e4423.1564596289.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • Recordmcount uses setjmp/longjmp to manage control flow as
    it reads and then writes the ELF file. This unusual control
    flow is hard to follow and check in addition to being unlike
    kernel coding style.

    So we rewrite these paths to use regular return values to
    indicate error/success. When an error or previously-completed object
    file is found we return an error code following kernel
    coding conventions -- negative error values and 0 for success when
    we're not returning a pointer. We return NULL for those that fail
    and return non-NULL pointers otherwise.

    One oddity is already_has_rel_mcount -- there we use pointer comparison
    rather than string comparison to differentiate between
    previously-processed object files and returning the name of a text
    section.

    Link: http://lkml.kernel.org/r/8ba8633d4afe444931f363c8d924bf9565b89a86.1564596289.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • uwrite() works within the pseudo-mapping and extends it as necessary
    without needing the file descriptor (fd) parameter passed to it.
    Similarly, ulseek() doesn't need its fd parameter. These parameters
    were only added because the functions bear a conceptual resemblance
    to write() and lseek(). Worse, they obscure the fact that at the time
    uwrite() and ulseek() are called fd_map is not a valid file descriptor.

    Remove the unused file descriptor parameters that make it look like
    fd_map is still valid.

    Link: http://lkml.kernel.org/r/2a136e820ee208469d375265c7b8eb28570749a0.1563992889.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • uread() is only used to initialize the ELF file's pseudo
    private-memory mapping while uwrite() and ulseek() work within
    the pseudo-mapping and extend it as necessary. Thus it is not
    a complementary function to uwrite() and ulseek(). It also makes
    no sense to do cleanups inside uread() when its only caller,
    mmap_file(), is doing the relevant allocations and associated
    initializations.

    Therefore it's clearer to use a plain read() call to initialize the
    data in mmap_file() and remove uread().

    Link: http://lkml.kernel.org/r/31a87c22b19150cec1c8dc800c8b0873a2741703.1563992889.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     
  • The strcmp is unnecessary since .text is already accepted as a
    prefix in the strncmp().

    Link: http://lkml.kernel.org/r/358e590b49adbe4185e161a8b364e323f3d52857.1563992889.git.mhelsley@vmware.com

    Signed-off-by: Matt Helsley
    Signed-off-by: Steven Rostedt (VMware)

    Matt Helsley
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    licensed under the gnu general public license version 2 gplv2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

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

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

    Thomas Gleixner
     

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
     

29 May, 2018

1 commit

  • scripts/kallsyms.c: function write_src:
    "printf", the #1 format specifier "d" need arg type "int",
    but the according arg "table_cnt" has type "unsigned int"

    scripts/recordmcount.c: function do_file:
    "fprintf", the #1 format specifier "d" need arg type "int",
    but the according arg "(*w2)(ehdr->e_machine)" has type "unsigned int"

    scripts/recordmcount.h: function find_secsym_ndx:
    "fprintf", the #1 format specifier "d" need arg type "int",
    but the according arg "txtndx" has type "unsigned int"

    Signed-off-by: nixiaoming
    Acked-by: Steven Rostedt (VMware)
    Signed-off-by: Masahiro Yamada

    nixiaoming
     

23 Feb, 2018

1 commit

  • Now that arch/metag/ has been removed, drop a bunch of metag references
    in various codes across the whole tree:
    - VM_GROWSUP and __VM_ARCH_SPECIFIC_1.
    - MT_METAG_* ELF note types.
    - METAG Kconfig dependencies (FRAME_POINTER) and ranges
    (MAX_STACK_SIZE_MB).
    - metag cases in tools (checkstack.pl, recordmcount.c, perf).

    Signed-off-by: James Hogan
    Acked-by: Steven Rostedt (VMware)
    Acked-by: Peter Zijlstra (Intel)
    Reviewed-by: Guenter Roeck
    Cc: Ingo Molnar
    Cc: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: linux-mm@kvack.org
    Cc: linux-metag@vger.kernel.org

    James Hogan
     

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)
     

15 Nov, 2016

1 commit

  • In similar spirit to x86 and arm64 support, add a make_nop_arm()
    to replace calls to mcount with a nop in sections that aren't
    traced.

    Link: http://lkml.kernel.org/r/20161018234200.5804-1-sboyd@codeaurora.org

    Acked-by: Russell King
    Acked-by: Rabin Vincent
    Signed-off-by: Stephen Boyd
    Signed-off-by: Steven Rostedt

    Stephen Boyd
     

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
     

03 Aug, 2016

1 commit

  • glibc recently did a sync up (94e73c95d9b5 "elf.h: Sync with the gabi
    webpage") that added a #define for EM_METAG but did not add relocations

    This triggers build errors:

    scripts/recordmcount.c: In function 'do_file':
    scripts/recordmcount.c:466:28: error: 'R_METAG_ADDR32' undeclared (first use in this function)
    case EM_METAG: reltype = R_METAG_ADDR32;
    ^~~~~~~~~~~~~~
    scripts/recordmcount.c:466:28: note: each undeclared identifier is reported only once for each function it appears in
    scripts/recordmcount.c:468:20: error: 'R_METAG_NONE' undeclared (first use in this function)
    rel_type_nop = R_METAG_NONE;
    ^~~~~~~~~~~~

    Work around this change with some more #ifdefery for the relocations.

    Fedora Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1354034

    Link: http://lkml.kernel.org/r/1468005530-14757-1-git-send-email-labbott@redhat.com

    Cc: stable@vger.kernel.org # v3.9+
    Cc: James Hogan
    Fixes: 00512bdd4573 ("metag: ftrace support")
    Reported-by: Ross Burton
    Signed-off-by: Laura Abbott
    Signed-off-by: Steven Rostedt

    Laura Abbott
     

05 Jan, 2016

1 commit

  • Fix build warning:

    scripts/recordmcount.c:589:4: warning: format not a string
    literal and no format arguments [-Wformat-security]
    sprintf("%s: failed\n", file);

    Fixes: a50bd43935586 ("ftrace/scripts: Have recordmcount copy the object file")
    Link: http://lkml.kernel.org/r/1451516801-16951-1-git-send-email-colin.king@canonical.com

    Cc: Li Bin
    Cc: Russell King
    Cc: Will Deacon
    Cc: stable@vger.kernel.org # 2.6.37+
    Signed-off-by: Colin Ian King
    Signed-off-by: Steven Rostedt

    Colin Ian King
     

17 Dec, 2015

1 commit

  • Russell King found that he had weird side effects when compiling the kernel
    with hard linked ccache. The reason was that recordmcount modified the
    kernel in place via mmap, and when a file gets modified twice by
    recordmcount, it will complain about it. To fix this issue, Russell wrote a
    patch that checked if the file was hard linked more than once and would
    unlink it if it was.

    Linus Torvalds was not happy with the fact that recordmcount does this in
    place modification. Instead of doing the unlink only if the file has two or
    more hard links, it does the unlink all the time. In otherwords, it always
    does a copy if it changed something. That is, it does the write out if a
    change was made.

    Cc: stable@vger.kernel.org # 2.6.37+
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

16 Dec, 2015

1 commit

  • recordmcount edits the file in-place, which can cause problems when
    using ccache in hardlink mode. Arrange for recordmcount to break a
    hardlinked object.

    Link: http://lkml.kernel.org/r/E1a7MVT-0000et-62@rmk-PC.arm.linux.org.uk

    Cc: stable@vger.kernel.org # 2.6.37+
    Signed-off-by: Russell King
    Signed-off-by: Steven Rostedt

    Russell King
     

03 Nov, 2015

2 commits

  • By now, the recordmcount only records the function that in
    following sections:
    .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
    .kprobes.text/.text.unlikely

    For the function that not in these sections, the call mcount
    will be in place and not be replaced when kernel boot up. And
    it will bring performance overhead, such as do_mem_abort (in
    .exception.text section). This patch make the call mcount to
    nop for this case in recordmcount.

    Link: http://lkml.kernel.org/r/1446019445-14421-1-git-send-email-huawei.libin@huawei.com
    Link: http://lkml.kernel.org/r/1446193864-24593-4-git-send-email-huawei.libin@huawei.com

    Cc:
    Cc:
    Cc:
    Cc: # 3.18+
    Acked-by: Will Deacon
    Signed-off-by: Li Bin
    Signed-off-by: Steven Rostedt

    Li Bin
     
  • Although, the default value of rel_type_nop is zero, and the value
    of R_386_NONE/R_X86_64_NONE is zero too, but it should be assigned
    a meaningful value explicitly, otherwise it looks confused.

    Assign R_386_NONE to rel_type_nop for 386, assign R_X86_64_NONE
    to rel_type_nop for x86_64.

    Link: http://lkml.kernel.org/r/1446020606-16352-1-git-send-email-huawei.libin@huawei.com

    Signed-off-by: Li Bin
    Signed-off-by: Steven Rostedt

    Li Bin
     

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


13 Jun, 2014

1 commit

  • Pull kbuild misc updates from Michal Marek:
    "This is the non-critical part of kbuild for v3.16-rc1:
    - make deb-pkg can do s390x and arm64
    - new patterns in scripts/tags.sh
    - scripts/tags.sh skips userspace tools' sources (which sometimes
    have copies of kernel structures) and symlinks
    - improvements to the objdiff tool
    - two new coccinelle patches
    - other minor fixes"

    * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    scripts: objdiff: support directories for the augument of record command
    scripts: objdiff: fix a comment
    scripts: objdiff: change the extension of disassembly from .o to .dis
    scripts: objdiff: improve path flexibility for record command
    scripts: objdiff: remove unnecessary code
    scripts: objdiff: direct error messages to stderr
    scripts: objdiff: get the path to .tmp_objdiff more simply
    deb-pkg: Add automatic support for s390x architecture
    coccicheck: Add unneeded return variable test
    kbuild: Fix a typo in documentation
    kbuild: trivial - use tabs for code indent where possible
    kbuild: trivial - remove trailing empty lines
    coccinelle: Check for missing NULL terminators in of_device_id tables
    scripts/tags.sh: ignore symlink'ed source files
    scripts/tags.sh: add regular expression replacement pattern for memcg
    builddeb: add arm64 in the supported architectures
    builddeb: use $OBJCOPY variable instead of objcopy
    scripts/tags.sh: ignore code of user space tools
    scripts/tags.sh: add pattern for DEFINE_HASHTABLE
    .gitignore: ignore Module.symvers in all directories

    Linus Torvalds
     

10 Jun, 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
     

03 Mar, 2013

1 commit


17 May, 2011

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

10 Mar, 2011

1 commit


04 Dec, 2010

1 commit