mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
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: Tue, 13 Jul 2021 00:35:34 -0700	[thread overview]
Message-ID: <CAM9d7cjOsyn3ZRVYEP4fAjvK6AiAd-LagkYSeyH-R9fDmgW4gg@mail.gmail.com> (raw)
In-Reply-To: <YOsRxDnAgE7zNOVP@krava>

Hi Jiri,

On Sun, Jul 11, 2021 at 8:44 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> 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

I don't think they're too many.  Will try to factor it out.

Thanks,
Namhyung

      reply	other threads:[~2021-07-13  7:35 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
2021-07-13  7:35     ` Namhyung Kim [this message]

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=CAM9d7cjOsyn3ZRVYEP4fAjvK6AiAd-LagkYSeyH-R9fDmgW4gg@mail.gmail.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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 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®