All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Zhang Yanmin <yanmin_zhang@linux.intel.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 4/5] perf: Introduce task, softirq and hardirq contexts exclusion
Date: Thu, 10 Jun 2010 13:01:27 +0200	[thread overview]
Message-ID: <1276167687.2077.120.camel@twins> (raw)
In-Reply-To: <1276141760-11590-5-git-send-regression-fweisbec@gmail.com>

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.

  reply	other threads:[~2010-06-10 11:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10  3:49 [PATCH 0/5] perf events finer grained context instrumentation / context exclusion Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 1/5] perf: Provide a proper stop action for software events Frederic Weisbecker
2010-06-10 10:46   ` Peter Zijlstra
2010-06-10 11:10     ` Peter Zijlstra
2010-06-10 16:12       ` Frederic Weisbecker
2010-06-10 16:16         ` Peter Zijlstra
2010-06-10 16:29           ` Frederic Weisbecker
2010-06-10 16:38             ` Peter Zijlstra
2010-06-10 17:04               ` Frederic Weisbecker
2010-06-10 19:54           ` Frederic Weisbecker
2010-06-10 12:06     ` Ingo Molnar
2010-06-10  3:49 ` [PATCH 2/5] perf: Support disable() after stop() on " Frederic Weisbecker
2010-06-10 10:50   ` Peter Zijlstra
2010-06-10 16:31     ` Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 3/5] perf: New PERF_EVENT_STATE_PAUSED event state Frederic Weisbecker
2010-06-10 10:55   ` Peter Zijlstra
2010-06-10 16:26     ` Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 4/5] perf: Introduce task, softirq and hardirq contexts exclusion Frederic Weisbecker
2010-06-10 11:01   ` Peter Zijlstra [this message]
2010-06-10 16:24     ` Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 5/5] perf: Support for task/softirq/hardirq exclusion on tools Frederic Weisbecker
2010-06-10  6:26 ` [PATCH 0/5] perf events finer grained context instrumentation / context exclusion Ingo Molnar
2010-06-10  7:15   ` Frederic Weisbecker
2010-06-10  7:31   ` Frederic Weisbecker
2010-06-10 10:16     ` Ingo Molnar
2010-06-10 17:03       ` Frederic Weisbecker
  -- strict thread matches above, loose matches on Subject: below --
2010-06-12  7:34 [PATCH 0/5 v3] " Frederic Weisbecker
2010-06-12  7:34 ` [PATCH 4/5] perf: Introduce task, softirq and hardirq contexts exclusion Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276167687.2077.120.camel@twins \
    --to=peterz@infradead.org \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.