public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Mike Galbraith <efault@gmx.de>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH] perf record: Delete file if a failure occurs writing the perf data file
Date: Tue, 12 Nov 2013 08:25:02 -0700	[thread overview]
Message-ID: <5282484E.9010206@gmail.com> (raw)
In-Reply-To: <20131112150410.GW5056@laptop.programming.kicks-ass.net>

On 11/12/13, 8:04 AM, Peter Zijlstra wrote:
> On Tue, Nov 12, 2013 at 07:51:16AM -0700, David Ahern wrote:
>>>  From man mmap:
>>>         SIGBUS Attempted access to a portion of the buffer that
>>>         does not correspond  to  the  file (for  example, beyond
>>>         the end of the file, ...
>
> SIGBUS is basically the std fail for any fault; there's a ton more
> reasons than listed in that manpage.
>
> Failing to dirty a page due to -ENOSPACE is one reason we'll
> trigger SIGBUS -- as you already found in that memcpy to mmap() instead
> of write() patch.

Sure. Lots of mmaps flying around, so to make sure we are on the same 
page in this case we are talking about perf-report reading a file via mmap.

If the file creation (be it memcpy to mmap() or write()) has a failure 
due to lack of space, then only a partial event is in the file -- e.g., 
perf-header only. Trying to read the rest of the event leads to 
perf-report terminating due to SIGBUS. How should that condition be handled?

The patch in this thread deletes the file. Another option is to rewind 
the file to the last known good write (ie., length after last successful 
call to write_output).

David


  reply	other threads:[~2013-11-12 15:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 16:41 [PATCH] perf record: Delete file if a failure occurs writing the perf data file David Ahern
2013-11-08 17:58 ` Jiri Olsa
2013-11-11  9:37 ` Ingo Molnar
2013-11-11 14:43   ` David Ahern
2013-11-12 14:51     ` David Ahern
2013-11-12 15:04       ` Peter Zijlstra
2013-11-12 15:25         ` David Ahern [this message]
2013-11-12 15:34           ` Peter Zijlstra
2013-11-20  4:39             ` David Ahern

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=5282484E.9010206@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox