mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org,
	namhyung@kernel.org, wangnan0@huawei.com, ak@linux.intel.com
Subject: Re: [PATCH 02/14] perf trace: Apply new perf_mmap__read_event() interface
Date: Mon, 5 Mar 2018 09:28:27 -0500	[thread overview]
Message-ID: <f31785d9-b12d-4826-d790-b41686135280@linux.intel.com> (raw)
In-Reply-To: <20180302233014.GA8970@krava>



On 3/2/2018 6:30 PM, Jiri Olsa wrote:
> On Thu, Mar 01, 2018 at 06:08:59PM -0500, kan.liang@linux.intel.com wrote:
>> From: Kan Liang <kan.liang@linux.intel.com>
>>
>> The perf trace still use the legacy interface.
>>
>> Apply the new perf_mmap__read_event() interface for perf trace.
>>
>> No functional change.
>>
>> Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
>> ---
>>   tools/perf/builtin-trace.c | 11 +++++++++--
>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
>> index e7f1b18..a46644f 100644
>> --- a/tools/perf/builtin-trace.c
>> +++ b/tools/perf/builtin-trace.c
>> @@ -2472,8 +2472,14 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
>>   
>>   	for (i = 0; i < evlist->nr_mmaps; i++) {
>>   		union perf_event *event;
>> +		struct perf_mmap *md;
>> +		u64 end, start;
>>   
>> -		while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) {
>> +		md = &evlist->mmap[i];
>> +		if (perf_mmap__read_init(md, 0, &start, &end) < 0)
>> +			continue;
> 
> should we break the loop if this returns -EINVAL?
>

It only means the ring buffer is broken for current mmaps.
For others, the data should still be good.
I don't think we should drop them by breaking the loop.

Also, the -EINVAL is only valid for overwrite mode. It is impossible to 
return -EINVAL in current code.

Thanks,
Kan

> jirka
> 
>> +
>> +		while ((event = perf_mmap__read_event(md, 0, &start, end)) != NULL) {
>>   			struct perf_sample sample;
>>   
>>   			++trace->nr_events;
>> @@ -2486,7 +2492,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
>>   
>>   			trace__handle_event(trace, event, &sample);
>>   next_event:
>> -			perf_evlist__mmap_consume(evlist, i);
>> +			perf_mmap__consume(md, 0);
>>   
>>   			if (interrupted)
>>   				goto out_disable;
>> @@ -2496,6 +2502,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
>>   				draining = true;
>>   			}
>>   		}
>> +		perf_mmap__read_done(md);
>>   	}
>>   
>>   	if (trace->nr_events == before) {
>> -- 
>> 2.4.11
>>

  reply	other threads:[~2018-03-05 14:28 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01 23:08 [PATCH 01/14] perf kvm: " kan.liang
2018-03-01 23:08 ` [PATCH 02/14] perf trace: " kan.liang
2018-03-02 23:30   ` Jiri Olsa
2018-03-05 14:28     ` Liang, Kan [this message]
2018-03-02 23:30   ` Jiri Olsa
2018-03-05 13:03     ` Arnaldo Carvalho de Melo
2018-03-05 13:46       ` Arnaldo Carvalho de Melo
2018-03-05 14:50         ` Liang, Kan
2018-03-05 15:04           ` Arnaldo Carvalho de Melo
2018-03-06  6:47   ` [tip:perf/core] perf trace: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 03/14] perf python: Apply " kan.liang
2018-03-06  6:47   ` [tip:perf/core] perf python: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 04/14] perf test: Apply new perf_mmap__read_event() interface for bpf kan.liang
2018-03-06  6:48   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 05/14] perf test: Apply new perf_mmap__read_event() interface for code reading kan.liang
2018-03-06  6:48   ` [tip:perf/core] perf test: Switch to new perf_mmap__read_event() interface for 'code reading' test tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 06/14] perf test: Apply new perf_mmap__read_event() interface for keep_tracking kan.liang
2018-03-06  6:49   ` [tip:perf/core] perf test: Switch to new perf_mmap__read_event() interface for "keep tracking" test tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 07/14] perf test: Apply new perf_mmap__read_event() interface for mmap-basic kan.liang
2018-03-06  6:49   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 08/14] perf test: Apply new perf_mmap__read_event() interface for tp fields kan.liang
2018-03-06  6:50   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 09/14] perf test: Apply new perf_mmap__read_event() interface for perf-record kan.liang
2018-03-06  6:50   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 10/14] perf test: Apply new perf_mmap__read_event() interface for time-to-tsc kan.liang
2018-03-06  6:51   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 11/14] perf test: Apply new perf_mmap__read_event() interface for sw-clock kan.liang
2018-03-06  6:51   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 12/14] perf test: Apply new perf_mmap__read_event() interface for switch-tracking kan.liang
2018-03-06  6:52   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 13/14] perf test: Apply new perf_mmap__read_event() interface for task-exit kan.liang
2018-03-06  6:52   ` [tip:perf/core] perf test: Switch to " tip-bot for Kan Liang
2018-03-01 23:09 ` [PATCH 14/14] perf tools: Discard legacy interfaces for mmap read forward kan.liang
2018-03-06  6:52   ` [tip:perf/core] perf mmap: " tip-bot for Kan Liang
2018-03-06  6:47 ` [tip:perf/core] perf kvm: Switch to new perf_mmap__read_event() interface tip-bot for Kan Liang

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=f31785d9-b12d-4826-d790-b41686135280@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®