Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 15 Nov 2015 17:36:24 +0000 (09:36 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 15 Nov 2015 17:36:24 +0000 (09:36 -0800)
Pull perf updates from Thomas Gleixner:
 "Mostly updates to the perf tool plus two fixes to the kernel core code:

   - Handle tracepoint filters correctly for inherited events (Peter
     Zijlstra)

   - Prevent a deadlock in perf_lock_task_context (Paul McKenney)

   - Add missing newlines to some pr_err() calls (Arnaldo Carvalho de
     Melo)

   - Print full source file paths when using 'perf annotate --print-line
     --full-paths' (Michael Petlan)

   - Fix 'perf probe -d' when just one out of uprobes and kprobes is
     enabled (Wang Nan)

   - Add compiler.h to list.h to fix 'make perf-tar-src-pkg' generated
     tarballs, i.e. out of tree building (Arnaldo Carvalho de Melo)

   - Add the llvm-src-base.c and llvm-src-kbuild.c files, generated by
     the 'perf test' LLVM entries, when running it in-tree, to
     .gitignore (Yunlong Song)

   - libbpf error reporting improvements, using a strerror interface to
     more precisely tell the user about problems with the provided
     scriptlet, be it in C or as a ready made object file (Wang Nan)

   - Do not be case sensitive when searching for matching 'perf test'
     entries (Arnaldo Carvalho de Melo)

   - Inform the user about objdump failures in 'perf annotate' (Andi
     Kleen)

   - Improve the LLVM 'perf test' entry, introduce a new ones for BPF
     and kbuild tests to check the environment used by clang to compile
     .c scriptlets (Wang Nan)"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (32 commits)
  perf/x86/intel/rapl: Remove the unused RAPL_EVENT_DESC() macro
  tools include: Add compiler.h to list.h
  perf probe: Verify parameters in two functions
  perf session: Add missing newlines to some pr_err() calls
  perf annotate: Support full source file paths for srcline fix
  perf test: Add llvm-src-base.c and llvm-src-kbuild.c to .gitignore
  perf: Fix inherited events vs. tracepoint filters
  perf: Disable IRQs across RCU RS CS that acquires scheduler lock
  perf test: Do not be case sensitive when searching for matching tests
  perf test: Add 'perf test BPF'
  perf test: Enhance the LLVM tests: add kbuild test
  perf test: Enhance the LLVM test: update basic BPF test program
  perf bpf: Improve BPF related error messages
  perf tools: Make fetch_kernel_version() publicly available
  bpf tools: Add new API bpf_object__get_kversion()
  bpf tools: Improve libbpf error reporting
  perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy
  perf annotate: Inform the user about objdump failures in --stdio
  perf stat: Make stat options global
  perf sched latency: Fix thread pid reuse issue
  ...

1  2 
kernel/events/core.c

diff --combined kernel/events/core.c
@@@ -1050,13 -1050,13 +1050,13 @@@ retry
        /*
         * One of the few rules of preemptible RCU is that one cannot do
         * rcu_read_unlock() while holding a scheduler (or nested) lock when
-        * part of the read side critical section was preemptible -- see
+        * part of the read side critical section was irqs-enabled -- see
         * rcu_read_unlock_special().
         *
         * Since ctx->lock nests under rq->lock we must ensure the entire read
-        * side critical section is non-preemptible.
+        * side critical section has interrupts disabled.
         */
-       preempt_disable();
+       local_irq_save(*flags);
        rcu_read_lock();
        ctx = rcu_dereference(task->perf_event_ctxp[ctxn]);
        if (ctx) {
                 * if so.  If we locked the right context, then it
                 * can't get swapped on us any more.
                 */
-               raw_spin_lock_irqsave(&ctx->lock, *flags);
+               raw_spin_lock(&ctx->lock);
                if (ctx != rcu_dereference(task->perf_event_ctxp[ctxn])) {
-                       raw_spin_unlock_irqrestore(&ctx->lock, *flags);
+                       raw_spin_unlock(&ctx->lock);
                        rcu_read_unlock();
-                       preempt_enable();
+                       local_irq_restore(*flags);
                        goto retry;
                }
  
                if (!atomic_inc_not_zero(&ctx->refcount)) {
-                       raw_spin_unlock_irqrestore(&ctx->lock, *flags);
+                       raw_spin_unlock(&ctx->lock);
                        ctx = NULL;
                }
        }
        rcu_read_unlock();
-       preempt_enable();
+       if (!ctx)
+               local_irq_restore(*flags);
        return ctx;
  }
  
@@@ -5375,15 -5376,9 +5376,15 @@@ void perf_output_sample(struct perf_out
  
        if (sample_type & PERF_SAMPLE_RAW) {
                if (data->raw) {
 -                      perf_output_put(handle, data->raw->size);
 -                      __output_copy(handle, data->raw->data,
 -                                         data->raw->size);
 +                      u32 raw_size = data->raw->size;
 +                      u32 real_size = round_up(raw_size + sizeof(u32),
 +                                               sizeof(u64)) - sizeof(u32);
 +                      u64 zero = 0;
 +
 +                      perf_output_put(handle, real_size);
 +                      __output_copy(handle, data->raw->data, raw_size);
 +                      if (real_size - raw_size)
 +                              __output_copy(handle, &zero, real_size - raw_size);
                } else {
                        struct {
                                u32     size;
@@@ -5515,7 -5510,8 +5516,7 @@@ void perf_prepare_sample(struct perf_ev
                else
                        size += sizeof(u32);
  
 -              WARN_ON_ONCE(size & (sizeof(u64)-1));
 -              header->size += size;
 +              header->size += round_up(size, sizeof(u64));
        }
  
        if (sample_type & PERF_SAMPLE_BRANCH_STACK) {
@@@ -6913,6 -6909,10 +6914,10 @@@ static int perf_tp_filter_match(struct 
  {
        void *record = data->raw->data;
  
+       /* only top level events have filters set */
+       if (event->parent)
+               event = event->parent;
        if (likely(!event->filter) || filter_match_preds(event->filter, record))
                return 1;
        return 0;
@@@ -9460,9 -9460,17 +9465,9 @@@ static void perf_cgroup_attach(struct c
                task_function_call(task, __perf_cgroup_move, task);
  }
  
 -static void perf_cgroup_exit(struct cgroup_subsys_state *css,
 -                           struct cgroup_subsys_state *old_css,
 -                           struct task_struct *task)
 -{
 -      task_function_call(task, __perf_cgroup_move, task);
 -}
 -
  struct cgroup_subsys perf_event_cgrp_subsys = {
        .css_alloc      = perf_cgroup_css_alloc,
        .css_free       = perf_cgroup_css_free,
 -      .exit           = perf_cgroup_exit,
        .attach         = perf_cgroup_attach,
  };
  #endif /* CONFIG_CGROUP_PERF */