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
     

04 Jul, 2017

1 commit

  • Pull timer updates from Thomas Gleixner:
    "A rather large update for timers/timekeeping:

    - compat syscall consolidation (Al Viro)

    - Posix timer consolidation (Christoph Helwig / Thomas Gleixner)

    - Cleanup of the device tree based initialization for clockevents and
    clocksources (Daniel Lezcano)

    - Consolidation of the FTTMR010 clocksource/event driver (Linus
    Walleij)

    - The usual set of small fixes and updates all over the place"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (93 commits)
    timers: Make the cpu base lock raw
    clocksource/drivers/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()'
    clocksource/drivers/fsl_ftm_timer: Unmap region obtained by of_iomap
    clocksource/drivers/tcb_clksrc: Make IO endian agnostic
    clocksource/drivers/sun4i: Switch to the timer-of common init
    clocksource/drivers/timer-of: Fix invalid iomap check
    Revert "ktime: Simplify ktime_compare implementation"
    clocksource/drivers: Fix uninitialized variable use in timer_of_init
    kselftests: timers: Add test for frequency step
    kselftests: timers: Fix inconsistency-check to not ignore first timestamp
    time: Add warning about imminent deprecation of CONFIG_GENERIC_TIME_VSYSCALL_OLD
    time: Clean up CLOCK_MONOTONIC_RAW time handling
    posix-cpu-timers: Make timespec to nsec conversion safe
    itimer: Make timeval to nsec conversion range limited
    timers: Fix parameter description of try_to_del_timer_sync()
    ktime: Simplify ktime_compare implementation
    clocksource/drivers/fttmr010: Factor out clock read code
    clocksource/drivers/fttmr010: Implement delay timer
    clocksource/drivers: Add timer-of common init routine
    clocksource/drivers/tcb_clksrc: Save timer context on suspend/resume
    ...

    Linus Torvalds
     

29 Jun, 2017

1 commit

  • The only user of thread_saved_pc() in non-arch-specific code was removed
    in commit 8243d5597793 ("sched/core: Remove pointless printout in
    sched_show_task()"). Remove the implementations as well.

    Some architectures use thread_saved_pc() in their arch-specific code.
    Leave their thread_saved_pc() intact.

    Signed-off-by: Tobias Klauser
    Acked-by: Geert Uytterhoeven
    Cc: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Tobias Klauser
     

14 Jun, 2017

1 commit


29 Mar, 2017

2 commits

  • Merge PTRACE_SETREGSET leakage fixes from Dave Martin:
    "This series is the collection of fixes I proposed on this topic, that
    have not yet appeared upstream or in the stable branches,

    The issue can leak kernel stack, but doesn't appear to allow userspace
    to attack the kernel directly. The affected architectures are c6x,
    h8300, metag, mips and sparc.

    [ Mark Salter points out that c6x has no MMU or other mechanism to
    prevent userspace access to kernel code or data on c6x, but it
    doesn't hurt to clean that case up too. ]

    The bugs arise from use of user_regset_copyin(). Users of
    user_regset_copyin() can work in one of two ways:

    1) Copy directly to thread_struct or equivalent. (This seems to be
    the design assumption of the regset API, and is the most common
    approach.)

    2) Copy to a local variable and then transfer to thread_struct. (A
    significant minority of cases.)

    Buggy code typically involves approach 2"

    * emailed patches from Dave Martin :
    sparc/ptrace: Preserve previous registers for short regset write
    mips/ptrace: Preserve previous registers for short regset write
    metag/ptrace: Reject partial NT_METAG_RPIPE writes
    metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS
    metag/ptrace: Preserve previous registers for short regset write
    h8300/ptrace: Fix incorrect register transfer count
    c6x/ptrace: Remove useless PTRACE_SETREGSET implementation

    Linus Torvalds
     
  • regs_set() and regs_get() are vulnerable to an off-by-1 buffer overrun
    if CONFIG_CPU_H8S is set, since this adds an extra entry to
    register_offset[] but not to user_regs_struct.

    So, iterate over user_regs_struct based on its actual size, not based on
    the length of register_offset[].

    Signed-off-by: Dave Martin
    Signed-off-by: Linus Torvalds

    Dave Martin
     

07 Mar, 2017

