lkml.org 
[lkml]   [2011]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC PATCH 1/4] perf: Starter and stopper events
From
On Tue, Mar 15, 2011 at 3:18 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:

>
> +static void perf_event_pause_resume(struct perf_event *event, int nmi,
> +                                   struct perf_sample_data *data,
> +                                   struct pt_regs *regs)
> +{
> +       struct perf_event *iter;
> +       unsigned long flags;
> +
> +       /*
> +        * Ensure the targets can't be sched in/out concurrently.
> +        * Disabling irqs is sufficient for that because starters/stoppers
> +        * are on the same cpu/task.
> +        */
> +       local_irq_save(flags);

Could you explain this more detail?

> +
> +
> +       /* Prevent the targets from being removed under us. */
> +       rcu_read_lock();
> +
> +       list_for_each_entry_rcu(iter, &event->starter_list, starter_entry) {
> +               /*
> +                * There is a small race window here, between the state
> +                * gets set to active and the event is actually ->add().
> +                * We need to find a way to ensure the starter/stopper
> +                * can't trigger in between.

Can we set the state to active after the event is actually ->add()?

> +                */
> +               if (iter->state == PERF_EVENT_STATE_ACTIVE) {
> +                       if (iter->paused) {
> +                               iter->pmu->start(iter, PERF_EF_RELOAD);
> +                               iter->paused = 0;
> +                       }
> +               }
> +       }
> +

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

\
 
 \ /
  Last update: 2011-03-15 15:39    [W:0.139 / U:2.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site