diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-04-08 18:28:14 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-04-14 12:20:33 -0400 |
commit | df8290bf7ea6b3051e2f315579a6e829309ec1ed (patch) | |
tree | e142ed95335a9e1790deabc11448ee6e215bb855 /kernel/perf_event.c | |
parent | 76e1d9047e4edefb8ada20aa90d5762306082bd6 (diff) |
perf: Make clock software events consistent with general exclusion rules
The cpu/task clock events implement their own version of exclusion
on top of exclude_user and exclude_kernel.
The result is that when the event triggered in the kernel but we
have exclude_kernel set, we try to rewind using task_pt_regs.
There are two side effects of this:
- we call task_pt_regs even on kernel threads, which doesn't give
us the desired result.
- if the event occured in the kernel, we shouldn't rewind to the
user context. We want to actually ignore the event.
get_irq_regs() will always give us the right interrupted context, so
use its result and submit it to perf_exclude_context() that knows
when an event must be ignored.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 9efdfe5b8d3b..095101d685bc 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -4164,15 +4164,8 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) | |||
4164 | perf_sample_data_init(&data, 0); | 4164 | perf_sample_data_init(&data, 0); |
4165 | data.period = event->hw.last_period; | 4165 | data.period = event->hw.last_period; |
4166 | regs = get_irq_regs(); | 4166 | regs = get_irq_regs(); |
4167 | /* | ||
4168 | * In case we exclude kernel IPs or are somehow not in interrupt | ||
4169 | * context, provide the next best thing, the user IP. | ||
4170 | */ | ||
4171 | if ((event->attr.exclude_kernel || !regs) && | ||
4172 | !event->attr.exclude_user) | ||
4173 | regs = task_pt_regs(current); | ||
4174 | 4167 | ||
4175 | if (regs) { | 4168 | if (regs && !perf_exclude_event(event, regs)) { |
4176 | if (!(event->attr.exclude_idle && current->pid == 0)) | 4169 | if (!(event->attr.exclude_idle && current->pid == 0)) |
4177 | if (perf_event_overflow(event, 0, &data, regs)) | 4170 | if (perf_event_overflow(event, 0, &data, regs)) |
4178 | ret = HRTIMER_NORESTART; | 4171 | ret = HRTIMER_NORESTART; |