From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755815Ab0EJXJ0 (ORCPT ); Mon, 10 May 2010 19:09:26 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:57103 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757476Ab0EJXJS (ORCPT ); Mon, 10 May 2010 19:09:18 -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=vaIHadbelY/2X8OWQ3tQwB60ztSoK/TR/IsAuU998WqGaI/D+vP52eG5nD38OXEGyb S73ZN0FprEoXz8hJMBj+kS3uGh8I7q2okrqNTdqc0+q092szuPsqPWn7rc/m6Zly8S1q fjuw984IcGkMhL1+XwxnnPCASxWvcX4qnB+Xk= Date: Tue, 11 May 2010 01:09:13 +0200 From: Frederic Weisbecker To: Peter Zijlstra Cc: Lin Ming , Ingo Molnar , "eranian@gmail.com" , "Gary.Mohr@Bull.com" , Corey Ashford , "arjan@linux.intel.com" , "Zhang, Yanmin" , Paul Mackerras , "David S. Miller" , Russell King , Paul Mundt , lkml Subject: Re: [RFC][PATCH 2/9] perf: core, remove hw_perf_event_init Message-ID: <20100510230911.GB5895@nowhere> References: <1273483595.15998.56.camel@minggr.sh.intel.com> <1273484430.5605.3334.camel@twins> <1273486670.15998.80.camel@minggr.sh.intel.com> <1273486769.5605.3343.camel@twins> <20100510122728.GB5563@nowhere> <1273496054.5605.3400.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1273496054.5605.3400.camel@twins> 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 Mon, May 10, 2010 at 02:54:14PM +0200, Peter Zijlstra wrote: > On Mon, 2010-05-10 at 14:27 +0200, Frederic Weisbecker wrote: > > On Mon, May 10, 2010 at 12:19:29PM +0200, Peter Zijlstra wrote: > > > On Mon, 2010-05-10 at 18:17 +0800, Lin Ming wrote: > > > > On Mon, 2010-05-10 at 17:40 +0800, Peter Zijlstra wrote: > > > > > On Mon, 2010-05-10 at 17:26 +0800, Lin Ming wrote: > > > > > > +static struct pmu *perf_event_lookup_pmu(struct perf_event *event) > > > > > > +{ > > > > > > + struct pmu *pmu; > > > > > > + int pmu_id = event->attr.pmu_id; > > > > > > + > > > > > > + list_for_each_entry(pmu, &pmus, entry) { > > > > > > + if (pmu->id == pmu_id) > > > > > > + return pmu; > > > > > > + } > > > > > > + > > > > > > + return NULL; > > > > > > +} > > > > > > > > > > > +void perf_event_register_pmu(struct pmu *pmu) > > > > > > +{ > > > > > > + pmu->id = pmu_id_curr++; > > > > > > + list_add_tail(&pmu->entry, &pmus); > > > > > > +} > > > > > > > > > > That will be wanting some sort of synchronization > > > > > > > > Will add a mutex to protect the list of pmus. > > > > > > I'm thinking RCU might be better suited, a mutex for lookup doesn't > > > sound ideal. > > > > > > Is it really needed? I expect this function to be called on boot > > only. > > > > In fact I would even suggest to tag it as __init. > > Loadable modules as well as PCI-Hotplug need supporting. Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug. Thanks.