Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757975Ab1COOgU (ORCPT ); Tue, 15 Mar 2011 10:36:20 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:35678 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757917Ab1COOgT convert rfc822-to-8bit (ORCPT ); Tue, 15 Mar 2011 10:36:19 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=WJRWEV+OxfFid4NaMoVb+7Q8sK6oFvFyIFHpS8esR+nxmoOQbt3si8ByLNK9ri8CYg 8/i97e1o7aHZcgZyLinRqlFg4+6UYXWlm/ijIvIBxtPYLuvf8EyaI8zVmW5F0k2s0Rhh yj+lzzkJM9/0QD2BY/mZ9fxYO1LOCpZREEvtk= MIME-Version: 1.0 In-Reply-To: <1300130283-10466-2-git-send-email-fweisbec@gmail.com> References: <1300130283-10466-1-git-send-email-fweisbec@gmail.com> <1300130283-10466-2-git-send-email-fweisbec@gmail.com> Date: Tue, 15 Mar 2011 22:36:18 +0800 Message-ID: Subject: Re: [RFC PATCH 1/4] perf: Starter and stopper events From: Lin Ming To: Frederic Weisbecker Cc: LKML , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , Paul Mackerras , Stephane Eranian , Steven Rostedt , Masami Hiramatsu , Thomas Gleixner , Hitoshi Mitake Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1772 Lines: 50 On Tue, Mar 15, 2011 at 3:18 AM, Frederic Weisbecker 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/