linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] perf record: Propagate exit status of a command line workload
Date: Wed, 23 Apr 2014 16:40:21 +0200	[thread overview]
Message-ID: <CABPqkBS+7Khz=8Z5gb_veQVoovjPwNmUjqnQta=cRuHrcQmy9A@mail.gmail.com> (raw)
In-Reply-To: <1398263914.1696.7.camel@leonhard>

On Wed, Apr 23, 2014 at 4:38 PM, Namhyung Kim <namhyung@kernel.org> wrote:
> Hi Stephane,
>
> 2014-04-23 (수), 14:11 +0200, Stephane Eranian:
>> On Wed, Apr 23, 2014 at 8:40 AM, Namhyung Kim <namhyung@kernel.org> wrote:
>> > +out_child:
>> > +       if (forks) {
>> > +               int exit_status;
>> >
>> > -       return 0;
>> > +               if (!child_finished)
>> > +                       kill(rec->evlist->workload.pid, SIGTERM);
>> > +
>> > +               wait(&exit_status);
>> > +
>> > +               if (err < 0)
>> Not quite this. Although this works with my test case with 'false'.
>> It fails when I tried the opposite test case:
>>
>> $ perf record true && echo yes || echo no
>>   [ perf record: Woken up 1 times to write data ]
>>   [ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
>>   no
>>
>> The return code in this case is 255. I tracked it down to err being last set
>> by poll() which got interrupted by SIGCHLD. So I think the err value must
>> be overridden somehow in this case. Maybe something like:
>>
>>                         err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1);
>>                         if (err < 0 &&  errno == EINTR && forks && done)
>>                                 err = 0;
>
> Hmm.. just checking "err < 0 && errno == EINTR" isn't enough?
>
> And I guess the same problem can be occurred during record__mmap_read()
> as it calls record__write() which eventually calls ion() and it seems
> not to handle the above case..  I'll cook a patch for it too.
>
That's true.
Now, do we care about the return value of poll()?

> Thanks,
> Namhyung
>
>
>

      reply	other threads:[~2014-04-23 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23  6:40 [PATCH v2 1/2] perf record: Propagate exit status of a command line workload Namhyung Kim
2014-04-23  6:40 ` [PATCH v2 2/2] perf tools: Get rid of on_exit() feature test Namhyung Kim
2014-04-23 12:11 ` [PATCH v2 1/2] perf record: Propagate exit status of a command line workload Stephane Eranian
2014-04-23 14:38   ` Namhyung Kim
2014-04-23 14:40     ` Stephane Eranian [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='CABPqkBS+7Khz=8Z5gb_veQVoovjPwNmUjqnQta=cRuHrcQmy9A@mail.gmail.com' \
    --to=eranian@google.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).