All of lore.kernel.org
 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: Re: [PATCH 6/7] perf auxtrace: Make auxtrace_queues__add_buffer() allocate struct buffer
Date: Thu, 5 Apr 2018 09:17:01 +0300	[thread overview]
Message-ID: <d2ca2f6f-4b60-b22c-98f3-900cc544bf99@intel.com> (raw)
In-Reply-To: <20180307141154.GE3701@kernel.org>

On 07/03/18 16:11, Arnaldo Carvalho de Melo wrote:
> Em Wed, Mar 07, 2018 at 10:06:50AM +0200, Adrian Hunter escreveu:
>> On 06/03/18 22:25, Arnaldo Carvalho de Melo wrote:
>>> Em Tue, Mar 06, 2018 at 11:13:17AM +0200, Adrian Hunter escreveu:
>>>> In preparation for supporting AUX area sampling buffers,
>>>> auxtrace_queues__add_buffer() needs to be more generic. To that end, move
>>>> memory allocation for struct buffer into it.
>>>>
>>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>>> ---
>>>>  tools/perf/util/auxtrace.c | 54 +++++++++++++++++++++-------------------------
>>>>  1 file changed, 24 insertions(+), 30 deletions(-)
>>>>
>>>> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
>>>> index fb357a00dd86..e1aff91c54a8 100644
>>>> --- a/tools/perf/util/auxtrace.c
>>>> +++ b/tools/perf/util/auxtrace.c
>>>> @@ -308,7 +308,11 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
>>>>  				       struct auxtrace_buffer *buffer,
>>>>  				       struct auxtrace_buffer **buffer_ptr)
>>>>  {
>>>> -	int err;
>>>> +	int err = -ENOMEM;
>>>> +
>>>> +	buffer = memdup(buffer, sizeof(*buffer));
>>>
>>> this is a bit strange, why not make buffer a local variable in this
>>> function then?
>>
>> Do you mean the following?
>>
>> 	struct auxtrace_buffer *new_buf;
>>
>> 	new_buf = memdup(buffer, sizeof(*buffer));
> 
> I hadn't noticed that you were using buffer as both r and l value :-\
> 
> If all you want is to receive that buffer, duplicate it and then use
> just the duplicate, not needing any reference to the original buffer,
> then your code is correct, it just looked strange from a quick look, so
> nevermind, I'll continue processing this one and the others.

Looks like this patch and patch 7 "perf auxtrace: Make
auxtrace_queues__add_buffer() do CPU filtering" got left behind.  They still
apply cleanly.

  reply	other threads:[~2018-04-05  6:18 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 ` [PATCH 5/7] perf auxtrace: Make auxtrace_queues__add_buffer() return buffer_ptr Adrian Hunter
2018-03-09  8:41   ` [tip:perf/core] " 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 [this message]
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=d2ca2f6f-4b60-b22c-98f3-900cc544bf99@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.