From: Ingo Molnar <mingo@kernel.org>
To: Stephane Eranian <eranian@google.com>
Cc: Matt Fleming <matt@console-pimps.org>,
Peter Zijlstra <peterz@infradead.org>,
Vince Weaver <vince@deater.net>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Jiri Olsa <jolsa@redhat.com>,
Andy Lutomirski <luto@amacapital.net>,
Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFD] perf syscall error handling
Date: Mon, 10 Nov 2014 11:38:34 +0100 [thread overview]
Message-ID: <20141110103834.GB19309@gmail.com> (raw)
In-Reply-To: <CABPqkBS0gKWyTc=TFpGxRwOQkAe1o5zXtWaUyHezpO53LhCqrQ@mail.gmail.com>
* Stephane Eranian <eranian@google.com> wrote:
> Hi,
>
> On Fri, Oct 31, 2014 at 1:28 PM, Matt Fleming <matt@console-pimps.org> wrote:
> > On Fri, 31 Oct, at 10:27:13AM, Ingo Molnar wrote:
> >>
> >> - user-space gets back the regular errno (-EOPNOTSUPP or -ENOSYS
> >> or -EINVAL, etc.) and a string. Strings are really the most
> >> helpful information, because tools can just print that. They
> >> can also match on specific strings and programmatically react
> >> to them if they want to: we can promise to not arbitrarily
> >> change error strings once they are introduced. (but even if
> >> they change, user-space can still print them out.)
> >
> > I guess we'd run into a problem if userspace doesn't want to just print
> > the kernel string but instead wants to parse it in some fashion.
> >
> > That may or may not be a problem in practice, Vince can probably comment
> > on that. I'm just thinking along the lines of making the perf syscall
> > interface as useful as possible for tools other than tools/perf.
>
> Maybe I missed something in the earlier thread, but I am trying
> to understand why perf_event_open() would need such extended
> error retrieval system when no other syscall does.
Frankly, Linux kind of sucks in the 'error codes and diagnostics'
area, as we used the old Unix method of returning a single small
integer and never got around further organizing errors properly,
for a couple of good (and a handful of bad) reasons.
The good reasons: not having finegrained error codes is just fine
if you organize your APIs and objects via other means: file
system structure, split-up system calls, separate fds for
separate objects, etc.
The perf ABI is complex mostly because it provides bleeding edge
interfaces to bleeding edge hardware, while trying to be
transparent to the probed processes: i.e. no 'everything is a
file' and 'just use poll() to pass events' API simplifications
are possible, mostly for performance reasons.
A comparable ABI, ptrace, is considered complex as well, while
perf is much faster, exposes much more hardware capabilities and
is more capable as well.
But even outside of perf, with 'other' system calls I have
experienced dozens of incidents where some app failed with a
-EINVAL in an ambiguous way and it would have been a blessing to
get more extended error description from the kernel. There's a
few meaningful error codes like -EIO or -ENOMEM, but there's tons
of overlapping use of -EINVAL.
The VFS and VM error codes are pretty much self explanatory (and
that's where we have most of Unix heritage), but for example the
networking code and various drivers and also perf suffers from
not giving finegrained enough error explanations.
> In any case, I would go with Ingo's proposal.
Ok, cool!
Thanks,
Ingo
next prev parent reply other threads:[~2014-11-10 10:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 22:28 [RFD] perf syscall error handling Peter Zijlstra
2014-10-31 1:16 ` Vince Weaver
2014-10-31 7:21 ` Peter Zijlstra
2014-10-31 9:27 ` Ingo Molnar
2014-10-31 12:28 ` Matt Fleming
2014-10-31 21:22 ` Stephane Eranian
2014-11-01 5:30 ` Vince Weaver
2014-11-03 16:25 ` Arnaldo Carvalho de Melo
2014-11-03 16:50 ` Peter Zijlstra
2014-11-03 17:00 ` Arnaldo Carvalho de Melo
2014-11-03 17:12 ` Vince Weaver
2014-11-03 17:39 ` Peter Zijlstra
2014-11-10 10:27 ` Ingo Molnar
2014-11-10 12:15 ` Arnaldo Carvalho de Melo
2014-11-10 12:24 ` Ingo Molnar
2014-11-10 13:54 ` Arnaldo Carvalho de Melo
2014-11-10 14:14 ` David Ahern
2014-11-10 14:47 ` Ingo Molnar
2014-11-10 10:38 ` Ingo Molnar [this message]
2014-10-31 10:00 ` 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=20141110103834.GB19309@gmail.com \
--to=mingo@kernel.org \
--cc=acme@infradead.org \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=matt@console-pimps.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vince@deater.net \
/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).