1 commit

  • Fix the following h8300 build failures:

    arch/h8300/kernel/ptrace_h.c: In function ‘trace_trap’:
    arch/h8300/kernel/ptrace_h.c:253:3: error: implicit declaration of function ‘force_sig’

    Signed-off-by: Guenter Roeck
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Yoshinori Sato
    Cc: uclinux-h8-devel@lists.sourceforge.jp
    Fixes: c3edc4010e9d ("sched/headers: Move task_struct::signal and ...")
    Link: http://lkml.kernel.org/r/1488738434-3504-1-git-send-email-linux@roeck-us.net
    Signed-off-by: Ingo Molnar

    Guenter Roeck
     

02 Mar, 2017

5 commits


25 Jan, 2017

1 commit

  • Most dma_map_ops structures are never modified. Constify these
    structures such that these can be write-protected. This patch
    has been generated as follows:

    git grep -l 'struct dma_map_ops' |
    xargs -d\\n sed -i \
    -e 's/struct dma_map_ops/const struct dma_map_ops/g' \
    -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \
    -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \
    -e 's/const const struct dma_map_ops /const struct dma_map_ops /g';
    sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \
    $(git grep -l 'struct dma_map_ops intel_dma_ops');
    sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \
    $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc);
    sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \
    -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \
    -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \
    drivers/pci/host/*.c
    sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c
    sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c
    sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c

    Signed-off-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Benjamin Herrenschmidt
    Cc: Boris Ostrovsky
    Cc: David Woodhouse
    Cc: Juergen Gross
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: linux-arch@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Russell King
    Cc: x86@kernel.org
    Signed-off-by: Doug Ledford

    Bart Van Assche
     

25 Dec, 2016

1 commit


28 Oct, 2016

1 commit

  • Back in commit f56141e3e2d9 ("all arches, signal: move restart_block to
    struct task_struct"), all architectures and core code were changed to
    use task_struct::restart_block. However, when h8300 support was
    subsequently restored in v4.2, it was not updated to account for this,
    and maintains thread_info::restart_block, which is not kept in sync.

    This patch drops the redundant restart_block from thread_info, and moves
    h8300 to the common one in task_struct, ensuring that syscall restarting
    always works as expected.

    Fixes: f56141e3e2d9 ("all arches, signal: move restart_block to struct task_struct")
    Link: http://lkml.kernel.org/r/1476714934-11635-1-git-send-email-mark.rutland@arm.com
    Signed-off-by: Mark Rutland
    Cc: Andy Lutomirski
    Cc: Yoshinori Sato
    Cc: uclinux-h8-devel@lists.sourceforge.jp
    Cc: [4.2+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rutland
     

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
     

04 Aug, 2016

1 commit

  • The dma-mapping core and the implementations do not change the DMA
    attributes passed by pointer. Thus the pointer can point to const data.
    However the attributes do not have to be a bitfield. Instead unsigned
    long will do fine:

    1. This is just simpler. Both in terms of reading the code and setting
    attributes. Instead of initializing local attributes on the stack
    and passing pointer to it to dma_set_attr(), just set the bits.

    2. It brings safeness and checking for const correctness because the
    attributes are passed by value.

    Semantic patches for this change (at least most of them):

    virtual patch
    virtual context

    @r@
    identifier f, attrs;

    @@
    f(...,
    - struct dma_attrs *attrs
    + unsigned long attrs
    , ...)
    {
    ...
    }

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
    )

    and

    // Options: --all-includes
    virtual patch
    virtual context

    @r@
    identifier f, attrs;
    type t;

    @@
    t f(..., struct dma_attrs *attrs);

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
    )

    Link: http://lkml.kernel.org/r/1468399300-5399-2-git-send-email-k.kozlowski@samsung.com
    Signed-off-by: Krzysztof Kozlowski
    Acked-by: Vineet Gupta
    Acked-by: Robin Murphy
    Acked-by: Hans-Christian Noren Egtvedt
    Acked-by: Mark Salter [c6x]
    Acked-by: Jesper Nilsson [cris]
    Acked-by: Daniel Vetter [drm]
    Reviewed-by: Bart Van Assche
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Fabien Dessenne [bdisp]
    Reviewed-by: Marek Szyprowski [vb2-core]
    Acked-by: David Vrabel [xen]
    Acked-by: Konrad Rzeszutek Wilk [xen swiotlb]
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Richard Kuo [hexagon]
    Acked-by: Geert Uytterhoeven [m68k]
    Acked-by: Gerald Schaefer [s390]
    Acked-by: Bjorn Andersson
    Acked-by: Hans-Christian Noren Egtvedt [avr32]
    Acked-by: Vineet Gupta [arc]
    Acked-by: Robin Murphy [arm64 and dma-iommu]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Krzysztof Kozlowski
     

25 Mar, 2016

1 commit


20 Jan, 2016

4 commits


15 Dec, 2015

1 commit

  • For the sake of consistency, let rename all ctrl_out/in calls to the write/read
    calls so we have the same API consistent with the other architectures hence
    open the door for the increasing of the test compilation coverage.

    The unsigned long coercive cast is removed because all variables are set to
    the right type "void __iomem *".

    Signed-off-by: Daniel Lezcano

    Daniel Lezcano
     

12 Nov, 2015

1 commit


08 Nov, 2015

1 commit


23 Jun, 2015

6 commits


17 Sep, 2013

1 commit


04 Jul, 2013

2 commits

  • Merge first patch-bomb from Andrew Morton:
    - various misc bits
    - I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been
    distracted. There has been quite a bit of activity.
    - About half the MM queue
    - Some backlight bits
    - Various lib/ updates
    - checkpatch updates
    - zillions more little rtc patches
    - ptrace
    - signals
    - exec
    - procfs
    - rapidio
    - nbd
    - aoe
    - pps
    - memstick
    - tools/testing/selftests updates

    * emailed patches from Andrew Morton : (445 commits)
    tools/testing/selftests: don't assume the x bit is set on scripts
    selftests: add .gitignore for kcmp
    selftests: fix clean target in kcmp Makefile
    selftests: add .gitignore for vm
    selftests: add hugetlbfstest
    self-test: fix make clean
    selftests: exit 1 on failure
    kernel/resource.c: remove the unneeded assignment in function __find_resource
    aio: fix wrong comment in aio_complete()
    drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode
    drivers/memstick/host/r592.c: convert to module_pci_driver
    drivers/memstick/host/jmb38x_ms: convert to module_pci_driver
    pps-gpio: add device-tree binding and support
    drivers/pps/clients/pps-gpio.c: convert to module_platform_driver
    drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
    drivers/parport/share.c: use kzalloc
    Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
    aoe: update internal version number to v83
    aoe: update copyright date
    aoe: perform I/O completions in parallel
    ...

    Linus Torvalds
     
  • Generate mandatory global variables __bss_start/__bss_stop in
    file vmlinux.lds.

    Also remove one unused declaration of _text.

    Signed-off-by: Jiang Liu
    Cc: Yoshinori Sato
    Cc: Jiang Liu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     

23 Jun, 2013

2 commits

  • The CALL() macro abstracts (a.o.) the underscore symbol prefix.

    Signed-off-by: Geert Uytterhoeven

    Geert Uytterhoeven
     
  • Commit e1b5bb6d1236d4ad2084c53aa83dde7cdf6f8eea ("consolidate cond_syscall
    and SYSCALL_ALIAS declarations") broke the h8300 build because it removed
    the duplicate SYMBOL_NAME() macro from arch/h8300/include/asm/linkage.h,
    and all the h8300 asm files include instead of
    :

    arch/h8300/kernel/entry.S: Assembler messages:
    arch/h8300/kernel/entry.S:158: Error: junk at end of line, first unrecognized character is `('
    ...
    arch/h8300/kernel/syscalls.S: Assembler messages:
    arch/h8300/kernel/syscalls.S:6: Error: junk at end of line, first unrecognized character is `('
    ...
    arch/h8300/lib/abs.S: Assembler messages:
    arch/h8300/lib/abs.S:12: Error: junk at end of line, first unrecognized character is `('
    ...
    arch/h8300/lib/memcpy.S: Assembler messages:
    arch/h8300/lib/memcpy.S:13: Error: junk at end of line, first unrecognized character is `('
    ...
    arch/h8300/lib/memset.S: Assembler messages:
    arch/h8300/lib/memset.S:13: Error: junk at end of line, first unrecognized character is `('
    ...

    Commit 126de6b20bfb82cc19012d5048f11f339ae5a021 ("linkage.h: fix build
    breakage due to symbol prefix handling") broke it even more, by removing
    SYMBOL_NAME() and replacing it by __SYMBOL_NAME().

    Commit f8ce1faf55955de62e0a12e330c6d9a526071f65 ("Merge tag
    'modules-next-for-linus' of
    git://git.kernel.org/pub/scm/linuxkernel/git/rusty/linux")
    also removed __SYMBOL_NAME(), hidden in a merge conflict resolution.

    Hence, replace the use of SYMBOL_NAME() and SYMBOL_NAME_LABEL() in h8300
    assembler sources by hardcoding the underscore symbol prefix, like other
    architectures (blackfin/metag) do.

    This allows to kill SYMBOL_NAME_LABEL(). Now becomes empty,
    and h8300 can be switched to asm-generic/linkage.h.

    Signed-off-by: Geert Uytterhoeven

    Geert Uytterhoeven
     

05 May, 2013

1 commit


02 May, 2013

1 commit

  • Pull VFS updates from Al Viro,

    Misc cleanups all over the place, mainly wrt /proc interfaces (switch
    create_proc_entry to proc_create(), get rid of the deprecated
    create_proc_read_entry() in favor of using proc_create_data() and
    seq_file etc).

    7kloc removed.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
    don't bother with deferred freeing of fdtables
    proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
    proc: Make the PROC_I() and PDE() macros internal to procfs
    proc: Supply a function to remove a proc entry by PDE
    take cgroup_open() and cpuset_open() to fs/proc/base.c
    ppc: Clean up scanlog
    ppc: Clean up rtas_flash driver somewhat
    hostap: proc: Use remove_proc_subtree()
    drm: proc: Use remove_proc_subtree()
    drm: proc: Use minor->index to label things, not PDE->name
    drm: Constify drm_proc_list[]
    zoran: Don't print proc_dir_entry data in debug
    reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
    proc: Supply an accessor for getting the data from a PDE's parent
    airo: Use remove_proc_subtree()
    rtl8192u: Don't need to save device proc dir PDE
    rtl8187se: Use a dir under /proc/net/r8180/
    proc: Add proc_mkdir_data()
    proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
    proc: Move PDE_NET() to fs/proc/proc_net.c
    ...

    Linus Torvalds
     

01 May, 2013

2 commits

  • show_regs() is inherently arch-dependent but it does make sense to print
    generic debug information and some archs already do albeit in slightly
    different forms. This patch introduces a generic function to print debug
    information from show_regs() so that different archs print out the same
    information and it's much easier to modify what's printed.

    show_regs_print_info() prints out the same debug info as dump_stack()
    does plus task and thread_info pointers.

    * Archs which didn't print debug info now do.

    alpha, arc, blackfin, c6x, cris, frv, h8300, hexagon, ia64, m32r,
    metag, microblaze, mn10300, openrisc, parisc, score, sh64, sparc,
    um, xtensa

    * Already prints debug info. Replaced with show_regs_print_info().
    The printed information is superset of what used to be there.

    arm, arm64, avr32, mips, powerpc, sh32, tile, unicore32, x86

    * s390 is special in that it used to print arch-specific information
    along with generic debug info. Heiko and Martin think that the
    arch-specific extra isn't worth keeping s390 specfic implementation.
    Converted to use the generic version.

    Note that now all archs print the debug info before actual register
    dumps.

    An example BUG() dump follows.

    kernel BUG at /work/os/work/kernel/workqueue.c:4841!
    invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #7
    Hardware name: empty empty/S3992, BIOS 080011 10/26/2007
    task: ffff88007c85e040 ti: ffff88007c860000 task.ti: ffff88007c860000
    RIP: 0010:[] [] init_workqueues+0x4/0x6
    RSP: 0000:ffff88007c861ec8 EFLAGS: 00010246
    RAX: ffff88007c861fd8 RBX: ffffffff824466a8 RCX: 0000000000000001
    RDX: 0000000000000046 RSI: 0000000000000001 RDI: ffffffff8234a07a
    RBP: ffff88007c861ec8 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff8234a07a
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    FS: 0000000000000000(0000) GS:ffff88007dc00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: ffff88015f7ff000 CR3: 00000000021f1000 CR4: 00000000000007f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Stack:
    ffff88007c861ef8 ffffffff81000312 ffffffff824466a8 ffff88007c85e650
    0000000000000003 0000000000000000 ffff88007c861f38 ffffffff82335e5d
    ffff88007c862080 ffffffff8223d8c0 ffff88007c862080 ffffffff81c47760
    Call Trace:
    [] do_one_initcall+0x122/0x170
    [] kernel_init_freeable+0x9b/0x1c8
    [] ? rest_init+0x140/0x140
    [] kernel_init+0xe/0xf0
    [] ret_from_fork+0x7c/0xb0
    [] ? rest_init+0x140/0x140
    ...

    v2: Typo fix in x86-32.

    v3: CPU number dropped from show_regs_print_info() as
    dump_stack_print_info() has been updated to print it. s390
    specific implementation dropped as requested by s390 maintainers.

    Signed-off-by: Tejun Heo
    Acked-by: David S. Miller
    Acked-by: Jesper Nilsson
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Bjorn Helgaas
    Cc: Fengguang Wu
    Cc: Mike Frysinger
    Cc: Vineet Gupta
    Cc: Sam Ravnborg
    Acked-by: Chris Metcalf [tile bits]
    Acked-by: Richard Kuo [hexagon bits]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     
  • Both dump_stack() and show_stack() are currently implemented by each
    architecture. show_stack(NULL, NULL) dumps the backtrace for the
    current task as does dump_stack(). On some archs, dump_stack() prints
    extra information - pid, utsname and so on - in addition to the
    backtrace while the two are identical on other archs.

    The usages in arch-independent code of the two functions indicate
    show_stack(NULL, NULL) should print out bare backtrace while
    dump_stack() is used for debugging purposes when something went wrong,
    so it does make sense to print additional information on the task which
    triggered dump_stack().

    There's no reason to require archs to implement two separate but mostly
    identical functions. It leads to unnecessary subtle information.

    This patch expands the dummy fallback dump_stack() implementation in
    lib/dump_stack.c such that it prints out debug information (taken from
    x86) and invokes show_stack(NULL, NULL) and drops arch-specific
    dump_stack() implementations in all archs except blackfin. Blackfin's
    dump_stack() does something wonky that I don't understand.

    Debug information can be printed separately by calling
    dump_stack_print_info() so that arch-specific dump_stack()
    implementation can still emit the same debug information. This is used
    in blackfin.

    This patch brings the following behavior changes.

    * On some archs, an extra level in backtrace for show_stack() could be
    printed. This is because the top frame was determined in
    dump_stack() on those archs while generic dump_stack() can't do that
    reliably. It can be compensated by inlining dump_stack() but not
    sure whether that'd be necessary.

    * Most archs didn't use to print debug info on dump_stack(). They do
    now.

    An example WARN dump follows.

    WARNING: at kernel/workqueue.c:4841 init_workqueues+0x35/0x505()
    Hardware name: empty
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #9
    0000000000000009 ffff88007c861e08 ffffffff81c614dc ffff88007c861e48
    ffffffff8108f50f ffffffff82228240 0000000000000040 ffffffff8234a03c
    0000000000000000 0000000000000000 0000000000000000 ffff88007c861e58
    Call Trace:
    [] dump_stack+0x19/0x1b
    [] warn_slowpath_common+0x7f/0xc0
    [] warn_slowpath_null+0x1a/0x20
    [] init_workqueues+0x35/0x505
    ...

    v2: CPU number added to the generic debug info as requested by s390
    folks and dropped the s390 specific dump_stack(). This loses %ksp
    from the debug message which the maintainers think isn't important
    enough to keep the s390-specific dump_stack() implementation.

    dump_stack_print_info() is moved to kernel/printk.c from
    lib/dump_stack.c. Because linkage is per objecct file,
    dump_stack_print_info() living in the same lib file as generic
    dump_stack() means that archs which implement custom dump_stack()
    - at this point, only blackfin - can't use dump_stack_print_info()
    as that will bring in the generic version of dump_stack() too. v1
    The v1 patch broke build on blackfin due to this issue. The build
    breakage was reported by Fengguang Wu.

    Signed-off-by: Tejun Heo
    Acked-by: David S. Miller
    Acked-by: Vineet Gupta
    Acked-by: Jesper Nilsson
    Acked-by: Vineet Gupta
    Acked-by: Martin Schwidefsky [s390 bits]
    Cc: Heiko Carstens
    Cc: Mike Frysinger
    Cc: Fengguang Wu
    Cc: Bjorn Helgaas
    Cc: Sam Ravnborg
    Acked-by: Richard Kuo [hexagon bits]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo