Re: [RFC] x86, perf: Add an aperfmperf driver

2015-05-11 Thread Ingo Molnar
* Andy Lutomirski wrote: > + event->hw.idx = -1; > + event->hw.event_base = (event->attr.config == APERFMPERF_EVENT_APERF ? > + MSR_IA32_APERF : MSR_IA32_MPERF); So instead of having a separate driver per MSR, I think it might be more useful to have a generi

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-30 Thread Andy Lutomirski
On Thu, Apr 30, 2015 at 1:51 AM, Peter Zijlstra wrote: > On Wed, Apr 29, 2015 at 06:17:05PM -0700, Andy Lutomirski wrote: >> >> > + /* no sampling */ >> >> > + if (event->hw.sample_period) >> >> > + return -EINVAL; >> >> >> >> You could have set pmu::capabilities = >> >> PERF_P

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-30 Thread Peter Zijlstra
On Wed, Apr 29, 2015 at 06:17:05PM -0700, Andy Lutomirski wrote: > >> > + /* no sampling */ > >> > + if (event->hw.sample_period) > >> > + return -EINVAL; > >> > >> You could have set pmu::capabilities = > >> PERF_PMU_CAP_NO_INTERRUPT which would also have killed that dead. > >

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-29 Thread Andy Lutomirski
On Wed, Apr 29, 2015 at 11:50 AM, Andy Lutomirski wrote: > On Apr 29, 2015 2:09 AM, "Peter Zijlstra" wrote: >> >> On Tue, Apr 28, 2015 at 02:25:37PM -0700, Andy Lutomirski wrote: >> > diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile >> > index 80091ae54c2b..fadc822efc90 10

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-29 Thread Andy Lutomirski
On Apr 29, 2015 2:09 AM, "Peter Zijlstra" wrote: > > On Tue, Apr 28, 2015 at 02:25:37PM -0700, Andy Lutomirski wrote: > > diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile > > index 80091ae54c2b..fadc822efc90 100644 > > --- a/arch/x86/kernel/cpu/Makefile > > +++ b/arch/x86/k

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-29 Thread Peter Zijlstra
On Tue, Apr 28, 2015 at 02:25:37PM -0700, Andy Lutomirski wrote: > +static struct pmu pmu_aperfmperf = { > +.task_ctx_nr= perf_invalid_context, You could actually have made that perf_sw_context, because its impossible to fail to add() this event. That will make it possible to attach i

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-29 Thread Peter Zijlstra
On Tue, Apr 28, 2015 at 03:43:38PM -0700, Andy Lutomirski wrote: > On Tue, Apr 28, 2015 at 3:29 PM, Brown, Len wrote: > >> Thoughts? Would it make sense at all? Did I wire it up right? This is > >> the only PMU driver I've ever written, and it could have any number of > >> issues. > > > > APER

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-29 Thread Peter Zijlstra
On Tue, Apr 28, 2015 at 02:25:37PM -0700, Andy Lutomirski wrote: > diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile > index 80091ae54c2b..fadc822efc90 100644 > --- a/arch/x86/kernel/cpu/Makefile > +++ b/arch/x86/kernel/cpu/Makefile > @@ -45,6 +45,8 @@ obj-$(CONFIG_PERF_EVENT

Re: [RFC] x86, perf: Add an aperfmperf driver

2015-04-28 Thread Andy Lutomirski
On Tue, Apr 28, 2015 at 3:29 PM, Brown, Len wrote: >> I think that turbostat could do some of its work without being >> root if we had a driver like this. > > Note that turbostat can be run as non-root this way: > > # setcap cap_sys_rawio=ep ./turbostat > # chmod +r /dev/cpu/*/msr > > For the debu

RE: [RFC] x86, perf: Add an aperfmperf driver

2015-04-28 Thread Brown, Len
> I think that turbostat could do some of its work without being > root if we had a driver like this. Note that turbostat can be run as non-root this way: # setcap cap_sys_rawio=ep ./turbostat # chmod +r /dev/cpu/*/msr For the debug case, there are a number of MSRs that turbostat must access, so

[RFC] x86, perf: Add an aperfmperf driver

2015-04-28 Thread Andy Lutomirski
Signed-off-by: Andy Lutomirski --- This driver seems a little bit silly, but I can imagine it being useful. For example, I think that turbostat could do some of its work without being root if we had a driver like this. Thoughts? Would it make sense at all? Did I wire it up right? This is the