public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: "Bayduraev, Alexey V" <alexey.v.bayduraev@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexander Antonov <alexander.antonov@linux.intel.com>,
	Alexei Budankov <abudankov@huawei.com>,
	Riccardo Mancini <rickyman7@gmail.com>
Subject: Re: [PATCH v3 6/8] perf session: Move event read code to separate function
Date: Fri, 8 Oct 2021 16:38:50 +0200	[thread overview]
Message-ID: <YWBX+p1vtLXXbpkF@krava> (raw)
In-Reply-To: <aa62d0ed-abca-2123-c8bf-cd6bced2fe9c@linux.intel.com>

On Fri, Oct 08, 2021 at 11:42:18AM +0300, Bayduraev, Alexey V wrote:
> 
> 
> On 08.10.2021 10:33, Jiri Olsa wrote:
> > On Thu, Oct 07, 2021 at 01:25:41PM +0300, Alexey Bayduraev wrote:
> > 
> > SNIP
> > 
> >>  static int
> >> -reader__process_events(struct reader *rd, struct perf_session *session,
> >> -		       struct ui_progress *prog)
> >> +reader__read_event(struct reader *rd, struct perf_session *session,
> >> +		   struct ui_progress *prog)
> >>  {
> >>  	u64 size;
> >>  	int err = 0;
> >>  	union perf_event *event;
> >>  	s64 skip;
> >>  
> >> -	err = reader__init(rd, &session->one_mmap);
> >> -	if (err)
> >> -		goto out;
> >> -
> >> -remap:
> >> -	err = reader__mmap(rd, session);
> >> -	if (err)
> >> -		goto out;
> >> -
> >> -more:
> >>  	event = fetch_mmaped_event(rd->head, rd->mmap_size, rd->mmap_cur,
> >>  				   session->header.needs_swap);
> >>  	if (IS_ERR(event))
> >>  		return PTR_ERR(event);
> >>  
> >>  	if (!event)
> >> -		goto remap;
> >> +		return 1;
> >>  
> >>  	session->active_decomp = &rd->decomp_data;
> >>  	size = event->header.size;
> >> @@ -2311,6 +2301,33 @@ reader__process_events(struct reader *rd, struct perf_session *session,
> >>  
> >>  	ui_progress__update(prog, size);
> >>  
> >> +out:
> >> +	session->active_decomp = &session->decomp_data;
> >> +	return err;
> >> +}
> >> +
> >> +static int
> >> +reader__process_events(struct reader *rd, struct perf_session *session,
> >> +		       struct ui_progress *prog)
> >> +{
> >> +	int err;
> >> +
> >> +	err = reader__init(rd, &session->one_mmap);
> >> +	if (err)
> >> +		goto out;
> >> +
> >> +remap:
> >> +	err = reader__mmap(rd, session);
> >> +	if (err)
> >> +		goto out;
> >> +
> >> +more:
> >> +	err = reader__read_event(rd, session, prog);
> >> +	if (err < 0)
> >> +		goto out;
> >> +	else if (err == 1)
> >> +		goto remap;
> >> +
> >>  	if (session_done())
> >>  		goto out;
> >>  
> >> @@ -2318,7 +2335,6 @@ reader__process_events(struct reader *rd, struct perf_session *session,
> >>  		goto more;
> >>  
> >>  out:
> >> -	session->active_decomp = &session->decomp_data;
> > 
> > active_decomp should be set/unset within reader__process_events,
> > not just for single event read, right?
> 
> No, it should be set before perf_session__process_event/process_decomp_events
> and unset after these calls. So active_decomp setting/unsetting is moved in
> this patch to the reader__read_event function. This is necessary for multiple
> trace reader because it could call reader__read_event in round-robin manner.

hum, is that code already in? I can't see this happening in current code

jirka

> 
> Regards,
> Alexey
> 
> > 
> > jirka
> > 
> >>  	return err;
> >>  }
> >>  
> >> -- 
> >> 2.19.0
> >>
> > 
> 


  reply	other threads:[~2021-10-08 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 10:25 [PATCH v3 0/5] perf session: Extend reader object to allow multiple readers Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 1/8] perf session: Move all state items to reader object Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 2/8] perf session: Introduce decompressor in " Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 3/8] perf session: Move init/release code to separate functions Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 4/8] perf session: Move map code to separate function Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 5/8] perf session: Move unmap code to reader__mmap Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 6/8] perf session: Move event read code to separate function Alexey Bayduraev
2021-10-08  7:33   ` Jiri Olsa
2021-10-08  8:42     ` Bayduraev, Alexey V
2021-10-08 14:38       ` Jiri Olsa [this message]
2021-10-11  9:08         ` Bayduraev, Alexey V
2021-10-11  9:53           ` Bayduraev, Alexey V
2021-10-11 13:21             ` Jiri Olsa
2021-10-11 16:40               ` Bayduraev, Alexey V
2021-10-11 19:56                 ` Jiri Olsa
2021-10-07 10:25 ` [PATCH v3 7/8] perf session: Introduce reader return codes Alexey Bayduraev
2021-10-07 10:25 ` [PATCH v3 8/8] perf session: Introduce reader EOF function Alexey Bayduraev

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=YWBX+p1vtLXXbpkF@krava \
    --to=jolsa@redhat.com \
    --cc=abudankov@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.antonov@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.v.bayduraev@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rickyman7@gmail.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