Subject: [PATCH 4/6] perf-events: export enable/disable event symbols to kernel modules

From: [email-masked] (Will Deacon)
Date: Fri, 26 Feb 2010 09:53:27 -0000

Hi Ingo,

Thanks for the quick response.

> * Will Deacon <[email-masked]> wrote:
> 
> > The perf_event_enable and perf_event_disable functions are used to
> > control the activation of perf-events for a given context or CPU.
> >
> > This patch exports these symbols so that they can be used by kernel
> > modules. Without these symbols, an event must be destroyed and recreated
> > to disable or enable it respectively. The maximum number of perf-events
> > is also made available to modules via the perf_get_max_events function.
> >
> 
> Hm, what modules would like to use them, and in what fashion?
> 

The module I had in mind was OProfile [currently just the ARM port, but
perhaps other architectures may decide to do this too]. The patch I posted
here:

http://lists.infradead.org/pipermail/linux-arm-kernel/2010-February/010479.html

removes the PMU control code from OProfile and replaces it with calls to perf.
This means that when OProfile starts or stops a profiling session, the
corresponding events are enabled or disabled respectively.

If you want to compile OProfile as a module, then the enable/disable functions
will need to be exported. I suppose the other solution is to prevent OProfile
from being compiled as a module.

Thanks,

Will