All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: <acme@kernel.org>, <lizefan@huawei.com>,
	<linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	He Kuang <hekuang@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Nilay Vaish <nilayvaish@gmail.com>
Subject: Re: [PATCH v15 03/12] perf tools: Update perf evlist mmap related APIs and helpers
Date: Thu, 14 Jul 2016 09:58:09 +0800	[thread overview]
Message-ID: <5786F1B1.40307@huawei.com> (raw)
In-Reply-To: <20160713140637.GB31742@krava>



On 2016/7/13 22:06, Jiri Olsa wrote:
> On Tue, Jul 12, 2016 at 10:00:03AM +0000, Wang Nan wrote:
>
> SNIP
>
>> -union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx)
>> +union perf_event *perf_mmap__read_forward(struct perf_mmap *md, bool overwrite)
>>   {
>> -	struct perf_mmap *md = &evlist->mmap[idx];
>>   	u64 head;
>>   	u64 old = md->prev;
>>   
>> @@ -795,13 +795,12 @@ union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int
>>   
>>   	head = perf_mmap__read_head(md);
>>   
>> -	return perf_mmap__read(md, evlist->overwrite, old, head, &md->prev);
>> +	return perf_mmap__read(md, overwrite, old, head, &md->prev);
>>   }
>>   
>>   union perf_event *
>> -perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
>> +perf_mmap__read_backward(struct perf_mmap *md, bool overwrite __maybe_unused)
>>   {
>> -	struct perf_mmap *md = &evlist->mmap[idx];
>>   	u64 head, end;
>>   	u64 start = md->prev;
>>   
>> @@ -836,6 +835,20 @@ perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
>>   	return perf_mmap__read(md, false, start, end, &md->prev);
> should you pas evlist->overwrite in here?

No need. The second arg of perf_mmap__read() is not 'overwrite', but 
'check_messup'.
When set to 'true', stop reading if caller require a buffer larger than 
half of the
size of the ring buffer and report a warning. Only forward, read-only 
ring buffer
requires this check. We can always read the whole backward ring buffer 
because we
pause it before reading.

I'll add more comments here.

Thank you.

> thanks,
> jirka

  reply	other threads:[~2016-07-14  1:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 10:00 [PATCH v15 00/12] perf tools: Support overwritable ring buffer Wang Nan
2016-07-12 10:00 ` [PATCH v15 01/12] perf tools: Drop redundant evsel->overwrite indicator Wang Nan
2016-07-12 10:00 ` [PATCH v15 02/12] tools lib fd array: Allow associating a pointer cookie with each entry Wang Nan
2016-07-12 10:00 ` [PATCH v15 03/12] perf tools: Update perf evlist mmap related APIs and helpers Wang Nan
2016-07-13 14:06   ` Jiri Olsa
2016-07-14  1:58     ` Wangnan (F) [this message]
2016-07-12 10:00 ` [PATCH v15 04/12] perf tools: Record mmap cookie into fdarray private field Wang Nan
2016-07-12 10:00 ` [PATCH v15 05/12] perf tools: Extract common code in mmap failure processing Wang Nan
2016-07-12 10:00 ` [PATCH v15 06/12] perf tools: Alloc backward_mmap array for evlist Wang Nan
2016-07-12 10:00 ` [PATCH v15 07/12] perf tools: Map backward events to backward_mmap Wang Nan
2016-07-13 14:06   ` Jiri Olsa
2016-07-12 10:00 ` [PATCH v15 08/12] perf tools: Drop evlist->backward Wang Nan
2016-07-12 10:00 ` [PATCH v15 09/12] perf record: Read from overwritable ring buffer Wang Nan
2016-07-13 14:06   ` Jiri Olsa
2016-07-13 14:07   ` Jiri Olsa
2016-07-13 14:07   ` Jiri Olsa
2016-07-12 10:00 ` [PATCH v15 10/12] perf tools: Enable overwrite settings Wang Nan
2016-07-12 10:00 ` [PATCH v15 11/12] perf tools: Don't warn about out of order event if write_backward is used Wang Nan
2016-07-12 10:00 ` [PATCH v15 12/12] perf tools: Add --tail-synthesize option Wang Nan

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=5786F1B1.40307@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=nilayvaish@gmail.com \
    --cc=pi3orama@163.com \
    /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.