diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 15:32:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 15:32:47 -0500 |
commit | 8aedf8a6ae98d5d4df3254b6afb7e4432d9d8600 (patch) | |
tree | 444d19b9172009e81a0ba9e7e5be3e0910bdd978 /kernel/perf_event.c | |
parent | bac5e54c29f352d962a2447d22735316b347b9f1 (diff) | |
parent | 60ab271617cec607380099f3ed8e84916e48323b (diff) |
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (52 commits)
perf record: Use per-task-per-cpu events for inherited events
perf record: Properly synchronize child creation
perf events: Allow per-task-per-cpu counters
perf diff: Percent calcs should use double values
perf diff: Change the default sort order to "dso,symbol"
perf diff: Use perf_session__fprintf_hists just like 'perf record'
perf report: Fix cut'n'paste error recently introduced
perf session: Move perf report specific hits out of perf_session__fprintf_hists
perf tools: Move hist entries printing routines from perf report
perf report: Generalize perf_session__fprintf_hists()
perf symbols: Move symbol filtering to event__preprocess_sample()
perf symbols: Adopt the strlists for dso, comm
perf symbols: Make symbol_conf global
perf probe: Fix to show which probe point is not found
perf probe: Check symbols in symtab/kallsyms
perf probe: Check build-id of vmlinux
perf probe: Reject second attempt of adding same-name event
perf probe: Support event name for --add option
perf probe: Add glob matching support on --del
perf probe: Use strlist__for_each macros in probe-event.c
...
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 9052d6c8c9fd..8ab86988bd24 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -782,6 +782,9 @@ static void __perf_install_in_context(void *info) | |||
782 | 782 | ||
783 | add_event_to_ctx(event, ctx); | 783 | add_event_to_ctx(event, ctx); |
784 | 784 | ||
785 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
786 | goto unlock; | ||
787 | |||
785 | /* | 788 | /* |
786 | * Don't put the event on if it is disabled or if | 789 | * Don't put the event on if it is disabled or if |
787 | * it is in a group and the group isn't on. | 790 | * it is in a group and the group isn't on. |
@@ -925,6 +928,9 @@ static void __perf_event_enable(void *info) | |||
925 | goto unlock; | 928 | goto unlock; |
926 | __perf_event_mark_enabled(event, ctx); | 929 | __perf_event_mark_enabled(event, ctx); |
927 | 930 | ||
931 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | ||
932 | goto unlock; | ||
933 | |||
928 | /* | 934 | /* |
929 | * If the event is in a group and isn't the group leader, | 935 | * If the event is in a group and isn't the group leader, |
930 | * then don't put it on unless the group is on. | 936 | * then don't put it on unless the group is on. |
@@ -1595,15 +1601,12 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu) | |||
1595 | unsigned long flags; | 1601 | unsigned long flags; |
1596 | int err; | 1602 | int err; |
1597 | 1603 | ||
1598 | /* | 1604 | if (pid == -1 && cpu != -1) { |
1599 | * If cpu is not a wildcard then this is a percpu event: | ||
1600 | */ | ||
1601 | if (cpu != -1) { | ||
1602 | /* Must be root to operate on a CPU event: */ | 1605 | /* Must be root to operate on a CPU event: */ |
1603 | if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) | 1606 | if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) |
1604 | return ERR_PTR(-EACCES); | 1607 | return ERR_PTR(-EACCES); |
1605 | 1608 | ||
1606 | if (cpu < 0 || cpu > num_possible_cpus()) | 1609 | if (cpu < 0 || cpu >= nr_cpumask_bits) |
1607 | return ERR_PTR(-EINVAL); | 1610 | return ERR_PTR(-EINVAL); |
1608 | 1611 | ||
1609 | /* | 1612 | /* |
@@ -4564,7 +4567,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, | |||
4564 | if (attr->type >= PERF_TYPE_MAX) | 4567 | if (attr->type >= PERF_TYPE_MAX) |
4565 | return -EINVAL; | 4568 | return -EINVAL; |
4566 | 4569 | ||
4567 | if (attr->__reserved_1 || attr->__reserved_2 || attr->__reserved_3) | 4570 | if (attr->__reserved_1 || attr->__reserved_2) |
4568 | return -EINVAL; | 4571 | return -EINVAL; |
4569 | 4572 | ||
4570 | if (attr->sample_type & ~(PERF_SAMPLE_MAX-1)) | 4573 | if (attr->sample_type & ~(PERF_SAMPLE_MAX-1)) |