Merge tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwess...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 10 Jan 2015 04:51:10 +0000 (20:51 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 10 Jan 2015 04:51:10 +0000 (20:51 -0800)
Pull kgdb/kdb fixes from Jason Wessel:
 "These have been around since 3.17 and in kgdb-next for the last 9
  weeks and some will go back to -stable.

  Summary of changes:

  Cleanups
   - kdb: Remove unused command flags, repeat flags and KDB_REPEAT_NONE

  Fixes
   - kgdb/kdb: Allow access on a single core, if a CPU round up is
     deemed impossible, which will allow inspection of the now "trashed"
     kernel
   - kdb: Add enable mask for the command groups
   - kdb: access controls to restrict sensitive commands"

* tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
  kernel/debug/debug_core.c: Logging clean-up
  kgdb: timeout if secondary CPUs ignore the roundup
  kdb: Allow access to sensitive commands to be restricted by default
  kdb: Add enable mask for groups of commands
  kdb: Categorize kdb commands (similar to SysRq categorization)
  kdb: Remove KDB_REPEAT_NONE flag
  kdb: Use KDB_REPEAT_* values as flags
  kdb: Rename kdb_register_repeat() to kdb_register_flags()
  kdb: Rename kdb_repeat_t to kdb_cmdflags_t, cmd_repeat to cmd_flags
  kdb: Remove currently unused kdbtab_t->cmd_flags

1  2 
kernel/trace/trace_kdb.c

diff --combined kernel/trace/trace_kdb.c
@@@ -20,12 -20,10 +20,12 @@@ static void ftrace_dump_buf(int skip_li
  {
        /* use static because iter can be a bit big for the stack */
        static struct trace_iterator iter;
 +      static struct ring_buffer_iter *buffer_iter[CONFIG_NR_CPUS];
        unsigned int old_userobj;
        int cnt = 0, cpu;
  
        trace_init_global_iter(&iter);
 +      iter.buffer_iter = buffer_iter;
  
        for_each_tracing_cpu(cpu) {
                atomic_inc(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled);
                ring_buffer_read_start(iter.buffer_iter[cpu_file]);
                tracing_iter_reset(&iter, cpu_file);
        }
 -      if (!trace_empty(&iter))
 -              trace_find_next_entry_inc(&iter);
 -      while (!trace_empty(&iter)) {
 +
 +      while (trace_find_next_entry_inc(&iter)) {
                if (!cnt)
                        kdb_printf("---------------------------------\n");
                cnt++;
  
 -              if (trace_find_next_entry_inc(&iter) != NULL && !skip_lines)
 +              if (!skip_lines) {
                        print_trace_line(&iter);
 -              if (!skip_lines)
                        trace_printk_seq(&iter.seq);
 -              else
 +              } else {
                        skip_lines--;
 +              }
 +
                if (KDB_FLAG(CMD_INTERRUPT))
                        goto out;
        }
@@@ -88,12 -86,9 +88,12 @@@ out
                atomic_dec(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled);
        }
  
 -      for_each_tracing_cpu(cpu)
 -              if (iter.buffer_iter[cpu])
 +      for_each_tracing_cpu(cpu) {
 +              if (iter.buffer_iter[cpu]) {
                        ring_buffer_read_finish(iter.buffer_iter[cpu]);
 +                      iter.buffer_iter[cpu] = NULL;
 +              }
 +      }
  }
  
  /*
@@@ -132,8 -127,8 +132,8 @@@ static int kdb_ftdump(int argc, const c
  
  static __init int kdb_ftrace_register(void)
  {
-       kdb_register_repeat("ftdump", kdb_ftdump, "[skip_#lines] [cpu]",
-                           "Dump ftrace log", 0, KDB_REPEAT_NONE);
+       kdb_register_flags("ftdump", kdb_ftdump, "[skip_#lines] [cpu]",
+                           "Dump ftrace log", 0, KDB_ENABLE_ALWAYS_SAFE);
        return 0;
  }