1. 01 May, 2013 36 commits
    • 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
    • Minchan Kim's avatar
      frontswap: get rid of swap_lock dependency · 4f89849d
      Minchan Kim authored
      Frontswap initialization routine depends on swap_lock, which want to be
      atomic about frontswap's first appearance.  IOW, frontswap is not present
      and will fail all calls OR frontswap is fully functional but if new
      swap_info_struct isn't registered by enable_swap_info, swap subsystem
      doesn't start I/O so there is no race between init procedure and page I/O
      working on frontswap.
      
      So let's remove unnecessary swap_lock dependency.
      
      Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
      Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
      [v1: Rebased on my branch, reworked to work with backends loading late]
      [v2: Added a check for !map]
      [v3: Made the invalidate path follow the init path]
      [v4: Address comments by Wanpeng Li <liwanp@linux.vnet.ibm.com>]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad@darnok.org>
      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: 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>
      4f89849d
    • Bob Liu's avatar
      mm: frontswap: cleanup code · f066ea23
      Bob Liu authored
      After allowing tmem backends to build/run as modules, frontswap_enabled
      always true if defined CONFIG_FRONTSWAP.  But frontswap_test() depends on
      whether backend is registered, mv it into frontswap.c using fronstswap_ops
      to make the decision.
      
      frontswap_set/clear are not used outside frontswap, so don't export them.
      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>
      f066ea23
    • Konrad Rzeszutek Wilk's avatar
      frontswap: make frontswap_init use a pointer for the ops · 1e01c968
      Konrad Rzeszutek Wilk authored
      This simplifies the code in the frontswap - we can get rid of the
      'backend_registered' test and instead check against frontswap_ops.
      
      [v1: Rebase on top of 703ba7fe (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>
      1e01c968
    • Dan Magenheimer's avatar
      mm: frontswap: lazy initialization to allow tmem backends to build/run as modules · 905cd0e1
      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 frontswap even after swapon was run.  Before a backend
      registers all calls to init are recorded and the creation of tmem_pools
      delayed until a backend registers or until a frontswap store is
      attempted.
      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: Fixes per Seth Jennings suggestions]
      [v2: Removed FRONTSWAP_HAS_.. ]
      [v3: Fix up per Bob Liu <lliubbo@gmail.com> recommendations]
      [v4: Fix up per Andrew's comments]
      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: Dan Magenheimer <dan.magenheimer@oracle.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>
      905cd0e1
    • Greg Thelen's avatar
      fs/dcache.c: add cond_resched() to shrink_dcache_parent() · 421348f1
      Greg Thelen authored
      Call cond_resched() in shrink_dcache_parent() to maintain interactivity.
      
      Before this patch:
      
      	void shrink_dcache_parent(struct dentry * parent)
      	{
      		while ((found = select_parent(parent, &dispose)) != 0)
      			shrink_dentry_list(&dispose);
      	}
      
      select_parent() populates the dispose list with dentries which
      shrink_dentry_list() then deletes.  select_parent() carefully uses
      need_resched() to avoid doing too much work at once.  But neither
      shrink_dcache_parent() nor its called functions call cond_resched().  So
      once need_resched() is set select_parent() will return single dentry
      dispose list which is then deleted by shrink_dentry_list().  This is
      inefficient when there are a lot of dentry to process.  This can cause
      softlockup and hurts interactivity on non preemptable kernels.
      
      This change adds cond_resched() in shrink_dcache_parent().  The benefit
      of this is that need_resched() is quickly cleared so that future calls
      to select_parent() are able to efficiently return a big batch of dentry.
      
      These additional cond_resched() do not seem to impact performance, at
      least for the workload below.
      
      Here is a program which can cause soft lockup if other system activity
      sets need_resched().
      
      	int main()
      	{
      	        struct rlimit rlim;
      	        int i;
      	        int f[100000];
      	        char buf[20];
      	        struct timeval t1, t2;
      	        double diff;
      
      	        /* cleanup past run */
      	        system("rm -rf x");
      
      	        /* boost nfile rlimit */
      	        rlim.rlim_cur = 200000;
      	        rlim.rlim_max = 200000;
      	        if (setrlimit(RLIMIT_NOFILE, &rlim))
      	                err(1, "setrlimit");
      
      	        /* make directory for files */
      	        if (mkdir("x", 0700))
      	                err(1, "mkdir");
      
      	        if (gettimeofday(&t1, NULL))
      	                err(1, "gettimeofday");
      
      	        /* populate directory with open files */
      	        for (i = 0; i < 100000; i++) {
      	                snprintf(buf, sizeof(buf), "x/%d", i);
      	                f[i] = open(buf, O_CREAT);
      	                if (f[i] == -1)
      	                        err(1, "open");
      	        }
      
      	        /* close some of the files */
      	        for (i = 0; i < 85000; i++)
      	                close(f[i]);
      
      	        /* unlink all files, even open ones */
      	        system("rm -rf x");
      
      	        if (gettimeofday(&t2, NULL))
      	                err(1, "gettimeofday");
      
      	        diff = (((double)t2.tv_sec * 1000000 + t2.tv_usec) -
      	                ((double)t1.tv_sec * 1000000 + t1.tv_usec));
      
      	        printf("done: %g elapsed\n", diff/1e6);
      	        return 0;
      	}
      Signed-off-by: default avatarGreg Thelen <gthelen@google.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      421348f1
    • Yan Hong's avatar
      fs/block_dev.c: no need to check inode->i_bdev in bd_forget() · b4ea2eaa
      Yan Hong authored
      Its only caller evict() has promised a non-NULL inode->i_bdev.
      Signed-off-by: default avatarYan Hong <clouds.yan@gmail.com>
      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>
      b4ea2eaa
    • Zhao Hongjiang's avatar
      inotify: invalid mask should return a error number but not set it · 04df32fa
      Zhao Hongjiang authored
      When we run the crackerjack testsuite, the inotify_add_watch test is
      stalled.
      
      This is caused by the invalid mask 0 - the task is waiting for the event
      but it never comes.  inotify_add_watch() should return -EINVAL as it did
      before commit 676a0675 ("inotify: remove broken mask checks causing
      unmount to be EINVAL").  That commit removes the invalid mask check, but
      that check is needed.
      
      Check the mask's ALL_INOTIFY_BITS before the inotify_arg_to_mask() call.
      If none are set, just return -EINVAL.
      
      Because IN_UNMOUNT is in ALL_INOTIFY_BITS, this change will not trigger
      the problem that above commit fixed.
      
      [akpm@linux-foundation.org: fix build]
      Signed-off-by: default avatarZhao Hongjiang <zhaohongjiang@huawei.com>
      Acked-by: default avatarJim Somerville <Jim.Somerville@windriver.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Eric Paris <eparis@parisplace.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      04df32fa
    • Vincent Stehlé's avatar
      memory hotplug: fix warnings · ace6128d
      Vincent Stehlé authored
      Fix the following compilation warnings:
      
        mm/slab.c: In function `kmem_cache_init_late':
        mm/slab.c:1778:2: warning: statement with no effect [-Wunused-value]
      
        mm/page_cgroup.c: In function `page_cgroup_init':
        mm/page_cgroup.c:305:2: warning: statement with no effect [-Wunused-value]
      Signed-off-by: default avatarVincent Stehlé <vincent.stehle@laposte.net>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ace6128d
    • Andrew Morton's avatar
      drivers/usb/storage/realtek_cr.c: fix build · 677a0b5a
      Andrew Morton authored
      Remove unused local `us', which broke the build.  Also nuke an unneeded
      cast.
      
      Repairs commit 191648d0 ("usb: storage: Convert US_DEBUGP to
      usb_stor_dbg").
      
      Cc: Joe Perches <joe@perches.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      677a0b5a
  2. 30 Apr, 2013 4 commits
    • Linus Torvalds's avatar
      Merge tag 'arm64-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64 · c9ef7139
      Linus Torvalds authored
      Pull arm64 update from Catalin Marinas:
       "Main features:
      
         - Versatile Express SoC (model) support - DT files and Kconfig
           entries (there are no arch/arm64/mach-* directories).  The bulk of
           the code has already been moved to drivers/ as part of the ARM SoC
           clean-up.
      
         - Basic multi-cluster support (CPU logical map initialised from the
           DT)
      
         - Simple earlyprintk support for UART 8250/16550 and FastModel
           console output
      
         - Optimised kernel library bitops and string functions.
      
         - Automatic initialisation of the irqchip and clocks via DT"
      
      * tag 'arm64-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64: (26 commits)
        arm64: Use acquire/release semantics instead of explicit DMB
        arm64: klib: bitops: fix unpredictable stxr usage
        arm64: vexpress: Enable ARMv8 RTSM model (SoC) support
        arm64: vexpress: Add dts files for the ARMv8 RTSM models
        arm64: Survive invalid cpu enable-methods
        arm64: mm: Correct show_pte behaviour
        arm64: Fix compat types affecting struct compat_stat
        arm64: Execute DSB during thread switching for TLB/cache maintenance
        arm64: compiling issue, need add include/asm/vga.h file
        arm64: smp: honour #address-size when parsing CPU reg property
        arm64: Define cmpxchg64 and cmpxchg64_local for outside use
        arm64: Define readq and writeq for driver module using
        arm64: Fix task tracing
        arm64: add explicit symbols to ESR_EL1 decoding
        arm64: Use irqchip_init() for interrupt controller initialisation
        arm64: psci: Use the MPIDR values from cpu_logical_map for cpu ids.
        arm64: klib: Optimised atomic bitops
        arm64: klib: Optimised string functions
        arm64: klib: Optimised memory functions
        arm64: head: match all affinity levels in the pen of the secondaries
        ...
      c9ef7139
    • Linus Torvalds's avatar
      Merge tag 'metag-for-v3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag · 87c1f0f8
      Linus Torvalds authored
      Pull arch/metag update from James Hogan:
      
       - Various fixes for the interrupting perf counter handling in metag's
         perf backend.
      
       - Add OProfile support based on perf.
      
       - Sets up cache partitions for SMP so bootloader doesn't have to.
      
       - Patch from Paul Bolle to remove ARCH_POPULATES_NODE_MAP again
         (touches microblaze too).
      
       - Add TLS pointer regset to metag ptrace api.
      
       - Add exported metag DSP extended context handling header <asm/ech.h>.
      
       - Increase defconfig log buffer size to 128KiB.
      
       - Various fixes, typos, missing exports.
      
      * tag 'metag-for-v3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag:
        metag: defconfigs: increase log buffer 8KiB => 128KiB
        metag: avoid unnecessary builtin dtb rebuilds
        metag: add exported <asm/ech.h> for extended context handling
        metag: export _metag_da_present and cpu_2_hwthread_id
        metag: ptrace: Implement NT_METAG_TLS
        memblock: Kill ARCH_POPULATES_NODE_MAP once more
        metag: cachepart: fix get_global_dcache_size() typo
        metag: cachepart: take into account small cache bits
        metag: smp: copy cache partition and enable GCOn
        metag: OProfile support
        metag: perf: prepare for use by oprofile
        metag: perf: don't reset TXTACTCYC
        metag: perf: use hard_processor_id() to get thread
        metag: perf: fix frequency sampling (dynamic period)
        metag: perf: add missing prev_count updates
        metag: perf: fixes for interrupting perf counters
        metag: perf: fix wrap handling in delta calculation
        metag: perf: fix core internal / perf channel mux
      87c1f0f8
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k · 165bc513
      Linus Torvalds authored
      Pull m68k update from Geert Uytterhoeven.
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
        m68k: Remove inline strlen() implementation
        m68k/atari: USB - add platform devices for EtherNAT/NetUSBee ISP1160 HCD
        m68k: Implement ndelay() based on the existing udelay() logic
        m68k/atari: EtherNAT - add interrupt chip definition for CPLD interrupts
        m68k/atari: EtherNEC - add platform device support
        m68k/atari: EtherNAT - platform device and IRQ support code
        m68k/atari: use dedicated irq_chip for timer D interrupts
        m68k/atari: ROM port ISA adapter support
        m68k: Add missing cmpxchg64() if CONFIG_RMW_INSNS=y
      165bc513
    • Linus Torvalds's avatar
      Merge branch 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac · e2823299
      Linus Torvalds authored
      Pull edac fixes from Mauro Carvalho Chehab:
       "Two edac fixes:
      
         - i7300_edac currently reports a wrong number of DIMMs when the
           memory controller is in single channel mode
      
         - on some Sandy Bridge machines, the EDAC driver bails out as one of
           the PCI IDs used by the driver is hidden by BIOS.  As the driver
           uses it only to detect the type of memory, make it optional at the
           driver"
      
      * 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac:
        edac: sb_edac.c should not require prescence of IMC_DDRIO device
        i7300_edac: Fix memory detection in single mode
      e2823299