Re: [PATCH v2 0/6] perf: Introduce extended syscall error reporting

Arnaldo Carvalho de Melo
2015-08-26T21:05:36Z

Em Wed, Aug 26, 2015 at 11:41:11AM -0700, Andrew Morton escreveu:
> On Wed, 26 Aug 2015 09:26:56 +0200 Ingo Molnar <mingo@kernel.org> wrote:
> > * Ingo Molnar <mingo@kernel.org> wrote:
> >
> > > ... but back then I didn't feel like complicating an error recovery ABI for the
> > > needs of the 1%, robust error handling is all about simplicity: if it's not
> > > simple, tools won't use it.
> >
> > And note that it needs to be 'simple' in two places for usage to grow naturally:
> >
> > - the usage site in the kernel
> > - the tooling side that recovers the information.
> >
> > That's why I think that such a form:
> >
> > return err_str(-EINVAL, "x86/perf: CPU does not support precise sampling");
> >
> > is obviously simple on the kernel side as it returns -EINVAL, and is very simple
> > on the tooling side as well, if we are allowed to extend prctl().
>
> Is this whole thing overkill? As far as I can see, the problem which is
> being addressed only occurs in a couple of places (perf, wifi netlink
> handling) and could be addressed with some local pr_debug statements. ie,
>
> #define err_str(e, s) ({
> if (debugging)
> pr_debug("%s:%d: error %d (%s)", __FILE__, __LINE__, e, s);
> e;
> })
>
> (And I suppose that if this is later deemed inadequate, err_str() could
> be made more fancy).
>
> IOW, do we really need some grand kernel-wide infrastructural thing to
> adequately address this problem?

For perf tooling we already ask the user to look at dmesg sometimes, but
that is very ugly and fragile, for instance multiple users ask for some
complex combination of features (look at the ones already marked by
Alexander), and there are tons of combos possible.

Mapping back from -EINVAL or -ENOTSUPP to some sensible message that
helps the user to make sense of _what_ is the problem is difficult for
developers, let alone for users.

I'd say lets try this with perf and leave the rest of the world alone,
if the experience proves fruitful, it will be left as an example for
others, hopefully a good one :-)

- Arnaldo