From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757199Ab0ERSjN (ORCPT ); Tue, 18 May 2010 14:39:13 -0400 Received: from fg-out-1718.google.com ([72.14.220.155]:15010 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756536Ab0ERSjL (ORCPT ); Tue, 18 May 2010 14:39:11 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=iyCOmTvrPPgz9JCHuPqr5TRfaWonnYZjPXnl/RNPsGr75eHoJv8IB/SdnWE4mC+MN1 PUJ3XudWyqSh0ADT7Rs8BGDii3AaC8Af/cSeA2b9az8QrWS3RrTrSJ6tEmT+spL/ccUa bSqeSQXvIkcNwMkt3v1749BOCNPaB1CKdLeRQ= Date: Tue, 18 May 2010 22:38:58 +0400 From: Cyrill Gorcunov To: Lin Ming Cc: Peter Zijlstra , Ingo Molnar , Corey Ashford , Frederic Weisbecker , Paul Mundt , "eranian@gmail.com" , "Gary.Mohr@Bull.com" , "arjan@linux.intel.com" , "Zhang, Yanmin" , Paul Mackerras , "David S. Miller" , Russell King , Arnaldo Carvalho de Melo , Will Deacon , Maynard Johnson , Carl Love , "greg@kroah.com" , Kay Sievers , lkml Subject: Re: [RFC][PATCH v2 02/11] perf: core, add pmu register and lookup functions Message-ID: <20100518183858.GE5081@lenovo> References: <1274233502.3036.80.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1274233502.3036.80.camel@localhost> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 19, 2010 at 01:45:02AM +0000, Lin Ming wrote: ... > +int perf_event_register_pmu(struct pmu *pmu) > +{ > + struct pmu *tmp; > + int ret = 1; > + > + rcu_read_lock(); > + list_for_each_entry_rcu(tmp, &pmus, entry) { > + if (tmp->id == pmu->id) { > + ret = 0; > + goto err; Hi Ming, is it supposed to get out in locked state? I mean imbalanced rcu_read_lock somehow suspicicous ;) > + } > + } > + rcu_read_unlock(); > + > + spin_lock(&pmus_lock); > + list_add_tail_rcu(&pmu->entry, &pmus); > + spin_unlock(&pmus_lock); > + > +err: > + return ret; > +} > + ... -- Cyrill