Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Dec 2014 21:15:24 +0000 (13:15 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Dec 2014 21:15:24 +0000 (13:15 -0800)
Pull perf fixes and cleanups from Ingo Molnar:
 "A kernel fix plus mostly tooling fixes, but also some tooling
  restructuring and cleanups"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (39 commits)
  perf: Fix building warning on ARM 32
  perf symbols: Fix use after free in filename__read_build_id
  perf evlist: Use roundup_pow_of_two
  tools: Adopt roundup_pow_of_two
  perf tools: Make the mmap length autotuning more robust
  tools: Adopt rounddown_pow_of_two and deps
  tools: Adopt fls_long and deps
  tools: Move bitops.h from tools/perf/util to tools/
  tools: Introduce asm-generic/bitops.h
  tools lib: Move asm-generic/bitops/find.h code to tools/include and tools/lib
  tools: Whitespace prep patches for moving bitops.h
  tools: Move code originally from asm-generic/atomic.h into tools/include/asm-generic/
  tools: Move code originally from linux/log2.h to tools/include/linux/
  tools: Move __ffs implementation to tools/include/asm-generic/bitops/__ffs.h
  perf evlist: Do not use hard coded value for a mmap_pages default
  perf trace: Let the perf_evlist__mmap autosize the number of pages to use
  perf evlist: Improve the strerror_mmap method
  perf evlist: Clarify sterror_mmap variable names
  perf evlist: Fixup brown paper bag on "hint" for --mmap-pages cmdline arg
  perf trace: Provide a better explanation when mmap fails
  ...

1  2 
arch/x86/kernel/cpu/perf_event_intel_uncore.c
kernel/events/core.c

@@@ -276,6 -276,17 +276,17 @@@ static struct intel_uncore_box *uncore_
        return box;
  }
  
+ /*
+  * Using uncore_pmu_event_init pmu event_init callback
+  * as a detection point for uncore events.
+  */
+ static int uncore_pmu_event_init(struct perf_event *event);
+ static bool is_uncore_event(struct perf_event *event)
+ {
+       return event->pmu->event_init == uncore_pmu_event_init;
+ }
  static int
  uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, bool dogrp)
  {
                return -EINVAL;
  
        n = box->n_events;
-       box->event_list[n] = leader;
-       n++;
+       if (is_uncore_event(leader)) {
+               box->event_list[n] = leader;
+               n++;
+       }
        if (!dogrp)
                return n;
  
        list_for_each_entry(event, &leader->sibling_list, group_entry) {
-               if (event->state <= PERF_EVENT_STATE_OFF)
+               if (!is_uncore_event(event) ||
+                   event->state <= PERF_EVENT_STATE_OFF)
                        continue;
  
                if (n >= max_count)
@@@ -647,7 -663,11 +663,7 @@@ static int uncore_pmu_event_init(struc
  static ssize_t uncore_get_attr_cpumask(struct device *dev,
                                struct device_attribute *attr, char *buf)
  {
 -      int n = cpulist_scnprintf(buf, PAGE_SIZE - 2, &uncore_cpu_mask);
 -
 -      buf[n++] = '\n';
 -      buf[n] = '\0';
 -      return n;
 +      return cpumap_print_to_pagebuf(true, buf, &uncore_cpu_mask);
  }
  
  static DEVICE_ATTR(cpumask, S_IRUGO, uncore_get_attr_cpumask, NULL);
diff --combined kernel/events/core.c
@@@ -614,7 -614,7 +614,7 @@@ static inline int perf_cgroup_connect(i
        if (!f.file)
                return -EBADF;
  
 -      css = css_tryget_online_from_dir(f.file->f_dentry,
 +      css = css_tryget_online_from_dir(f.file->f_path.dentry,
                                         &perf_event_cgrp_subsys);
        if (IS_ERR(css)) {
                ret = PTR_ERR(css);
@@@ -7477,11 -7477,11 +7477,11 @@@ SYSCALL_DEFINE5(perf_event_open
  
        if (move_group) {
                synchronize_rcu();
-               perf_install_in_context(ctx, group_leader, event->cpu);
+               perf_install_in_context(ctx, group_leader, group_leader->cpu);
                get_ctx(ctx);
                list_for_each_entry(sibling, &group_leader->sibling_list,
                                    group_entry) {
-                       perf_install_in_context(ctx, sibling, event->cpu);
+                       perf_install_in_context(ctx, sibling, sibling->cpu);
                        get_ctx(ctx);
                }
        }