From: Jiri Olsa <jolsa@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH 1/2] perf: Enable wakeup_events logic for all events
Date: Thu, 30 May 2013 11:53:06 +0200 [thread overview]
Message-ID: <1369907587-8963-2-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1369907587-8963-1-git-send-email-jolsa@redhat.com>
Currently the perf_events_attr::wakeup_events logic is
checked only for regular samples.
If we have an event that produce only auxiliary events
(MMAP|COMM|EXIT|FORK), the poll call does not follow
the perf_events_attr wakeup_events setup and reports
no data.
Fixing this by moving the perf_events_attr::wakeup_events
checking logic into the function and calling it from
perf_output_end. This way any output event is checked
properly.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
---
kernel/events/core.c | 14 --------------
kernel/events/ring_buffer.c | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a0780b3..516eb25 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4281,20 +4281,6 @@ void perf_output_sample(struct perf_output_handle *handle,
}
}
- if (!event->attr.watermark) {
- int wakeup_events = event->attr.wakeup_events;
-
- if (wakeup_events) {
- struct ring_buffer *rb = handle->rb;
- int events = local_inc_return(&rb->events);
-
- if (events >= wakeup_events) {
- local_sub(wakeup_events, &rb->events);
- local_inc(&rb->wakeup);
- }
- }
- }
-
if (sample_type & PERF_SAMPLE_BRANCH_STACK) {
if (data->br_stack) {
size_t size;
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index cd55144..1385fb1 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -54,6 +54,25 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
irq_work_queue(&handle->event->pending);
}
+static void perf_output_check_wakeup(struct perf_output_handle *handle)
+{
+ struct perf_event *event = handle->event;
+
+ if (!event->attr.watermark) {
+ int wakeup_events = event->attr.wakeup_events;
+
+ if (wakeup_events) {
+ struct ring_buffer *rb = handle->rb;
+ int events = local_inc_return(&rb->events);
+
+ if (events >= wakeup_events) {
+ local_sub(wakeup_events, &rb->events);
+ local_inc(&rb->wakeup);
+ }
+ }
+ }
+}
+
/*
* We need to ensure a later event_id doesn't publish a head when a former
* event isn't done writing. However since we need to deal with NMIs we
@@ -208,6 +227,7 @@ unsigned int perf_output_skip(struct perf_output_handle *handle,
void perf_output_end(struct perf_output_handle *handle)
{
+ perf_output_check_wakeup(handle);
perf_output_put_handle(handle);
rcu_read_unlock();
}
--
1.7.11.7
next prev parent reply other threads:[~2013-05-30 9:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 9:53 [PATCH 0/2] perf: Fix wakeup_events logic Jiri Olsa
2013-05-30 9:53 ` Jiri Olsa [this message]
2013-05-30 11:02 ` [PATCH 1/2] perf: Enable wakeup_events logic for all events Peter Zijlstra
2013-05-30 11:45 ` Jiri Olsa
2013-05-30 11:51 ` Arnaldo Carvalho de Melo
2013-05-30 11:56 ` Jiri Olsa
2013-05-30 9:53 ` [PATCH 2/2] perf tests: Add auxiliary events poll automated test Jiri Olsa
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=1369907587-8963-2-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
/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