1. 22 Feb, 2009 2 commits
  2. 20 Feb, 2009 11 commits
    • Steven Rostedt's avatar
      ftrace: break out modify loop immediately on detection of error · 4377245a
      Steven Rostedt authored
      Impact: added precaution on failure detection
      
      Break out of the modifying loop as soon as a failure is detected.
      This is just an added precaution found by code review and was not
      found by any bug chasing.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      4377245a
    • Steven Rostedt's avatar
      ftrace: immediately stop code modification if failure is detected · 90c7ac49
      Steven Rostedt authored
      Impact: fix to prevent NMI lockup
      
      If the page fault handler produces a WARN_ON in the modifying of
      text, and the system is setup to have a high frequency of NMIs,
      we can lock up the system on a failure to modify code.
      
      The modifying of code with NMIs allows all NMIs to modify the code
      if it is about to run. This prevents a modifier on one CPU from
      modifying code running in NMI context on another CPU. The modifying
      is done through stop_machine, so only NMIs must be considered.
      
      But if the write causes the page fault handler to produce a warning,
      the print can slow it down enough that as soon as it is done
      it will take another NMI before going back to the process context.
      The new NMI will perform the write again causing another print and
      this will hang the box.
      
      This patch turns off the writing as soon as a failure is detected
      and does not wait for it to be turned off by the process context.
      This will keep NMIs from getting stuck in this back and forth
      of print outs.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      90c7ac49
    • Steven Rostedt's avatar
      ftrace, x86: make kernel text writable only for conversions · 16239630
      Steven Rostedt authored
      Impact: keep kernel text read only
      
      Because dynamic ftrace converts the calls to mcount into and out of
      nops at run time, we needed to always keep the kernel text writable.
      
      But this defeats the point of CONFIG_DEBUG_RODATA. This patch converts
      the kernel code to writable before ftrace modifies the text, and converts
      it back to read only afterward.
      
      The kernel text is converted to read/write, stop_machine is called to
      modify the code, then the kernel text is converted back to read only.
      
      The original version used SYSTEM_STATE to determine when it was OK
      or not to change the code to rw or ro. Andrew Morton pointed out that
      using SYSTEM_STATE is a bad idea since there is no guarantee to what
      its state will actually be.
      
      Instead, I moved the check into the set_kernel_text_* functions
      themselves, and use a local variable to determine when it is
      OK to change the kernel text RW permissions.
      
      [ Update: Ingo Molnar suggested moving the prototypes to cacheflush.h ]
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      16239630
    • Frederic Weisbecker's avatar
      tracing/markers: make markers select tracepoints · 91f73f90
      Frederic Weisbecker authored
      Sometimes it happens that KConfig dependencies are not handled
      like in the following scenario:
      
      - config A
         bool
      
      - config B
         bool
         depends on A
      
      - config C
         bool
         select B
      
      If one selects C, then it will select B without checking its
      dependency to A, if A hasn't been selected elsewhere, it will
      result in a build failure.
      
      This is what happens on the following build error:
      
       kernel/built-in.o: In function `marker_update_probe_range':
       (.text+0x52f64): undefined reference to `tracepoint_probe_register_noupdate'
       kernel/built-in.o: In function `marker_update_probe_range':
       (.text+0x52f74): undefined reference to `tracepoint_probe_unregister_noupdate'
       kernel/built-in.o: In function `marker_update_probe_range':
       (.text+0x52fb9): undefined reference to `tracepoint_probe_unregister_noupdate'
       kernel/built-in.o: In function `marker_update_probes':
       marker.c:(.text+0x530ba): undefined reference to `tracepoint_probe_update_all'
      
      CONFIG_KVM_TRACE will select CONFIG_MARKER, but the latter
      depends on CONFIG_TRACEPOINTS which will not be selected.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      91f73f90
    • Steven Rostedt's avatar
      ftrace: allow archs to preform pre and post process for code modification · 000ab691
      Steven Rostedt authored
      This patch creates the weak functions: ftrace_arch_code_modify_prepare
      and ftrace_arch_code_modify_post_process that are called before and
      after the stop machine is called to modify the kernel text.
      
      If the arch needs to do pre or post processing, it only needs to define
      these functions.
      
      [ Update: Ingo Molnar suggested using the name ftrace_arch_code_modify_*
                over using ftrace_arch_modify_* ]
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      000ab691
    • Ingo Molnar's avatar
      Merge branch 'for-ingo' of... · 057685cf
      Ingo Molnar authored
      Merge branch 'for-ingo' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6 into tracing/kmemtrace
      
      Conflicts:
      	mm/slub.c
      057685cf
    • Frederic Weisbecker's avatar
      tracing/function-graph-tracer: make set_graph_function file support ftrace regex · f9349a8f
      Frederic Weisbecker authored
      Impact: trace only functions matching a pattern
      
      The set_graph_function file let one to trace only one or several
      chosen functions and follow all their code flow.
      
      Currently, only a constant function name is allowed so this patch
      allows the ftrace_regex functions:
      
      - matches all functions that end with "name":
        echo *name > set_graph_function
      
      - matches all functions that begin with "name":
        echo name* > set_graph_function
      
      - matches all functions that contains "name":
        echo *name* > set_graph_function
      
      Example:
      
      echo mutex* > set_graph_function
      
       0)               |  mutex_lock_nested() {
       0)   0.563 us    |    __might_sleep();
       0)   2.072 us    |  }
       0)               |  mutex_unlock() {
       0)   1.036 us    |    __mutex_unlock_slowpath();
       0)   2.433 us    |  }
       0)               |  mutex_unlock() {
       0)   0.691 us    |    __mutex_unlock_slowpath();
       0)   1.787 us    |  }
       0)               |  mutex_lock_interruptible_nested() {
       0)   0.548 us    |    __might_sleep();
       0)   1.945 us    |  }
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f9349a8f
    • Ingo Molnar's avatar
    • Christoph Lameter's avatar
      SLUB: Introduce and use SLUB_MAX_SIZE and SLUB_PAGE_SHIFT constants · fe1200b6
      Christoph Lameter authored
      As a preparational patch to bump up page allocator pass-through threshold,
      introduce two new constants SLUB_MAX_SIZE and SLUB_PAGE_SHIFT and convert
      mm/slub.c to use them.
      Reported-by: default avatar"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
      Tested-by: default avatar"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      fe1200b6
    • Ingo Molnar's avatar
      x86: use the right protections for split-up pagetables · 07a66d7c
      Ingo Molnar authored
      Steven Rostedt found a bug in where in his modified kernel
      ftrace was unable to modify the kernel text, due to the PMD
      itself having been marked read-only as well in
      split_large_page().
      
      The fix, suggested by Linus, is to not try to 'clone' the
      reference protection of a huge-page, but to use the standard
      (and permissive) page protection bits of KERNPG_TABLE.
      
      The 'cloning' makes sense for the ptes but it's a confused and
      incorrect concept at the page table level - because the
      pagetable entry is a set of all ptes and hence cannot
      'clone' any single protection attribute - the ptes can be any
      mixture of protections.
      
      With the permissive KERNPG_TABLE, even if the pte protections
      get changed after this point (due to ftrace doing code-patching
      or other similar activities like kprobes), the resulting combined
      protections will still be correct and the pte's restrictive
      (or permissive) protections will control it.
      
      Also update the comment.
      
      This bug was there for a long time but has not caused visible
      problems before as it needs a rather large read-only area to
      trigger. Steve possibly hacked his kernel with some really
      large arrays or so. Anyway, the bug is definitely worth fixing.
      
      [ Huang Ying also experienced problems in this area when writing
        the EFI code, but the real bug in split_large_page() was not
        realized back then. ]
      Reported-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Reported-by: default avatarHuang Ying <ying.huang@intel.com>
      Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      07a66d7c
    • Alok N Kataria's avatar
      x86, vmi: TSC going backwards check in vmi clocksource · 48ffc70b
      Alok N Kataria authored
      Impact: fix time warps under vmware
      
      Similar to the check for TSC going backwards in the TSC clocksource,
      we also need this check for VMI clocksource.
      Signed-off-by: default avatarAlok N Kataria <akataria@vmware.com>
      Cc: Zachary Amsden <zach@vmware.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: stable@kernel.org
      48ffc70b
  3. 19 Feb, 2009 27 commits