lkml.org 
[lkml]   [2010]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/5] perf: New PERF_EVENT_STATE_PAUSED event state
From
Date
On Thu, 2010-06-10 at 05:49 +0200, Frederic Weisbecker wrote:
> This brings a new PERF_EVENT_STATE_PAUSED state. It means the events
> is enabled but we don't want it to run, it must be in the same state
> than after a pmu->stop() call. So the event has been reserved and
> allocated and it is ready to start after a pmu->start() call.
>
> It is deemed for hardware events when we want them to be reserved on
> the cpu and ready to be started anytime. This is going to be useful
> for the new context exclusion that will follow.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Zhang Yanmin <yanmin_zhang@linux.intel.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> ---
> arch/x86/kernel/cpu/perf_event.c | 6 ++++--
> include/linux/perf_event.h | 3 ++-
> kernel/perf_event.c | 7 ++++---
> 3 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index f2da20f..9b0e52f 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -839,7 +839,8 @@ void hw_perf_enable(void)
> match_prev_assignment(hwc, cpuc, i))
> continue;
>
> - x86_pmu_stop(event);
> + if (event->state != PERF_EVENT_STATE_PAUSED)
> + x86_pmu_stop(event);
> }
>
> for (i = 0; i < cpuc->n_events; i++) {
> @@ -851,7 +852,8 @@ void hw_perf_enable(void)
> else if (i < n_running)
> continue;
>
> - x86_pmu_start(event);
> + if (event->state != PERF_EVENT_STATE_PAUSED)
> + x86_pmu_start(event);
> }
> cpuc->n_added = 0;
> perf_events_lapic_init();

Shouldn't that latter be == PAUSED?

Also, you'll have to audit all struct pmu implementations that
stop/disable or disable/disable is good.

Also, I'd rather keep the whole event->state knowledge in the generic
code.


\
 
 \ /
  Last update: 2010-06-10 12:57    [W:0.107 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site