All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH 4/4] perf inject: Fix output from a file to a pipe
Date: Sun, 11 Jul 2021 17:44:04 +0200	[thread overview]
Message-ID: <YOsRxDnAgE7zNOVP@krava> (raw)
In-Reply-To: <20210707180536.72175-5-namhyung@kernel.org>

On Wed, Jul 07, 2021 at 11:05:36AM -0700, Namhyung Kim wrote:

SNIP

> +	if (!data.is_pipe && inject.output.is_pipe) {
> +		ret = perf_header__write_pipe(perf_data__fd(&inject.output));
> +		if (ret < 0) {
> +			pr_err("Couldn't write a new pipe header.\n");
> +			goto out_delete;
> +		}
> +
> +		ret = perf_event__synthesize_attrs(&inject.tool,
> +						   inject.session->evlist,
> +						   perf_event__repipe);
> +		if (ret < 0) {
> +			pr_err("Couldn't inject synthesized attrs.\n");
> +			goto out_delete;
> +		}
> +
> +		ret = perf_event__synthesize_features(&inject.tool,
> +						      inject.session,
> +						      inject.session->evlist,
> +						      perf_event__repipe);
> +		if (ret < 0) {
> +			pr_err("Couldn't inject synthesized features.\n");
> +			goto out_delete;
> +		}
> +
> +		if (have_tracepoints(&inject.session->evlist->core.entries)) {
> +			/*
> +			 * FIXME err <= 0 here actually means that
> +			 * there were no tracepoints so its not really
> +			 * an error, just that we don't need to
> +			 * synthesize anything.  We really have to
> +			 * return this more properly and also
> +			 * propagate errors that now are calling die()
> +			 */
> +			ret = perf_event__synthesize_tracing_data(&inject.tool,
> +						perf_data__fd(&inject.output),
> +						inject.session->evlist,
> +						perf_event__repipe);
> +			if (ret <= 0) {
> +				pr_err("Couldn't inject tracing data.\n");
> +				goto out_delete;
> +			}
> +		}
> +	}

hum.. how bad (too many args?) would be to put this to some function
in util/record.c, because it's copied directly from builtin-record.c

jirka

> +
>  	if (inject.build_ids && !inject.build_id_all) {
>  		/*
>  		 * to make sure the mmap records are ordered correctly
> -- 
> 2.32.0.93.g670b81a890-goog
> 


  reply	other threads:[~2021-07-11 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 18:05 [PATCHSET 0/4] perf inject: Fix broken data with mixed input/output Namhyung Kim
2021-07-07 18:05 ` [PATCH 1/4] perf tools: Remove repipe argument from perf_session__new() Namhyung Kim
2021-07-07 18:05 ` [PATCH 2/4] perf tools: Pass a fd to perf_file_header__read_pipe() Namhyung Kim
2021-07-07 18:05 ` [PATCH 3/4] perf inject: Fix output from a pipe to a file Namhyung Kim
2021-07-07 18:05 ` [PATCH 4/4] perf inject: Fix output from a file to a pipe Namhyung Kim
2021-07-11 15:44   ` Jiri Olsa [this message]
2021-07-13  7:35     ` Namhyung Kim

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=YOsRxDnAgE7zNOVP@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=irogers@google.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.