From: "Wangnan (F)" <wangnan0@huawei.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: <acme@kernel.org>, <linux-kernel@vger.kernel.org>,
<pi3orama@163.com>, <lizefan@huawei.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 v13 2/8] perf evlist: Introduce aux evlist
Date: Mon, 11 Jul 2016 18:20:31 +0800 [thread overview]
Message-ID: <578372EF.6060902@huawei.com> (raw)
In-Reply-To: <20160708144654.GA31763@krava>
On 2016/7/8 22:46, Jiri Olsa wrote:
> On Wed, Jul 06, 2016 at 08:16:52PM +0800, Wangnan (F) wrote:
>>
>> On 2016/7/6 19:36, Jiri Olsa wrote:
>>> On Mon, Jul 04, 2016 at 06:20:03AM +0000, Wang Nan wrote:
>>>
>>> SNIP
>>>
>>>> +struct perf_evlist *perf_evlist__new_aux(struct perf_evlist *parent)
>>>> +{
>>>> + struct perf_evlist *evlist;
>>>> +
>>>> + if (perf_evlist__is_aux(parent)) {
>>>> + pr_err("Internal error: create aux evlist from another aux evlist\n");
>>>> + return NULL;
>>>> + }
>>>> +
>>>> + evlist = zalloc(sizeof(*evlist));
>>>> + if (!evlist)
>>>> + return NULL;
>>>> +
>>>> + perf_evlist__init(evlist, parent->cpus, parent->threads);
>>>> + evlist->parent = parent;
>>>> + INIT_LIST_HEAD(&evlist->list);
>>>> + list_add(&evlist->list, &parent->children);
>>> I understand there's some reason for separating maps with and
>>> without overwrite set, but I'm missing it.. why is that?
>> You are asking overwrite, not write_backward?
>>
>> Overwrite mapping needs to be mapped without PROT_WRITE, so its
>> control page is also read only, so perf_evlist__mmap_consume() is
>> not able to use, and there's no way to tell kernel to where we have
>> read. Kernel overwrite old records when its full. Compare with normal
>> mapping: perf uses perf_evlist__mmap_consume() to tell kernel the
>> last byte it has read, so kernel stop writing data to it when it full,
>> and issues LOST event. This is the reason we need to separate maps
>> with and without overwrite set.
>>
>> For write backward: kernel write data in different direction, so
>> requires map separation.
> I dont like the idea of duplicating whole perf_evlist
> in order just to map some events with overwrite/backward
>
> perf_evlist carries all the other info about events,
> not just memory maping..
>
> I think it'd be better to do it some other way, like:
>
> - we have mmaps for events/evsels, so you're able to map
> it differently with or without PROT_WRITE even in current
> design.. there's struct perf_mmap that can carry that info
> then it's the matter of reading/processing those maps
> that needs to change.. new perf_evlist interface
>
> - we could keep separate struct perf_mmap arrays for forward
> and backward/overwrite maps
>
> - ...
>
> I understand both mapping need different treatment,
> but I think that should be encapsulated within the
> struct perf_evlist interface
I don't like it either, but aux_evlist is the easiest way to
do this work. Other potential solutions require heavy API changes.
Thank you.
next prev parent reply other threads:[~2016-07-11 10:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 6:20 [PATCH v13 0/8] perf tools: Support overwritable ring buffer Wang Nan
2016-07-04 6:20 ` [PATCH v13 1/8] perf tools: Drop redundant evsel->overwrite indicator Wang Nan
2016-07-06 10:53 ` Jiri Olsa
2016-07-06 10:55 ` Wangnan (F)
2016-07-04 6:20 ` [PATCH v13 2/8] perf evlist: Introduce aux evlist Wang Nan
2016-07-06 11:36 ` Jiri Olsa
2016-07-06 12:16 ` Wangnan (F)
2016-07-08 14:46 ` Jiri Olsa
2016-07-11 10:20 ` Wangnan (F) [this message]
2016-07-04 6:20 ` [PATCH v13 3/8] perf tests: Add testcase for auxiliary evlist Wang Nan
2016-07-04 6:20 ` [PATCH v13 4/8] perf record: Introduce rec->overwrite_evlist for overwritable events Wang Nan
2016-07-04 6:20 ` [PATCH v13 5/8] perf record: Read from overwritable ring buffer Wang Nan
2016-07-06 11:37 ` Jiri Olsa
2016-07-06 11:38 ` Jiri Olsa
2016-07-06 12:03 ` Wangnan (F)
2016-07-06 12:34 ` Jiri Olsa
2016-07-07 4:59 ` Wangnan (F)
2016-07-04 6:20 ` [PATCH v13 6/8] perf tools: Enable overwrite settings Wang Nan
2016-07-04 6:20 ` [PATCH v13 7/8] perf tools: Don't warn about out of order event if write_backward is used Wang Nan
2016-07-04 6:20 ` [PATCH v13 8/8] 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=578372EF.6060902@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--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.