lkml.org 
[lkml]   [2012]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] perf: SNB exclusive PMU access for INST_RETIRED:PREC_DIST

* Andi Kleen <ak@linux.intel.com> wrote:

> > > > This isn't limited to admin, right? So the above turns into a DoS on the
> > > > console.
> > > >
> > > Ok, so how about a WARN_ON_ONCE() instead?
> >
> > That should be fine I guess ;-)
>
> imho there is need for a generic mechanism to return an error
> string to the user program without such hacks.

Agreed - we could return an 'extended errno' long error return
value, which in reality is a pointer to an error string (in
perf_attr::error_str), and copy that string to user-space at
perf syscall return time.

Thus error-string aware tooling could print the error string.

So PMU drivers could do something obvious like:

return (long)"perf: INST_RETIRED.PREC_DIST only works in exclusive mode";

The perf syscall notices these pointers by noticing that the
error code returned is outside the errno range.

Old userspace will get a -EINVAL and no string copied into the
error string buffer.

New userspace would get the error string copied into
perf_attr::error_str, plus a 'normal' -EINVAL error code.

The only cost on the kernel side is to make sure all "string
errors" are returned as long.

Thanks,

Ingo


\
 
 \ /
  Last update: 2012-10-21 19:21    [W:0.062 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site