1. 01 May, 2013 40 commits
    • Vyacheslav Dubeyko's avatar
      nilfs2: fix issue with flush kernel thread after remount in RO mode because of... · 8c26c4e2
      Vyacheslav Dubeyko authored
      nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption
      
      The NILFS2 driver remounts itself in RO mode in the case of discovering
      metadata corruption (for example, discovering a broken bmap).  But
      usually, this takes place when there have been file system operations
      before remounting in RO mode.
      
      Thereby, NILFS2 driver can be in RO mode with presence of dirty pages in
      modified inodes' address spaces.  It results in flush kernel thread's
      infinite trying to flush dirty pages in RO mode.  As a result, it is
      possible to see such side effects as: (1) flush kernel thread occupies
      50% - 99% of CPU time; (2) system can't be shutdowned without manual
      power switch off.
      
      SYMPTOMS:
      (1) System log contains error message: "Remounting filesystem read-only".
      (2) The flush kernel thread occupies 50% - 99% of CPU time.
      (3) The system can't be shutdowned without manual power switch off.
      
      REPRODUCTION PATH:
      (1) Create volume group with name "unencrypted" by means of vgcreate utility.
      (2) Run script (prepared by Anthony Doggett <Anthony2486@interfaces.org.uk>):
      
        ----------------[BEGIN SCRIPT]--------------------
        #!/bin/bash
      
        VG=unencrypted
        #apt-get install nilfs-tools darcs
        lvcreate --size 2G --name ntest $VG
        mkfs.nilfs2 -b 1024 -B 8192 /dev/mapper/$VG-ntest
        mkdir /var/tmp/n
        mkdir /var/tmp/n/ntest
        mount /dev/mapper/$VG-ntest /var/tmp/n/ntest
        mkdir /var/tmp/n/ntest/thedir
        cd /var/tmp/n/ntest/thedir
        sleep 2
        date
        darcs init
        sleep 2
        dmesg|tail -n 5
        date
        darcs whatsnew || true
        date
        sleep 2
        dmesg|tail -n 5
        ----------------[END SCRIPT]--------------------
      
      (3) Try to shutdown the system.
      
      REPRODUCIBILITY: 100%
      
      FIX:
      
      This patch implements checking mount state of NILFS2 driver in
      nilfs_writepage(), nilfs_writepages() and nilfs_mdt_write_page()
      methods.  If it is detected the RO mount state then all dirty pages are
      simply discarded with warning messages is written in system log.
      
      [akpm@linux-foundation.org: fix printk warning]
      Signed-off-by: default avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Acked-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Cc: Anthony Doggett <Anthony2486@interfaces.org.uk>
      Cc: ARAI Shun-ichi <hermes@ceres.dti.ne.jp>
      Cc: Piotr Szymaniak <szarpaj@grubelek.pl>
      Cc: Zahid Chowdhury <zahid.chowdhury@starsolutions.com>
      Cc: Elmer Zhang <freeboy6716@gmail.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8c26c4e2
    • Dan Carpenter's avatar
      i2o: check copy_from_user() size parameter · 9151b398
      Dan Carpenter authored
      Limit the size of the copy so we don't corrupt memory.  Hopefully this
      can only be called by root, but fixing this makes the static checkers
      happier.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Masanari Iida <standby24x7@gmail.com>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9151b398
    • Ben Hutchings's avatar
      dmi_scan: refactor dmi_scan_machine(), {smbios,dmi}_present() · 79bae42d
      Ben Hutchings authored
      Move the calls to memcpy_fromio() up into the loop in
      dmi_scan_machine(), and move the signature checks back down into
      dmi_decode().  We need to check at 16-byte intervals but keep a 32-byte
      buffer for an SMBIOS entry, so shift the buffer after each iteration.
      
      Merge smbios_present() into dmi_present(), so we look for an SMBIOS
      signature at the beginning of the given buffer and then for a DMI
      signature at an offset of 16 bytes.
      
      [artem.savkov@gmail.com: use proper buf type in dmi_present()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Reported-by: default avatarTim McGrath <tmhikaru@gmail.com>
      Tested-by: default avatarTim Mcgrath <tmhikaru@gmail.com>
      Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com>
      Signed-off-by: default avatarArtem Savkov <artem.savkov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      79bae42d
    • Jiri Kosina's avatar
      binfmt_elf: PIE: make PF_RANDOMIZE check comment more accurate · c1d025e2
      Jiri Kosina authored
      The comment I originally added in commit a3defbe5 ("binfmt_elf: fix
      PIE execution with randomization disabled") is not really 100% accurate
      -- sysctl is not the only way how PF_RANDOMIZE could be forcibly unset
      in runtime.
      
      Another option of course is direct modification of personality flags
      (i.e.  running through setarch wrapper).
      
      Make the comment more explicit and accurate.
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c1d025e2
    • Josh Triplett's avatar
      fs: make binfmt support for #! scripts modular and removable · 2535e0d7
      Josh Triplett authored
      Add a new configuration option CONFIG_BINFMT_SCRIPT to configure support
      for interpreted scripts starting with "#!"; allow compiling out that
      support, or building it as a module.  Embedded systems running exclusively
      compiled binaries could leave this support out, and systems that don't
      need scripts before mounting the root filesystem can build this as a
      module.
      Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2535e0d7
    • Eric Wong's avatar
      epoll: cleanup: use RCU_INIT_POINTER when nulling · d6d67e72
      Eric Wong authored
      It is always safe to use RCU_INIT_POINTER to NULL a pointer.  This results
      in slightly smaller/faster code.
      Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d6d67e72
    • Eric Wong's avatar
      epoll: cleanup: hoist out f_op->poll calls · 450d89ec
      Eric Wong authored
      This reduces the amount of code inside the ready list iteration loops for
      better readability IMHO.
      Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
      Cc: Davide Libenzi <davidel@xmailserver.org>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      450d89ec
    • Eric Wong's avatar
      epoll: lock ep->mtx in ep_free to silence lockdep · ddf676c3
      Eric Wong authored
      Technically we do not need to hold ep->mtx during ep_free since we are
      certain there are no other users of ep at that point.  However, lockdep
      complains with a "suspicious rcu_dereference_check() usage!" message; so
      lock the mutex before ep_remove to silence the warning.
      Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Davide Libenzi <davidel@xmailserver.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: NeilBrown <neilb@suse.de>,
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ddf676c3
    • Eric Wong's avatar
      epoll: use RCU to protect wakeup_source in epitem · eea1d585
      Eric Wong authored
      This prevents wakeup_source destruction when a user hits the item with
      EPOLL_CTL_MOD while ep_poll_callback is running.
      
      Tested with CONFIG_SPARSE_RCU_POINTER=y and "make fs/eventpoll.o C=2"
      Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Davide Libenzi <davidel@xmailserver.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: NeilBrown <neilb@suse.de>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eea1d585
    • Eric Wong's avatar
      epoll: trim epitem by one cache line · 39732ca5
      Eric Wong authored
      It is common for epoll users to have thousands of epitems, so saving a
      cache line on every allocation leads to large memory savings.
      
      Since epitem allocations are cache-aligned, reducing sizeof(struct
      epitem) from 136 bytes to 128 bytes will allow it to squeeze under a
      cache line boundary on x86_64.
      
      Via /sys/kernel/slab/eventpoll_epi, I see the following changes on my
      x86_64 Core2 Duo (which has 64-byte cache alignment):
      
      	object_size  :  192 => 128
      	objs_per_slab:   21 =>  32
      
      Also, add a BUILD_BUG_ON() to check for future accidental breakage.
      
      [akpm@linux-foundation.org: use __packed, for all architectures]
      Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
      Cc: Davide Libenzi <davidel@xmailserver.org>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      39732ca5
    • Stephen Rothwell's avatar
      kernel/timer.c: move some non timer related syscalls to kernel/sys.c · 4a22f166
      Stephen Rothwell authored
      Andrew Morton noted:
      
      	akpm3:/usr/src/25> grep SYSCALL kernel/timer.c
      	SYSCALL_DEFINE1(alarm, unsigned int, seconds)
      	SYSCALL_DEFINE0(getpid)
      	SYSCALL_DEFINE0(getppid)
      	SYSCALL_DEFINE0(getuid)
      	SYSCALL_DEFINE0(geteuid)
      	SYSCALL_DEFINE0(getgid)
      	SYSCALL_DEFINE0(getegid)
      	SYSCALL_DEFINE0(gettid)
      	SYSCALL_DEFINE1(sysinfo, struct sysinfo __user *, info)
      	COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
      
      	Only one of those should be in kernel/timer.c.  Who wrote this thing?
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4a22f166
    • Stephen Rothwell's avatar
      kernel/timer.c: convert compat_sys_sysinfo to COMPAT_SYSCALL_DEFINE · 1043f65a
      Stephen Rothwell authored
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1043f65a
    • Stephen Rothwell's avatar
      kernel/compat.c: make do_sysinfo() static · 1a0df594
      Stephen Rothwell authored
      The only use outside of kernel/timer.c was in kernel/compat.c, so move
      compat_sys_sysinfo() next to sys_sysinfo() in kernel/timer.c.
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1a0df594
    • Andy Shevchenko's avatar
      binfmt_misc: reuse string_unescape_inplace() · 8d82e180
      Andy Shevchenko authored
      There is string_unescape_inplace() function which decodes strings in generic
      way. Let's use it.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8d82e180
    • Andy Shevchenko's avatar
      dynamic_debug: reuse generic string_unescape function · d338b137
      Andy Shevchenko authored
      There is kernel function to do the job in generic way. Let's use it.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d338b137
    • Andy Shevchenko's avatar
      staging: speakup: remove custom string_unescape_any_inplace · 576d742e
      Andy Shevchenko authored
      There is generic implementation of the function to unescape strings.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: William Hubbs <w.d.hubbs@gmail.com>
      Cc: Chris Brannon <chris@the-brannons.com>
      Cc: Kirk Reiser <kirk@braille.uwo.ca>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      576d742e
    • Andy Shevchenko's avatar
      lib/string_helpers: introduce generic string_unescape · 16c7fa05
      Andy Shevchenko authored
      There are several places in kernel where modules unescapes input to convert
      C-Style Escape Sequences into byte codes.
      
      The patch provides generic implementation of such approach. Test cases are
      also included into the patch.
      
      [akpm@linux-foundation.org: clarify comment]
      [akpm@linux-foundation.org: export get_random_int() to modules]
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: William Hubbs <w.d.hubbs@gmail.com>
      Cc: Chris Brannon <chris@the-brannons.com>
      Cc: Kirk Reiser <kirk@braille.uwo.ca>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      16c7fa05
    • Andrew Morton's avatar
      kernel/smp.c: cleanups · e1d12f32
      Andrew Morton authored
      We sometimes use "struct call_single_data *data" and sometimes "struct
      call_single_data *csd".  Use "csd" consistently.
      
      We sometimes use "struct call_function_data *data" and sometimes "struct
      call_function_data *cfd".  Use "cfd" consistently.
      
      Also, avoid some 80-col layout tricks.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Shaohua Li <shli@fusionio.com>
      Cc: Shaohua Li <shli@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e1d12f32
    • Fan Du's avatar
      include/linux/fs.h: disable preempt when acquire i_size_seqcount write lock · 74e3d1e1
      Fan Du authored
      Two rt tasks bind to one CPU core.
      
      The higher priority rt task A preempts a lower priority rt task B which
      has already taken the write seq lock, and then the higher priority rt
      task A try to acquire read seq lock, it's doomed to lockup.
      
      rt task A with lower priority: call write
      i_size_write                                        rt task B with higher priority: call sync, and preempt task A
        write_seqcount_begin(&inode->i_size_seqcount);    i_size_read
        inode->i_size = i_size;                             read_seqcount_begin <-- lockup here...
      
      So disable preempt when acquiring every i_size_seqcount *write* lock will
      cure the problem.
      Signed-off-by: default avatarFan Du <fan.du@windriver.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      74e3d1e1
    • liguang's avatar
      kernel/smp.c: remove 'priv' of call_single_data · 3440a1ca
      liguang authored
      The 'priv' field is redundant; we can pass data via 'info'.
      Signed-off-by: default avatarliguang <lig.fnst@cn.fujitsu.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3440a1ca
    • liguang's avatar
      kernel/smp.c: use '|=' for csd_lock · 1def1dc9
      liguang authored
      csd_lock() uses assignment to data->flags rather than |=.  That is not
      buggy at present because only one bit (CSD_FLAG_LOCK) is defined in
      call_single_data.flags.
      
      But it will become buggy if we later add another flag, so fix it now.
      Signed-off-by: default avatarliguang <lig.fnst@cn.fujitsu.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1def1dc9
    • Tejun Heo's avatar
      writeback: set worker desc to identify writeback workers in task dumps · ef3b1019
      Tejun Heo authored
      Writeback has been recently converted to use workqueue instead of its
      private thread pool implementation.  One negative side effect of this
      conversion is that there's no easy to tell which backing device a
      writeback work item was working on at the time of task dump, be it
      sysrq-t, BUG, WARN or whatever, which, according to our writeback
      brethren, is important in tracking down issues with a lot of mounted
      file systems on a lot of different devices.
      
      This patch restores that information using the new worker description
      facility.  bdi_writeback_workfn() calls set_work_desc() to identify
      which bdi it's working on.  The description is printed out together with
      the worqueue name and worker function as in the following example dump.
      
       WARNING: at fs/fs-writeback.c:1015 bdi_writeback_workfn+0x2b4/0x3c0()
       Modules linked in:
       Pid: 28, comm: kworker/u18:0 Not tainted 3.9.0-rc1-work+ #24 empty empty/S3992
       Workqueue: writeback bdi_writeback_workfn (flush-8:16)
        ffffffff820a3a98 ffff88015b927cb8 ffffffff81c61855 ffff88015b927cf8
        ffffffff8108f500 0000000000000000 ffff88007a171948 ffff88007a1716b0
        ffff88015b49df00 ffff88015b8d3940 0000000000000000 ffff88015b927d08
       Call Trace:
        [<ffffffff81c61855>] dump_stack+0x19/0x1b
        [<ffffffff8108f500>] warn_slowpath_common+0x70/0xa0
        [<ffffffff8108f54a>] warn_slowpath_null+0x1a/0x20
        [<ffffffff81200144>] bdi_writeback_workfn+0x2b4/0x3c0
        [<ffffffff810b4c87>] process_one_work+0x1d7/0x660
        [<ffffffff810b5c72>] worker_thread+0x122/0x380
        [<ffffffff810bdfea>] kthread+0xea/0xf0
        [<ffffffff81c6cedc>] ret_from_fork+0x7c/0xb0
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ef3b1019
    • Tejun Heo's avatar
      workqueue: include workqueue info when printing debug dump of a worker task · 3d1cb205
      Tejun Heo authored
      One of the problems that arise when converting dedicated custom
      threadpool to workqueue is that the shared worker pool used by workqueue
      anonimizes each worker making it more difficult to identify what the
      worker was doing on which target from the output of sysrq-t or debug
      dump from oops, BUG() and friends.
      
      This patch implements set_worker_desc() which can be called from any
      workqueue work function to set its description.  When the worker task is
      dumped for whatever reason - sysrq-t, WARN, BUG, oops, lockdep assertion
      and so on - the description will be printed out together with the
      workqueue name and the worker function pointer.
      
      The printing side is implemented by print_worker_info() which is called
      from functions in task dump paths - sched_show_task() and
      dump_stack_print_info().  print_worker_info() can be safely called on
      any task in any state as long as the task struct itself is accessible.
      It uses probe_*() functions to access worker fields.  It may print
      garbage if something went very wrong, but it wouldn't cause (another)
      oops.
      
      The description is currently limited to 24bytes including the
      terminating \0.  worker->desc_valid and workder->desc[] are added and
      the 64 bytes marker which was already incorrect before adding the new
      fields is moved to the correct position.
      
      Here's an example dump with writeback updated to set the bdi name as
      worker desc.
      
       Hardware name: Bochs
       Modules linked in:
       Pid: 7, comm: kworker/u9:0 Not tainted 3.9.0-rc1-work+ #1
       Workqueue: writeback bdi_writeback_workfn (flush-8:0)
        ffffffff820a3ab0 ffff88000f6e9cb8 ffffffff81c61845 ffff88000f6e9cf8
        ffffffff8108f50f 0000000000000000 0000000000000000 ffff88000cde16b0
        ffff88000cde1aa8 ffff88001ee19240 ffff88000f6e9fd8 ffff88000f6e9d08
       Call Trace:
        [<ffffffff81c61845>] dump_stack+0x19/0x1b
        [<ffffffff8108f50f>] warn_slowpath_common+0x7f/0xc0
        [<ffffffff8108f56a>] warn_slowpath_null+0x1a/0x20
        [<ffffffff81200150>] bdi_writeback_workfn+0x2a0/0x3b0
       ...
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Acked-by: default avatarJan Kara <jack@suse.cz>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Dave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d1cb205
    • Tejun Heo's avatar
      kthread: implement probe_kthread_data() · cd42d559
      Tejun Heo authored
      One of the problems that arise when converting dedicated custom threadpool
      to workqueue is that the shared worker pool used by workqueue anonimizes
      each worker making it more difficult to identify what the worker was doing
      on which target from the output of sysrq-t or debug dump from oops, BUG()
      and friends.
      
      For example, after writeback is converted to use workqueue instead of
      priviate thread pool, there's no easy to tell which backing device a
      writeback work item was working on at the time of task dump, which,
      according to our writeback brethren, is important in tracking down issues
      with a lot of mounted file systems on a lot of different devices.
      
      This patchset implements a way for a work function to mark its execution
      instance so that task dump of the worker task includes information to
      indicate what the work item was doing.
      
      An example WARN dump would look like the following.
      
       WARNING: at fs/fs-writeback.c:1015 bdi_writeback_workfn+0x2b4/0x3c0()
       Modules linked in:
       CPU: 0 Pid: 28 Comm: kworker/u18:0 Not tainted 3.9.0-rc1-work+ #24
       Hardware name: empty empty/S3992, BIOS 080011  10/26/2007
       Workqueue: writeback bdi_writeback_workfn (flush-8:16)
        ffffffff820a3a98 ffff88015b927cb8 ffffffff81c61855 ffff88015b927cf8
        ffffffff8108f500 0000000000000000 ffff88007a171948 ffff88007a1716b0
        ffff88015b49df00 ffff88015b8d3940 0000000000000000 ffff88015b927d08
       Call Trace:
        [<ffffffff81c61855>] dump_stack+0x19/0x1b
        [<ffffffff8108f500>] warn_slowpath_common+0x70/0xa0
        ...
      
      This patch:
      
      Implement probe_kthread_data() which returns kthread_data if accessible.
      The function is equivalent to kthread_data() except that the specified
      @task may not be a kthread or its vfork_done is already cleared rendering
      struct kthread inaccessible.  In the former case, probe_kthread_data() may
      return any value.  In the latter, NULL.
      
      This will be used to safely print debug information without affecting
      synchronization in the normal paths.  Workqueue debug info printing on
      dump_stack() and friends will make use of it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarJan Kara <jack@suse.cz>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd42d559
    • Vineet Gupta's avatar
      arc, print-fatal-signals: reduce duplicated information · 681a90ff
      Vineet Gupta authored
      After the recent generic debug info on dump_stack() and friends, arc
      is printing duplicate information on debug dumps.
      
       [ARCLinux]$ ./crash
       crash/50: potentially unexpected fatal signal 11.	<-- [1]
       /sbin/crash, TGID 50					<-- [2]
       Pid: 50, comm: crash Not tainted 3.9.0-rc4+ #132 	<-- [3]
       ...
      
      Remove them.
      
      [tj@kernel.org: updated patch desc]
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      681a90ff
    • Tejun Heo's avatar
      dump_stack: unify debug information printed by show_regs() · a43cb95d
      Tejun Heo authored
      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:[<ffffffff8234a07e>]  [<ffffffff8234a07e>] 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:
        [<ffffffff81000312>] do_one_initcall+0x122/0x170
        [<ffffffff82335e5d>] kernel_init_freeable+0x9b/0x1c8
        [<ffffffff81c47760>] ? rest_init+0x140/0x140
        [<ffffffff81c4776e>] kernel_init+0xe/0xf0
        [<ffffffff81c6be9c>] ret_from_fork+0x7c/0xb0
        [<ffffffff81c47760>] ? 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: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Acked-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Acked-by: Chris Metcalf <cmetcalf@tilera.com>		[tile bits]
      Acked-by: Richard Kuo <rkuo@codeaurora.org>		[hexagon bits]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a43cb95d
    • Tejun Heo's avatar
      dump_stack: implement arch-specific hardware description in task dumps · 98e5e1bf
      Tejun Heo authored
      x86 and ia64 can acquire extra hardware identification information
      from DMI and print it along with task dumps; however, the usage isn't
      consistent.
      
      * x86 show_regs() collects vendor, product and board strings and print
        them out with PID, comm and utsname.  Some of the information is
        printed again later in the same dump.
      
      * warn_slowpath_common() explicitly accesses the DMI board and prints
        it out with "Hardware name:" label.  This applies to both x86 and
        ia64 but is irrelevant on all other archs.
      
      * ia64 doesn't show DMI information on other non-WARN dumps.
      
      This patch introduces arch-specific hardware description used by
      dump_stack().  It can be set by calling dump_stack_set_arch_desc()
      during boot and, if exists, printed out in a separate line with
      "Hardware name:" label.
      
      dmi_set_dump_stack_arch_desc() is added which sets arch-specific
      description from DMI data.  It uses dmi_ids_string[] which is set from
      dmi_present() used for DMI debug message.  It is superset of the
      information x86 show_regs() is using.  The function is called from x86
      and ia64 boot code right after dmi_scan_machine().
      
      This makes the explicit DMI handling in warn_slowpath_common()
      unnecessary.  Removed.
      
      show_regs() isn't yet converted to use generic debug information
      printing and this patch doesn't remove the duplicate DMI handling in
      x86 show_regs().  The next patch will unify show_regs() handling and
      remove the duplication.
      
      An example WARN dump follows.
      
       WARNING: at kernel/workqueue.c:4841 init_workqueues+0x35/0x505()
       Modules linked in:
       CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #3
       Hardware name: empty empty/S3992, BIOS 080011  10/26/2007
        0000000000000009 ffff88007c861e08 ffffffff81c614dc ffff88007c861e48
        ffffffff8108f500 ffffffff82228240 0000000000000040 ffffffff8234a08e
        0000000000000000 0000000000000000 0000000000000000 ffff88007c861e58
       Call Trace:
        [<ffffffff81c614dc>] dump_stack+0x19/0x1b
        [<ffffffff8108f500>] warn_slowpath_common+0x70/0xa0
        [<ffffffff8108f54a>] warn_slowpath_null+0x1a/0x20
        [<ffffffff8234a0c3>] init_workqueues+0x35/0x505
        ...
      
      v2: Use the same string as the debug message from dmi_present() which
          also contains BIOS information.  Move hardware name into its own
          line as warn_slowpath_common() did.  This change was suggested by
          Bjorn Helgaas.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      98e5e1bf
    • Tejun Heo's avatar
      dmi: morph dmi_dump_ids() into dmi_format_ids() which formats into a buffer · c90fe6bc
      Tejun Heo authored
      We're goning to use DMI identification for other purposes too.  Morph
      dmi_dump_ids() which is used to print DMI identification as a debug
      message during boot into dmi_format_ids() which formats the same
      information sans the leading "DMI:" tag into a string buffer.
      
      dmi_present() is updated to format the information into dmi_ids_string[]
      using the new function and print it with "DMI:" prefix.
      
      dmi_ids_string[] will be used for another purpose by a future patch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c90fe6bc
    • Tejun Heo's avatar
      dump_stack: consolidate dump_stack() implementations and unify their behaviors · 196779b9
      Tejun Heo authored
      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:
        [<ffffffff81c614dc>] dump_stack+0x19/0x1b
        [<ffffffff8108f50f>] warn_slowpath_common+0x7f/0xc0
        [<ffffffff8108f56a>] warn_slowpath_null+0x1a/0x20
        [<ffffffff8234a071>] 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: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Acked-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Acked-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
      Acked-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>	[s390 bits]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Acked-by: Richard Kuo <rkuo@codeaurora.org>		[hexagon bits]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      196779b9
    • Tejun Heo's avatar
      sparc32: make show_stack() acquire %fp if @_ksp is not specified · 89e3f23d
      Tejun Heo authored
      show_stack(current or NULL, NULL) is used by arch-independent code to dump
      backtrace of the current task; however, sparc32 show_stack() doesn't
      implement it and wouldn't print any backtrace when NULL @_ksp is specfied.
      
      Make show_stack() acquire and use %fp if @tsk is NULL or current and @_ksp
      is NULL.  This makes %fp fetching in dump_stack() unnecessary.  Make it
      use NULL for @_ksp instead.
      
      Only compile tested.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      89e3f23d
    • Tejun Heo's avatar
      x86: don't show trace beyond show_stack(NULL, NULL) · a77f2a4e
      Tejun Heo authored
      There are multiple ways a task can be dumped - explicit call to
      dump_stack(), triggering WARN() or BUG(), through sysrq-t and so on.
      Most of what gets printed is upto each architecture and the current
      state is not particularly pretty.  Different pieces of information are
      presented differently depending on which path the dump takes and which
      architecture it's running on.  This is messy for no good reason and
      makes it exceedingly difficult to add or modify debug information to
      task dumps.
      
      In all archs except for s390, there's nothing arch-specific about the
      printed debug information.  This patchset updates all those archs to use
      the same helpers to consistently print out the same debug information.
      
      An example WARN dump after this patchset.
      
       WARNING: at kernel/workqueue.c:4841 init_workqueues+0x35/0x505()
       Modules linked in:
       CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #3
       Hardware name: empty empty/S3992, BIOS 080011  10/26/2007
        0000000000000009 ffff88007c861e08 ffffffff81c614dc ffff88007c861e48
        ffffffff8108f500 ffffffff82228240 0000000000000040 ffffffff8234a08e
        0000000000000000 0000000000000000 0000000000000000 ffff88007c861e58
       Call Trace:
        [<ffffffff81c614dc>] dump_stack+0x19/0x1b
        [<ffffffff8108f500>] warn_slowpath_common+0x70/0xa0
        [<ffffffff8108f54a>] warn_slowpath_null+0x1a/0x20
        [<ffffffff8234a0c3>] init_workqueues+0x35/0x505
        ...
      
      And BUG dump.
      
       kernel BUG at 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:[<ffffffff8234a07e>]  [<ffffffff8234a07e>] 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:
        [<ffffffff81000312>] do_one_initcall+0x122/0x170
        [<ffffffff82335e5d>] kernel_init_freeable+0x9b/0x1c8
        [<ffffffff81c47760>] ? rest_init+0x140/0x140
        [<ffffffff81c4776e>] kernel_init+0xe/0xf0
        [<ffffffff81c6be9c>] ret_from_fork+0x7c/0xb0
        [<ffffffff81c47760>] ? rest_init+0x140/0x140
        ...
      
      This patchset contains the following seven patches.
      
       0001-x86-don-t-show-trace-beyond-show_stack-NULL-NULL.patch
       0002-sparc32-make-show_stack-acquire-fp-if-_ksp-is-not-sp.patch
       0003-dump_stack-consolidate-dump_stack-implementations-an.patch
       0004-dmi-morph-dmi_dump_ids-into-dmi_format_ids-which-for.patch
       0005-dump_stack-implement-arch-specific-hardware-descript.patch
       0006-dump_stack-unify-debug-information-printed-by-show_r.patch
       0007-arc-print-fatal-signals-reduce-duplicated-informatio.patch
      
      0001-0002 update stack dumping functions in x86 and sparc32 in
      preparation.
      
      0003 makes all arches except blackfin use generic dump_stack().
      blackfin still uses the generic helper to print the same info.
      
      0004-0005 properly abstract DMI identifier printing in WARN() and
      show_regs() so that all dumps print out the information.  This enables
      show_regs() to use the same debug info message.
      
      0006 updates show_regs() of all arches to use a common generic helper
      to print debug info.
      
      0007 removes somem duplicate information from arc dumps.
      
      While this patchset changes how debug info is printed on some archs,
      the printed information is always superset of what used to be there.
      
      This patchset makes task dump debug messages consistent and enables
      adding more information.  Workqueue is scheduled to add worker
      information including the workqueue in use and work item specific
      description.
      
      While this patch touches a lot of archs, it isn't too likely to cause
      non-trivial conflicts with arch-specfic changes and would probably be
      best to route together either through -mm.
      
      x86 is tested but other archs are either only compile tested or not
      tested at all.  Changes to most archs are generally trivial.
      
      This patch:
      
      show_stack(current or NULL, NULL) is used to print the backtrace of the
      current task.  As trace beyond the function itself isn't of much
      interest to anyone, don't show it by determining sp and bp in
      show_stack()'s frame and passing them to show_stack_log_lvl().
      
      This brings show_stack(NULL, NULL)'s behavior in line with
      dump_stack().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a77f2a4e
    • Lin Feng's avatar
      kernel/range.c: subtract_range: fix the broken phrase issued by printk · 7fba2c27
      Lin Feng authored
      Also replace deprecated printk(KERN_ERR...) with pr_err() as suggested
      by Yinghai, attaching the function name to provide plenty info.
      Signed-off-by: default avatarLin Feng <linfeng@cn.fujitsu.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7fba2c27
    • Pavel Emelyanov's avatar
      selftest: add simple test for soft-dirty bit · 58c7be84
      Pavel Emelyanov authored
      It creates a mapping of 3 pages and checks that reads, writes and
      clear-refs result in present and soft-dirt bits reported from pagemap2
      set as expected.
      
      [akpm@linux-foundation.org: alphasort the Makefile TARGETS to reduce rejects]
      Signed-off-by: default avatarPavel Emelyanov <xemul@parallels.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      58c7be84
    • Dan Magenheimer's avatar
      staging: zcache: enable zcache to be built/loaded as a module · 835f2f51
      Dan Magenheimer authored
      Allow zcache to be built/loaded as a module.  Note runtime dependency
      disallows loading if cleancache/frontswap lazy initialization patches
      are not present.  Zsmalloc support has not yet been merged into zcache
      but, once merged, could now easily be selected via a module_param.
      
      If built-in (not built as a module), the original mechanism of enabling
      via a kernel boot parameter is retained, but this should be considered
      deprecated.
      
      Note that module unload is explicitly not yet supported.
      Signed-off-by: default avatarDan Magenheimer <dan.magenheimer@oracle.com>
      [v1: Rebased with different order of patches]
      [v2: Removed [CLEANCACHE|FRONTSWAP]_HAS_LAZY_INIT ifdef]
      [v3: Rebased on top of ramster->zcache move]
      [v4: Redid the Makefile]
      [v5: s/ZCACHE2/ZCACHE/]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Andor Daam <andor.daam@googlemail.com>
      Cc: Florian Schmaus <fschmaus@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Stefan Hengelein <ilendir@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      835f2f51
    • Dan Magenheimer's avatar
      staging: zcache: enable ramster to be built/loaded as a module · 1ac37bee
      Dan Magenheimer authored
      Enable module support for ramster.  Note runtime dependency disallows
      loading if cleancache/frontswap lazy initialization patches are not
      present.
      
      If built-in (not built as a module), the original mechanism of enabling
      via a kernel boot parameter is retained, but this should be considered
      deprecated.
      
      Note that module unload is explicitly not yet supported.
      
      [v1: Fixed compile issues since ramster_init now has four arguments]
      [v2: Fixed rebase on ramster->zcache move]
      [akpm@linux-foundation.org: use_frontswap_selfshrink cannot be __initdata]
      Signed-off-by: default avatarDan Magenheimer <dan.magenheimer@oracle.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Andor Daam <andor.daam@googlemail.com>
      Cc: Florian Schmaus <fschmaus@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Stefan Hengelein <ilendir@googlemail.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1ac37bee
    • Konrad Rzeszutek Wilk's avatar
      zcache/tmem: Better error checking on frontswap_register_ops return value. · f42158fe
      Konrad Rzeszutek Wilk authored
      In the past it either used to be NULL or the "older" backend. Now we
      also return -Exx error codes.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Andor Daam <andor.daam@googlemail.com>
      Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
      Cc: Florian Schmaus <fschmaus@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Stefan Hengelein <ilendir@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f42158fe
    • Dan Magenheimer's avatar
      xen: tmem: enable Xen tmem shim to be built/loaded as a module · 10a7a077
      Dan Magenheimer authored
      Allow Xen tmem shim to be built/loaded as a module.  Xen self-ballooning
      and frontswap-selfshrinking are now also "lazily" initialized when the
      Xen tmem shim is loaded as a module, unless explicitly disabled by
      module parameters.
      
      Note runtime dependency disallows loading if cleancache/frontswap lazy
      initialization patches are not present.
      
      If built-in (not built as a module), the original mechanism of enabling
      via a kernel boot parameter is retained, but this should be considered
      deprecated.
      
      Note that module unload is explicitly not yet supported.
      
      [v1: Removed the [CLEANCACHE|FRONTSWAP]_HAS_LAZY_INIT ifdef]
      [v2: Squashed the xen/tmem: Remove the subsys call patch in]
      [akpm@linux-foundation.org: fix build (disable_frontswap_selfshrinking undeclared)]
      Signed-off-by: default avatarDan Magenheimer <dan.magenheimer@oracle.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Andor Daam <andor.daam@googlemail.com>
      Cc: Florian Schmaus <fschmaus@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Stefan Hengelein <ilendir@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      10a7a077
    • Bob Liu's avatar
      mm: cleancache: clean up cleancache_enabled · ff610a1d
      Bob Liu authored
      cleancache_ops is used to decide whether backend is registered.
      So now cleancache_enabled is always true if defined CONFIG_CLEANCACHE.
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Andor Daam <andor.daam@googlemail.com>
      Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
      Cc: Florian Schmaus <fschmaus@gmail.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Stefan Hengelein <ilendir@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ff610a1d
    • Konrad Rzeszutek Wilk's avatar
      cleancache: Make cleancache_init use a pointer for the ops · 833f8662
      Konrad Rzeszutek Wilk authored
      Instead of using a backend_registered to determine whether a backend is
      enabled.  This allows us to remove the backend_register check and just
      do 'if (cleancache_ops)'
      
      [v1: Rebase on top of b97c4b430b0a (ramster->zcache move]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Andor Daam <andor.daam@googlemail.com>
      Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
      Cc: Florian Schmaus <fschmaus@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Stefan Hengelein <ilendir@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      833f8662
    • Dan Magenheimer's avatar
      mm: cleancache: lazy initialization to allow tmem backends to build/run as modules · 49a9ab81
      Dan Magenheimer authored
      With the goal of allowing tmem backends (zcache, ramster, Xen tmem) to
      be built/loaded as modules rather than built-in and enabled by a boot
      parameter, this patch provides "lazy initialization", allowing backends
      to register to cleancache even after filesystems were mounted.  Calls to
      init_fs and init_shared_fs are remembered as fake poolids but no real
      tmem_pools created.  On backend registration the fake poolids are mapped
      to real poolids and respective tmem_pools.
      Signed-off-by: default avatarStefan Hengelein <ilendir@googlemail.com>
      Signed-off-by: default avatarFlorian Schmaus <fschmaus@gmail.com>
      Signed-off-by: default avatarAndor Daam <andor.daam@googlemail.com>
      Signed-off-by: default avatarDan Magenheimer <dan.magenheimer@oracle.com>
      [v1: Minor fixes: used #define for some values and bools]
      [v2: Removed CLEANCACHE_HAS_LAZY_INIT]
      [v3: Added more comments, added a lock for [shared_|]fs_poolid_map]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
      Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      49a9ab81