[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1276167687.2077.120.camel@twins>
Date: Thu, 10 Jun 2010 13:01:27 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Stephane Eranian <eranian@...gle.com>,
Cyrill Gorcunov <gorcunov@...il.com>,
Zhang Yanmin <yanmin_zhang@...ux.intel.com>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 4/5] perf: Introduce task, softirq and hardirq contexts
exclusion
On Thu, 2010-06-10 at 05:49 +0200, Frederic Weisbecker wrote:
> @@ -642,17 +643,31 @@ event_sched_in(struct perf_event *event,
> if (event->state <= PERF_EVENT_STATE_OFF)
> return 0;
>
> - event->state = PERF_EVENT_STATE_ACTIVE;
> + if (event->attr.exclude_task)
> + event->state = PERF_EVENT_STATE_PAUSED;
> + else
> + event->state = PERF_EVENT_STATE_ACTIVE;
> +
> event->oncpu = smp_processor_id();
> +
Aah, so that is why you added the PAUSE state knowledge to the arch
code, you want to be able to call ->enable() on a PAUSEd event.
That means you need to audit/touch all implementations anyway, isn't
there a better interface we can use, like maybe extend ->enable() with a
flags argument?
> /*
> * The new state must be visible before we turn it on in the hardware:
> */
> smp_wmb();
>
> - if (event->pmu->enable(event)) {
> - event->state = PERF_EVENT_STATE_INACTIVE;
> - event->oncpu = -1;
> - return -EAGAIN;
> + /*
> + * If we exclude the tasks, we only need to schedule hardware
> + * events that need to settle themselves, even in a pause mode.
> + * Software events can simply be scheduled anytime.
> + * If we want more granularity in all that, we can still provide
> + * later a pmu->reserve callback.
> + */
> + if (!event->attr.exclude_task || !is_software_event(event)) {
> + if (event->pmu->enable(event)) {
> + event->state = PERF_EVENT_STATE_INACTIVE;
> + event->oncpu = -1;
> + return -EAGAIN;
> + }
> }
>
> event->tstamp_running += ctx->time - event->tstamp_stopped;
Remove is_software_event(), not add more.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists