From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, vince@deater.net,
eranian@google.com, Arnaldo Carvalho de Melo <acme@infradead.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [PATCH v1 3/5] perf: Extend perf_event_aux_ctx() to optionally iterate through more events
Date: Thu, 21 Apr 2016 18:17:01 +0300 [thread overview]
Message-ID: <1461251823-12416-4-git-send-email-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <1461251823-12416-1-git-send-email-alexander.shishkin@linux.intel.com>
Trace filtering code needs an iterator that can go through all events in
a context, including inactive and filtered, to be able to update their
filters' address ranges based on mmap or exec events.
This patch changes perf_event_aux_ctx() to optionally do this.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
kernel/events/core.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index c73fd59811..9260a8a073 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5812,15 +5812,18 @@ typedef void (perf_event_aux_output_cb)(struct perf_event *event, void *data);
static void
perf_event_aux_ctx(struct perf_event_context *ctx,
perf_event_aux_output_cb output,
- void *data)
+ void *data, bool all)
{
struct perf_event *event;
list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
- if (event->state < PERF_EVENT_STATE_INACTIVE)
- continue;
- if (!event_filter_match(event))
- continue;
+ if (!all) {
+ if (event->state < PERF_EVENT_STATE_INACTIVE)
+ continue;
+ if (!event_filter_match(event))
+ continue;
+ }
+
output(event, data);
}
}
@@ -5831,7 +5834,7 @@ perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data,
{
rcu_read_lock();
preempt_disable();
- perf_event_aux_ctx(task_ctx, output, data);
+ perf_event_aux_ctx(task_ctx, output, data, false);
preempt_enable();
rcu_read_unlock();
}
@@ -5875,7 +5878,7 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
for_each_task_context_nr(ctxn) {
ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
if (ctx)
- perf_event_aux_ctx(ctx, output, data);
+ perf_event_aux_ctx(ctx, output, data, false);
}
preempt_enable();
rcu_read_unlock();
@@ -5916,10 +5919,10 @@ static int __perf_pmu_output_stop(void *info)
};
rcu_read_lock();
- perf_event_aux_ctx(&cpuctx->ctx, __perf_event_output_stop, &ro);
+ perf_event_aux_ctx(&cpuctx->ctx, __perf_event_output_stop, &ro, false);
if (cpuctx->task_ctx)
perf_event_aux_ctx(cpuctx->task_ctx, __perf_event_output_stop,
- &ro);
+ &ro, false);
rcu_read_unlock();
return ro.err;
--
2.8.0.rc3
next prev parent reply other threads:[~2016-04-21 15:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 15:16 [PATCH v1 0/5] perf: Introduce address range filtering Alexander Shishkin
2016-04-21 15:16 ` [PATCH v1 1/5] perf: Move set_filter() from behind EVENT_TRACING Alexander Shishkin
2016-04-21 15:17 ` [PATCH v1 2/5] perf/x86/intel/pt: IP filtering register/cpuid bits Alexander Shishkin
2016-04-21 17:48 ` Borislav Petkov
2016-04-21 18:55 ` Thomas Gleixner
2016-04-21 19:17 ` Peter Zijlstra
2016-04-21 20:39 ` Borislav Petkov
2016-04-21 20:37 ` Borislav Petkov
2016-04-22 7:58 ` Thomas Gleixner
2016-04-22 9:34 ` Borislav Petkov
2016-04-21 15:17 ` Alexander Shishkin [this message]
2016-04-21 15:17 ` [PATCH v1 4/5] perf: Introduce address range filtering Alexander Shishkin
2016-04-22 7:45 ` Peter Zijlstra
2016-04-22 16:19 ` Alexander Shishkin
2016-04-25 12:57 ` Peter Zijlstra
2016-04-25 15:41 ` Alexander Shishkin
2016-04-25 13:10 ` Peter Zijlstra
2016-04-25 13:36 ` Peter Zijlstra
2016-04-25 16:02 ` Alexander Shishkin
2016-04-25 13:19 ` Peter Zijlstra
2016-04-25 16:03 ` Alexander Shishkin
2016-04-25 14:14 ` Peter Zijlstra
2016-04-25 16:07 ` Alexander Shishkin
2016-04-25 14:25 ` Peter Zijlstra
2016-04-25 16:14 ` Alexander Shishkin
2016-04-26 14:35 ` Alexander Shishkin
2016-04-21 15:17 ` [PATCH v1 5/5] perf/x86/intel/pt: Add support for address range filtering in PT Alexander Shishkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461251823-12416-4-git-send-email-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@infradead.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@redhat.com \
--cc=vince@deater.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome