Re: [PATCH 1/1] perf tools: Add missing user space support forconfig1/config2

From: Ingo Molnar
Date: Tue Apr 26 2011 - 03:39:19 EST



* Vince Weaver <vweaver1@xxxxxxxxxxxx> wrote:

> On Mon, 25 Apr 2011, Ingo Molnar wrote:
>
> >
> > * Vince Weaver <vweaver1@xxxxxxxxxxxx> wrote:
> >
> > > [...] The kernel has no business telling users which perf events are
> > > interesting, or limiting them! [...]
> >
> > The policy is very simple and common-sense: if a given piece of PMU
> > functionality is useful enough to be exposed via a raw interface, then
> > it must be useful enough to be generalized as well.
>
> what does that even mean? How do you "generalize" a functionality like
> writing a value to an auxiliary MSR register?

Here are a few examples:

- the pure act of task switching sometimes involves writing to MSRs. How is it
generalized? The concept of 'processes/threads' is offered to user-space and
thus this functionality is generalized - the raw MSRs are not just passed
through to user-space.

- a wide range of VMX (virtualization) functionality on Intel CPUs operates via
writing special values to specific MSR registers. How is it 'generalized'? A
meaningful, structured ABI is provided to user-space in form of the KVM
device and associated semantics. The raw MSRs are not just passed through to
user-space.

- the ability of CPUs to change frequency is offered via writing special
values to special MSRs. How is this generalized? The cpufreq subsystem
offers a frequency/cpu API and associated abstractions - the raw MSRs are
not just passed through to user-space.

- in the context of perf events we generalize the concept of an 'event' and
we abstract out common, CPU model neutral CPU hardware concepts like
'cycles', 'instructions', 'branches' and a simplified cache hierarchy - and
offer those events as generic events to user-space. We do not just pass the
raw MSRs through to user-space.

- [ etc. - a lot of useful CPU functionality is MSR driven, the PMU is nothing
special there. ]

The kernel development process is in essence an abstraction engine, and if you
expect something else you'll probably be facing a lot of frustrating episodes
in the future as well where others try to abstract out meaningful
generalizations.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/