public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH] perf stat: Do not show stats if workload fails
Date: Tue, 24 Dec 2013 09:53:42 -0300	[thread overview]
Message-ID: <20131224125342.GC17780@ghostprotocols.net> (raw)
In-Reply-To: <52B8D582.9090009@gmail.com>

Em Mon, Dec 23, 2013 at 07:29:54PM -0500, David Ahern escreveu:
> On 12/23/13, 2:37 PM, Arnaldo Carvalho de Melo wrote:
> >int perf_evlist__start_workload(struct perf_evlist *evlist)
> >{
> >         if (evlist->workload.cork_fd > 0) {
> >                 char bf = 0;
> >                 /* Remove the cork, let it rip! */
> >                 int ret = write(evlist->workload.cork_fd, &bf, 1);
> >                 if (ret < 0)
> >                         perror("enable to write to pipe");
> >
> >                 close(evlist->workload.cork_fd);
> >                 return ret;
> >         }
> >         return 0;
> >}

> >Ret there is 1, so we need to change it to:

> >		return ret != 1 ? -1 : 0;

> >Right?
 
> Yes, nice catch.

But this doesn't really matters, if one uses the more usual:

	if (function() < 0)

pattern for error checking, there would be no problem, and we would only
be checking that we told perf_evlist__prepare_workload()'s fork branch
to call execvp, not to check what happens then, i.e. if it finds the
specified workload in the system's PATH, if there are no permission of
file format problems, etc.

The thing to check is perf_evlist__{prepare,start}_workload notification
errors using SIGUSR1, that we need to check for in the caller, and emit
the message, no?

- Arnaldo

  reply	other threads:[~2013-12-24 12:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20  5:52 [PATCH] perf stat: Do not show stats if workload fails David Ahern
2013-12-20  7:57 ` Ingo Molnar
2013-12-23 19:37   ` Arnaldo Carvalho de Melo
2013-12-24  0:29     ` David Ahern
2013-12-24 12:53       ` Arnaldo Carvalho de Melo [this message]
2013-12-24 13:30         ` Arnaldo Carvalho de Melo
2013-12-26 14:11           ` David Ahern
2013-12-26 14:15             ` Arnaldo Carvalho de Melo
2013-12-26 14:18               ` David Ahern
2013-12-26 14:26                 ` Arnaldo Carvalho de Melo
2013-12-26 14:55                 ` Arnaldo Carvalho de Melo
2014-01-02 14:44             ` Arnaldo Carvalho de Melo

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=20131224125342.GC17780@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.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