linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] perf auxtrace: Make auxtrace_queues__add_buffer() return buffer_ptr
Date: Tue,  6 Mar 2018 11:13:16 +0200	[thread overview]
Message-ID: <1520327598-1317-6-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1520327598-1317-1-git-send-email-adrian.hunter@intel.com>

In preparation for supporting AUX area sampling buffers,
auxtrace_queues__add_buffer() needs to be more generic. To that end, make
it return buffer_ptr instead of the caller.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/auxtrace.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 6ea840ec5b7f..fb357a00dd86 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -305,8 +305,11 @@ static int auxtrace_queues__split_buffer(struct auxtrace_queues *queues,
 static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
 				       struct perf_session *session,
 				       unsigned int idx,
-				       struct auxtrace_buffer *buffer)
+				       struct auxtrace_buffer *buffer,
+				       struct auxtrace_buffer **buffer_ptr)
 {
+	int err;
+
 	if (session->one_mmap) {
 		buffer->data = buffer->data_offset - session->one_mmap_offset +
 			       session->one_mmap_addr;
@@ -317,14 +320,20 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
 		buffer->data_needs_freeing = true;
 	} else if (BITS_PER_LONG == 32 &&
 		   buffer->size > BUFFER_LIMIT_FOR_32_BIT) {
-		int err;
-
 		err = auxtrace_queues__split_buffer(queues, idx, buffer);
 		if (err)
 			return err;
 	}
 
-	return auxtrace_queues__queue_buffer(queues, idx, buffer);
+	err = auxtrace_queues__queue_buffer(queues, idx, buffer);
+	if (err)
+		return err;
+
+	/* FIXME: Doesn't work for split buffer */
+	if (buffer_ptr)
+		*buffer_ptr = buffer;
+
+	return 0;
 }
 
 static bool filter_cpu(struct perf_session *session, int cpu)
@@ -359,13 +368,11 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues,
 	buffer->size = event->auxtrace.size;
 	idx = event->auxtrace.idx;
 
-	err = auxtrace_queues__add_buffer(queues, session, idx, buffer);
+	err = auxtrace_queues__add_buffer(queues, session, idx, buffer,
+					  buffer_ptr);
 	if (err)
 		goto out_err;
 
-	if (buffer_ptr)
-		*buffer_ptr = buffer;
-
 	return 0;
 
 out_err:
-- 
1.9.1

  parent reply	other threads:[~2018-03-06  9:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06  9:13 [PATCH 0/7] perf tools: Prepare for AUX area sampling support Adrian Hunter
2018-03-06  9:13 ` [PATCH 1/7] perf record: Combine some auxtrace initialization into a single function Adrian Hunter
2018-03-09  8:38   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 2/7] perf auxtrace: Prevent decoding when --no-itrace Adrian Hunter
2018-03-06 14:06   ` Arnaldo Carvalho de Melo
2018-03-06 14:21     ` Adrian Hunter
2018-03-06 14:32       ` Arnaldo Carvalho de Melo
2018-03-07  8:27   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 3/7] perf auxtrace: Add missing parameters from kernel-doc comments Adrian Hunter
2018-03-09  8:40   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 4/7] perf auxtrace: Rename some buffer-queuing functions Adrian Hunter
2018-03-09  8:40   ` [tip:perf/core] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` Adrian Hunter [this message]
2018-03-09  8:41   ` [tip:perf/core] perf auxtrace: Make auxtrace_queues__add_buffer() return buffer_ptr tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 6/7] perf auxtrace: Make auxtrace_queues__add_buffer() allocate struct buffer Adrian Hunter
2018-03-06 20:25   ` Arnaldo Carvalho de Melo
2018-03-07  8:06     ` Adrian Hunter
2018-03-07 14:11       ` Arnaldo Carvalho de Melo
2018-04-05  6:17         ` Adrian Hunter
2018-04-05 11:33           ` Arnaldo Carvalho de Melo
2018-04-06 17:04   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2018-03-06  9:13 ` [PATCH 7/7] perf auxtrace: Make auxtrace_queues__add_buffer() do CPU filtering Adrian Hunter
2018-04-06 11:44   ` Adrian Hunter
2018-04-10  5:28   ` [tip:perf/urgent] " tip-bot for Adrian Hunter

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=1520327598-1317-6-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).