1. 09 Feb, 2009 2 commits
    • Mike Galbraith's avatar
      perf_counters: account NMI interrupts · d278c484
      Mike Galbraith authored
      I noticed that kerneltop interrupts were accounted as NMI, but not their
      perf counter origin.
      
      Account NMI performance counter interrupts.
      Signed-off-by: default avatarMike Galbraith  <efault@gmx.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      
       arch/x86/kernel/cpu/perf_counter.c |    2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      d278c484
    • Paul Mackerras's avatar
      perf_counters: make software counters work as per-cpu counters · 23a185ca
      Paul Mackerras authored
      Impact: kernel crash fix
      
      Yanmin Zhang reported that using a PERF_COUNT_TASK_CLOCK software
      counter as a per-cpu counter would reliably crash the system, because
      it calls __task_delta_exec with a null pointer.  The page fault,
      context switch and cpu migration counters also won't function
      correctly as per-cpu counters since they reference the current task.
      
      This fixes the problem by redirecting the task_clock counter to the
      cpu_clock counter when used as a per-cpu counter, and by implementing
      per-cpu page fault, context switch and cpu migration counters.
      
      Along the way, this:
      
      - Initializes counter->ctx earlier, in perf_counter_alloc, so that
        sw_perf_counter_init can use it
      - Adds code to kernel/sched.c to count task migrations into each
        cpu, in rq->nr_migrations_in
      - Exports the per-cpu context switch and task migration counts
        via new functions added to kernel/sched.c
      - Makes sure that if sw_perf_counter_init fails, we don't try to
        initialize the counter as a hardware counter.  Since the user has
        passed a negative, non-raw event type, they clearly don't intend
        for it to be interpreted as a hardware event.
      Reported-by: default avatar"Zhang Yanmin" <yanmin_zhang@linux.intel.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      23a185ca
  2. 05 Feb, 2009 1 commit
    • Ingo Molnar's avatar
      perfcounters: fix "perf counters kills oprofile" bug, v2 · 82aa9a18
      Ingo Molnar authored
      Impact: fix kernel crash
      
      Both oprofile and perfcounters register an NMI die handler, but only one
      can handle the NMI.  Conveniently, oprofile unregisters it's notifier
      when not actively in use, so setting it's notifier priority higher than
      perfcounter's allows oprofile to borrow the NMI for the duration of it's
      run.  Tested/works both as module and built-in.
      
      While testing, I found that if kerneltop was generating NMIs at very
      high frequency, the kernel may panic when oprofile registered it's
      handler.  This turned out to be because oprofile registers it's handler
      before reset_value has been allocated, so if an NMI comes in while it's
      still setting up, kabOom.  Rather than try more invasive changes, I
      followed the lead of other places in op_model_ppro.c, and simply
      returned in that highly unlikely event.  (debug warnings attached)
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      82aa9a18
  3. 04 Feb, 2009 1 commit
  4. 01 Feb, 2009 1 commit
  5. 29 Jan, 2009 1 commit
  6. 26 Jan, 2009 1 commit
  7. 23 Jan, 2009 12 commits
  8. 21 Jan, 2009 19 commits
  9. 20 Jan, 2009 2 commits
    • Nick Piggin's avatar
      x86: optimise x86's do_page_fault (C entry point for the page fault path) · 92181f19
      Nick Piggin authored
      Impact: cleanup, restructure code to improve assembly
      
      gcc isn't _all_ that smart about spilling registers to stack or reusing
      stack slots, even with branch annotations. do_page_fault contained a lot
      of functionality, so split unlikely paths into their own functions, and
      mark them as noinline just to be sure. I consider this actually to be
      somewhat of a cleanup too: the main function now contains about half
      the number of lines so the normal path is easier to read, while the error
      cases are also nicely split away.
      
      Also, ensure the order of arguments to functions is always the same: regs,
      addr, error_code. This can reduce code size a tiny bit, and just looks neater
      too.
      
      And add a couple of branch annotations.
      
      Before:
        do_page_fault:
                subq    $360, %rsp      #,
      
      After:
        do_page_fault:
                subq    $56, %rsp       #,
      
      bloat-o-meter:
        add/remove: 8/0 grow/shrink: 0/1 up/down: 2222/-1680 (542)
        function                                     old     new   delta
        __bad_area_nosemaphore                         -     506    +506
        no_context                                     -     474    +474
        vmalloc_fault                                  -     424    +424
        spurious_fault                                 -     358    +358
        mm_fault_error                                 -     272    +272
        bad_area_access_error                          -      89     +89
        bad_area                                       -      89     +89
        bad_area_nosemaphore                           -      10     +10
        do_page_fault                               2464     784   -1680
      
      Yes, the total size increases by 542 bytes, due to the extra function calls.
      But these will very rarely be called (except for vmalloc_fault) in a normal
      workload. Importantly, do_page_fault is less than 1/3rd it's original size,
      and touches far less stack.
      
      Existing gotos and branch hints did move a lot of the infrequently used text
      out of the fastpath, but that's even further improved after this patch.
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      92181f19
    • Ingo Molnar's avatar
      Merge commit 'v2.6.29-rc2' into x86/mm · 0ce1c383
      Ingo Molnar authored
      0ce1c383