All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v11 2/3]: perf record: enable asynchronous trace writing
Date: Mon, 8 Oct 2018 12:52:54 +0200	[thread overview]
Message-ID: <20181008105254.GG17270@krava> (raw)
In-Reply-To: <31b0ae5f-e1b5-4255-11af-46c8ebe8e2be@linux.intel.com>

On Mon, Oct 08, 2018 at 09:17:11AM +0300, Alexey Budankov wrote:

SNIP

>  static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist,
>  				    bool overwrite)
>  {
> @@ -520,7 +644,10 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
>  	int i;
>  	int rc = 0;
>  	struct perf_mmap *maps;
> -
> +#ifdef HAVE_AIO_SUPPORT
> +	int trace_fd = rec->data.file.fd;
> +	off_t off;
> +#endif
>  	if (!evlist)
>  		return 0;
>  
> @@ -531,14 +658,34 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
>  	if (overwrite && evlist->bkw_mmap_state != BKW_MMAP_DATA_PENDING)
>  		return 0;
>  
> +#ifdef HAVE_AIO_SUPPORT
> +	off = lseek(trace_fd, 0, SEEK_CUR);
> +#endif

I'm still little puzzled why we need to do this,
when the aio write takes the offset value, but
please provide some aio_.. function for this


>  	for (i = 0; i < evlist->nr_mmaps; i++) {
>  		struct perf_mmap *map = &maps[i];
>  
>  		if (map->base) {
> -			if (perf_mmap__push(map, rec, record__pushfn) != 0) {
> -				rc = -1;
> -				goto out;
> +#ifdef HAVE_AIO_SUPPORT
> +			if (!rec->opts.nr_cblocks) {
> +#endif
> +				if (perf_mmap__push(map, rec, record__pushfn) != 0) {
> +					rc = -1;
> +					goto out;
> +				}
> +#ifdef HAVE_AIO_SUPPORT
> +			} else {
> +				/*
> +				 * Call record__aio_sync() to wait till map->data buffer
> +				 * becomes available after previous aio write request.
> +				 */
> +				record__aio_sync(map);
> +				if (perf_mmap__aio_push(map, rec, record__aio_pushfn, &off) != 0) {
> +					lseek(trace_fd, off, SEEK_SET);
> +					rc = -1;
> +					goto out;
> +				}
>  			}
> +#endif
>  		}
>  
>  		if (map->auxtrace_mmap.base && !rec->opts.auxtrace_snapshot_mode &&
> @@ -547,7 +694,9 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
>  			goto out;
>  		}
>  	}
> -
> +#ifdef HAVE_AIO_SUPPORT
> +	lseek(trace_fd, off, SEEK_SET);
> +#endif

ditto

thanks,
jirka

  parent reply	other threads:[~2018-10-08 10:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08  5:55 [PATCH v11 0/3]: perf: reduce data loss when profiling highly parallel CPU bound workloads Alexey Budankov
2018-10-08  6:14 ` [PATCH v11 1/3]: perf util: map data buffer for preserving collected data Alexey Budankov
2018-10-08 10:50   ` Jiri Olsa
2018-10-08 11:55     ` Alexey Budankov
2018-10-08 12:37       ` Jiri Olsa
2018-10-08 10:50   ` Jiri Olsa
2018-10-08 12:03     ` Alexey Budankov
2018-10-08 12:38       ` Jiri Olsa
2018-10-08 14:43         ` Alexey Budankov
2018-10-08 15:12           ` Jiri Olsa
2018-10-08 15:38             ` Alexey Budankov
2018-10-08 10:51   ` Jiri Olsa
2018-10-08 12:05     ` Alexey Budankov
2018-10-08  6:17 ` [PATCH v11 2/3]: perf record: enable asynchronous trace writing Alexey Budankov
2018-10-08 10:50   ` Jiri Olsa
2018-10-08 12:17     ` Alexey Budankov
2018-10-08 10:51   ` Jiri Olsa
2018-10-08 12:19     ` Alexey Budankov
2018-10-08 10:52   ` Jiri Olsa [this message]
2018-10-08 12:24     ` Alexey Budankov
2018-10-08 12:53       ` Jiri Olsa
2018-10-08 14:42         ` Alexey Budankov
2018-10-08 15:11           ` Jiri Olsa
2018-10-08 15:39             ` Alexey Budankov
2018-10-08 10:57   ` Jiri Olsa
2018-10-08 12:15     ` Alexey Budankov
2018-10-08 10:58   ` Jiri Olsa
2018-10-08 12:26     ` Alexey Budankov
2018-10-08  6:19 ` [PATCH v11 3/3]: perf record: extend trace writing to multi AIO Alexey Budankov
2018-10-08 10:55   ` Jiri Olsa
2018-10-08 11:47     ` Alexey Budankov
2018-10-08 12:45       ` Jiri Olsa
2018-10-08 15:21         ` Alexey Budankov

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=20181008105254.GG17270@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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.