Commit 00e8976200665eec2fa9264d61885b4d1384d4f0
Merge branch 'perf/urgent' into perf/core
Conflicts: tools/perf/util/ui/browsers/hists.c Merge reason: fix the conflict and merge in changes for dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 7 changed files Side-by-side Diff
arch/arm/oprofile/common.c
... | ... | @@ -102,6 +102,7 @@ |
102 | 102 | if (IS_ERR(pevent)) { |
103 | 103 | ret = PTR_ERR(pevent); |
104 | 104 | } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) { |
105 | + perf_event_release_kernel(pevent); | |
105 | 106 | pr_warning("oprofile: failed to enable event %d " |
106 | 107 | "on CPU %d\n", event, cpu); |
107 | 108 | ret = -EBUSY; |
... | ... | @@ -365,6 +366,7 @@ |
365 | 366 | ret = init_driverfs(); |
366 | 367 | if (ret) { |
367 | 368 | kfree(counter_config); |
369 | + counter_config = NULL; | |
368 | 370 | return ret; |
369 | 371 | } |
370 | 372 | |
... | ... | @@ -402,7 +404,6 @@ |
402 | 404 | struct perf_event *event; |
403 | 405 | |
404 | 406 | if (*perf_events) { |
405 | - exit_driverfs(); | |
406 | 407 | for_each_possible_cpu(cpu) { |
407 | 408 | for (id = 0; id < perf_num_counters; ++id) { |
408 | 409 | event = perf_events[cpu][id]; |
409 | 410 | |
... | ... | @@ -413,8 +414,10 @@ |
413 | 414 | } |
414 | 415 | } |
415 | 416 | |
416 | - if (counter_config) | |
417 | + if (counter_config) { | |
417 | 418 | kfree(counter_config); |
419 | + exit_driverfs(); | |
420 | + } | |
418 | 421 | } |
419 | 422 | #else |
420 | 423 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
arch/x86/kernel/Makefile
arch/x86/kernel/cpu/perf_event.c
... | ... | @@ -102,6 +102,7 @@ |
102 | 102 | */ |
103 | 103 | struct perf_event *events[X86_PMC_IDX_MAX]; /* in counter order */ |
104 | 104 | unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; |
105 | + unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; | |
105 | 106 | int enabled; |
106 | 107 | |
107 | 108 | int n_events; |
... | ... | @@ -1034,6 +1035,7 @@ |
1034 | 1035 | |
1035 | 1036 | cpuc->events[idx] = event; |
1036 | 1037 | __set_bit(idx, cpuc->active_mask); |
1038 | + __set_bit(idx, cpuc->running); | |
1037 | 1039 | x86_pmu.enable(event); |
1038 | 1040 | perf_event_update_userpage(event); |
1039 | 1041 | } |
1040 | 1042 | |
... | ... | @@ -1159,8 +1161,16 @@ |
1159 | 1161 | cpuc = &__get_cpu_var(cpu_hw_events); |
1160 | 1162 | |
1161 | 1163 | for (idx = 0; idx < x86_pmu.num_counters; idx++) { |
1162 | - if (!test_bit(idx, cpuc->active_mask)) | |
1164 | + if (!test_bit(idx, cpuc->active_mask)) { | |
1165 | + /* | |
1166 | + * Though we deactivated the counter some cpus | |
1167 | + * might still deliver spurious interrupts still | |
1168 | + * in flight. Catch them: | |
1169 | + */ | |
1170 | + if (__test_and_clear_bit(idx, cpuc->running)) | |
1171 | + handled++; | |
1163 | 1172 | continue; |
1173 | + } | |
1164 | 1174 | |
1165 | 1175 | event = cpuc->events[idx]; |
1166 | 1176 | hwc = &event->hw; |
arch/x86/kernel/cpu/perf_event_p4.c
... | ... | @@ -904,8 +904,12 @@ |
904 | 904 | for (idx = 0; idx < x86_pmu.num_counters; idx++) { |
905 | 905 | int overflow; |
906 | 906 | |
907 | - if (!test_bit(idx, cpuc->active_mask)) | |
907 | + if (!test_bit(idx, cpuc->active_mask)) { | |
908 | + /* catch in-flight IRQs */ | |
909 | + if (__test_and_clear_bit(idx, cpuc->running)) | |
910 | + handled++; | |
908 | 911 | continue; |
912 | + } | |
909 | 913 | |
910 | 914 | event = cpuc->events[idx]; |
911 | 915 | hwc = &event->hw; |
arch/x86/oprofile/nmi_int.c
tools/perf/Makefile
... | ... | @@ -1035,7 +1035,7 @@ |
1035 | 1035 | # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So |
1036 | 1036 | # we depend the various files onto their directories. |
1037 | 1037 | DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h |
1038 | -$(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS))) | |
1038 | +$(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) | |
1039 | 1039 | # In the second step, we make a rule to actually create these directories |
1040 | 1040 | $(sort $(dir $(DIRECTORY_DEPS))): |
1041 | 1041 | $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null |
tools/perf/util/trace-event-scripting.c
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | register_python_scripting(&python_scripting_unsupported_ops); |
98 | 98 | } |
99 | 99 | #else |
100 | -struct scripting_ops python_scripting_ops; | |
100 | +extern struct scripting_ops python_scripting_ops; | |
101 | 101 | |
102 | 102 | void setup_python_scripting(void) |
103 | 103 | { |
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | register_perl_scripting(&perl_scripting_unsupported_ops); |
159 | 159 | } |
160 | 160 | #else |
161 | -struct scripting_ops perl_scripting_ops; | |
161 | +extern struct scripting_ops perl_scripting_ops; | |
162 | 162 | |
163 | 163 | void setup_perl_scripting(void) |
164 | 164 | { |