25 May, 2020

4 commits

  • if objdump has below entries;
    c01ed608 :
    c01ed614: e24ddff7 sub sp, sp, #120 ; 0x78

    c01f0d50 :
    c01f0d50: e24dd094 sub sp, sp, #140 ; 0x8c

    scripts fails to read stack usage.
    so making regex $re for ARM similar to aarch64

    Co-developed-by: Vaneet Narang
    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    Signed-off-by: Masahiro Yamada

    Maninder Singh
     
  • To count stack usage of push {*, fp, ip, lr, pc} instruction in ARM,
    if FRAME POINTER is enabled.
    e.g. c01f0d48: e92ddff0 push {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}

    c01f0d50 :
    c01f0d44: e1a0c00d mov ip, sp
    c01f0d48: e92ddff0 push {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
    c01f0d4c: e24cb004 sub fp, ip, #4
    c01f0d50: e24dd094 sub sp, sp, #448 ; 0x1C0

    $ cat dump | scripts/checkstack.pl arm
    0xc01f0d50 Y []: 448

    added subroutine frame work for this.
    After change:
    0xc01f0d500 Y []: 492

    Co-developed-by: Vaneet Narang
    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    Signed-off-by: Masahiro Yamada

    Maninder Singh
     
  • Add arguments support to print stacks which are greater than
    argument value only.

    Co-developed-by: Vaneet Narang
    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    Signed-off-by: Masahiro Yamada

    Maninder Singh
     
  • currently script prints stack usage for functions
    in two ways:($re and $dre)

    dre breaks sorting mechanism.
    0xffffa00011f26f88 sunxi_mux_clk_setup.isra.0 [vmlinux]:Dynamic (0x140)
    ..
    0xffffa00011f27210 sunxi_divs_clk_setup [vmlinux]: Dynamic (0x1d0)

    so we can print it in decimal only.

    Also address before function name is changed to function
    start address rather than stack consumption address.
    Because in next patch, arm has two ways to use stack
    which can be clubbed and printed in one function only.

    All symbols whose stack by adding(re and dre) is greater than
    100, will be printed.

    0xffffa00011f2720c0 sunxi_divs_clk_setup [vmlinux]: 464
    ...
    0xffffa00011f26f840 sunxi_mux_clk_setup.isra.0 [vmlinux]:320

    Co-developed-by: Vaneet Narang
    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    Signed-off-by: Masahiro Yamada

    Maninder Singh
     

05 Jun, 2019

1 commit

  • The following error occurs for the `make ARCH=arm64 checkstack` case:

    aarch64-linux-gnu-objdump -d vmlinux $(find . -name '*.ko') | \
    perl ./scripts/checkstack.pl arm64
    wrong or unknown architecture "arm64"

    As suggested by Masahiro Yamada, fix the above error using regular
    expressions in the same way it was fixed for the `ARCH=x86` case via
    commit fda9f9903be6 ("scripts/checkstack.pl: automatically handle
    32-bit and 64-bit mode for ARCH=x86").

    Suggested-by: Masahiro Yamada
    Signed-off-by: George G. Davis
    Signed-off-by: Masahiro Yamada

    George G. Davis
     

29 Dec, 2018

1 commit

  • This is to track dynamic amount of stack growth for aarch64, so it is
    possible to print out offensive functions that may consume too much stack.
    For example,

    0xffff2000084d1270 try_to_unmap_one [vmlinux]: Dynamic (0xcf0)
    0xffff200008538358 migrate_page_move_mapping [vmlinux]: Dynamic (0xc60)
    0xffff2000081276c8 copy_process.isra.2 [vmlinux]: Dynamic (0xb20)
    0xffff200008424958 show_free_areas [vmlinux]: Dynamic (0xb40)
    0xffff200008545178 __split_huge_pmd_locked [vmlinux]: Dynamic (0xb30)
    0xffff200008555120 collapse_shmem [vmlinux]: Dynamic (0xbc0)
    0xffff20000862e0d0 do_direct_IO [vmlinux]: Dynamic (0xb70)
    0xffff200008cc0aa0 md_do_sync [vmlinux]: Dynamic (0xb90)

    Link: http://lkml.kernel.org/r/20181208025143.39363-1-cai@lca.pw
    Signed-off-by: Qian Cai
    Cc: Catalin Marinas
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Qian Cai
     

15 Dec, 2018

1 commit

  • There is actually a space after "sp," like this,

    ffff2000080813c8: a9bb7bfd stp x29, x30, [sp, #-80]!

    Right now, checkstack.pl isn't able to print anything on aarch64,
    because it won't be able to match the stating objdump line of a function
    due to this missing space. Hence, it displays every stack as zero-size.

    After this patch, checkpatch.pl is able to match the start of a
    function's objdump, and is then able to calculate each function's stack
    correctly.

    Link: http://lkml.kernel.org/r/20181207195843.38528-1-cai@lca.pw
    Signed-off-by: Qian Cai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Qian Cai
     

02 Jul, 2018

1 commit

  • 64-bit ELF v2 ABI specification for POWER describes, on section "General
    Stack Frame Requirements", that the stack should use the following
    instructions when compiled with backchain:

    mflr r0
    std r0, 16(r1)
    stdu r1, -XX(r1)

    Where XX is the frame size for that function, and this is the value
    checkstack.pl will find the stack size for each function.

    This patch also simplifies the entire Powerpc section, since just two
    type of instructions are used, 'stdu' for 64 bits and 'stwu' for 32 bits
    platform.

    Signed-off-by: Breno Leitao
    Signed-off-by: Michael Ellerman

    Breno Leitao
     

26 Mar, 2018

1 commit


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
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

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
     

01 May, 2017

1 commit


25 Feb, 2017

2 commits

  • Pull OpenRISC updates from Stafford Horne:
    "Highlights include:

    - optimized memset and memcpy routines, ~20% boot time saving

    - support for cpu idling

    - adding support for l.swa and l.lwa atomic operations (in spec from
    2014)

    - use atomics to implement: bitops, cmpxchg, futex

    - the atomics are in preparation for SMP support"

    * tag 'openrisc-for-linus' of git://github.com/openrisc/linux: (25 commits)
    openrisc: head: Init r0 to 0 on start
    openrisc: Export ioremap symbols used by modules
    arch/openrisc/lib/memcpy.c: use correct OR1200 option
    openrisc: head: Remove unused strings
    openrisc: head: Move init strings to rodata section
    openrisc: entry: Fix delay slot detection
    openrisc: entry: Whitespace and comment cleanups
    scripts/checkstack.pl: Add openrisc support
    MAINTAINERS: Add the openrisc official repository
    openrisc: Add .gitignore
    openrisc: Add optimized memcpy routine
    openrisc: Add optimized memset
    openrisc: Initial support for the idle state
    openrisc: Fix the bitmask for the unit present register
    openrisc: remove unnecessary stddef.h include
    openrisc: add futex_atomic_* implementations
    openrisc: add optimized atomic operations
    openrisc: add cmpxchg and xchg implementations
    openrisc: add atomic bitops
    openrisc: add l.lwa/l.swa emulation
    ...

    Linus Torvalds
     
  • Openrisc stack pointer is managed by decrementing r1. Add regexes to
    recognize this.

    Signed-off-by: Stafford Horne

    Stafford Horne
     

23 Feb, 2017

1 commit


08 Oct, 2014

1 commit

  • Pull "trivial tree" updates from Jiri Kosina:
    "Usual pile from trivial tree everyone is so eagerly waiting for"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    Remove MN10300_PROC_MN2WS0038
    mei: fix comments
    treewide: Fix typos in Kconfig
    kprobes: update jprobe_example.c for do_fork() change
    Documentation: change "&" to "and" in Documentation/applying-patches.txt
    Documentation: remove obsolete pcmcia-cs from Changes
    Documentation: update links in Changes
    Documentation: Docbook: Fix generated DocBook/kernel-api.xml
    score: Remove GENERIC_HAS_IOMAP
    gpio: fix 'CONFIG_GPIO_IRQCHIP' comments
    tty: doc: Fix grammar in serial/tty
    dma-debug: modify check_for_stack output
    treewide: fix errors in printk
    genirq: fix reference in devm_request_threaded_irq comment
    treewide: fix synchronize_rcu() in comments
    checkstack.pl: port to AArch64
    doc: queue-sysfs: minor fixes
    init/do_mounts: better syntax description
    MIPS: fix comment spelling
    powerpc/simpleboot: fix comment
    ...

    Linus Torvalds
     

28 Aug, 2014

1 commit


09 Aug, 2014

1 commit

  • This patch adds support for ARCH=x86 into checkstack.

    Commit ffee0de411fd ("x86: Default to ARCH=x86 to avoid overriding
    CONFIG_64BIT") had merged ARCH=i386 and ARCH=x86_64 into one ARCH=x86.
    checkstack.pl searches patterns of machine instructions which are
    usually used for allocating stack frames. checkstalk.pl needs either
    i386 or x86_64, x86 isn't enough:

    $ make checkstack
    objdump -d vmlinux $(find . -name '*.ko') | \
    perl linux/scripts/checkstack.pl x86
    wrong or unknown architecture "x86"

    Signed-off-by: Konstantin Khlebnikov
    Cc: David Woodhouse
    Cc: "H. Peter Anvin"
    Cc: Richard Weinberger
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Konstantin Khlebnikov
     

10 Jun, 2014

1 commit


03 Mar, 2013

1 commit


19 May, 2011

1 commit


08 Mar, 2010

1 commit

  • Cleanup checkstack script:
    * Turn on strict checking
    * Fix resulting error message because the declaration syntax
    was incorrect.
    * Remove incorrect and misleading use of prototype
    - prototype not required for this type of sort function
    because $a and $b are being used in this contex
    - if prototype was being used it should be for both arguments
    * Use closure for sort function

    Signed-off-by: Stephen Hemminger
    Cc: Steven Rostedt
    Cc: Arjan van de Ven
    Cc: Cong Wang
    Cc: Michal Marek
    Signed-off-by: Andrew Morton
    Signed-off-by: Michal Marek

    Stephen Hemminger
     

23 Oct, 2008

1 commit


11 Oct, 2008

1 commit

  • With -march=z990 and later gcc can use the long displacement facility
    insruction lay for stack register handling. This patch adopts checkstack
    to catch lay in addition to ahi and aghi.

    Signed-off-by: Christian Borntraeger
    Signed-off-by: Martin Schwidefsky

    Christian Borntraeger
     

26 Jul, 2008

2 commits

  • uname -m was leaving a newline in $arch, and not passing the tests.

    Also, printing the unknown arch on failure is probably helpful.

    Signed-off-by: Eric Sandeen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Currently, checkstack.pl only looks for fixed subtractions from the stack
    pointer. However, things like this:

    void function(int size)
    {
    char stackbuster[size << 2];
    ...

    are certainly worth pointing out, I think.

    This could perhaps be done more cleanly, and the following patch only
    adds "dynamic" REs for x86 and x86_64, but it works:

    0x00b0 crypto_cbc_decrypt_inplace [cbc]: Dynamic (%rax)
    0x00ad crypto_pcbc_decrypt_inplace [pcbc]: Dynamic (%rax)
    0x02f6 crypto_pcbc_encrypt_inplace [pcbc]: Dynamic (%rax)
    0x036c _crypto_xcbc_digest_setkey [xcbc]: Dynamic (%rax)
    ...

    (Inspired by Keith Owens' old stack-check script)

    Signed-off-by: Eric Sandeen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     

07 Feb, 2008

1 commit

  • I have been prime author and maintainer of block2mtd from day one, but
    neither MAINTAINERS nor the module source makes this fact clear. And while
    I'm at it, update my email addresses tree-wide, as the old address
    currently bounces and change my name to "joern" as unicode will likely
    continue to cause trouble until the end of this century.

    Signed-off-by: Joern Engel
    Cc: David Woodhouse
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joern Engel
     

21 Oct, 2007

2 commits

  • * 'master' of hera.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (29 commits)
    [PARISC] fix uninitialized variable warning in asm/rtc.h
    [PARISC] Port checkstack.pl to parisc
    [PARISC] Make palo target work when $obj != $src
    [PARISC] Zap unused variable warnings in pci.c
    [PARISC] Fix tests in palo target
    [PARISC] Fix palo target
    [PARISC] Restore palo target
    [PARISC] Attempt to clean up parisc/Makefile
    [PARISC] Fix infinite loop in /proc/iomem
    [PARISC] Quiet sysfs_create_link __must_check warnings in pdc_stable
    [PARISC] Squelch pci_enable_device __must_check warning in superio
    [PARISC] Kill off broken irqstack code
    [PARISC] Remove hardcoded uses of PAGE_SIZE
    [PARISC] Clean up pointless ASM_PAGE_SIZE_DIV use
    [PARISC] Kill off the last vestiges of ASM_PAGE_SIZE
    [PARISC] Kill off ASM_PAGE_SIZE use
    [PARISC] Beautify parisc vmlinux.lds.S
    [PARISC] Clean up a resource_size_t warning in sba_iommu
    [PARISC] Kill incorrect cast warning in unwinder
    [PARISC] Kill zone_to_nid printk warning
    ...

    Fixed trivial conflict in include/asm-parisc/tlbflush.h manually

    Linus Torvalds
     
  • Signed-off-by: Kyle McMartin

    Kyle McMartin
     

20 Oct, 2007

1 commit


17 Oct, 2007

1 commit

  • Simply fill out the bits in checkstack.pl for Blackfin. I thought I already
    sent this, but I don't see it in -mm anywhere ...

    Signed-off-by: Mike Frysinger
    Cc: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     

11 Oct, 2007

1 commit


25 Aug, 2006

1 commit


26 Jun, 2006

1 commit

  • Finding "init_module" high stack usage problems is challenging when there
    are over 1600 "init_module" functions in the kernel tree, so make
    checkstack.pl print out the filename where the stack usage occurs. This is
    useful for code built as loadable modules.

    For built-in code, it just prints the kernel image file name, like
    "vmlinux". Examples:

    (before patch:)
    0x0000000d callback: 1928
    0xffffffff81678c09 huft_build: 1560
    0x0018 init_module: 1512

    (after patch:)
    0x0000000d callback [divacapi]: 1928
    0xffffffff81678c09 huft_build [vmlinux]: 1560
    0x0018 init_module [hdaps]: 1512

    Also change one if-series to use elsif to cut down on unneeded tests.

    Signed-off-by: Randy Dunlap
    Acked-by: Joern Engel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

11 Apr, 2006

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds