Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932343AbbFIOZZ (ORCPT ); Tue, 9 Jun 2015 10:25:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48533 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbbFIOZT (ORCPT ); Tue, 9 Jun 2015 10:25:19 -0400 Date: Tue, 9 Jun 2015 11:25:15 -0300 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: namhyung@kernel.org, adrian.hunter@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, dsahern@gmail.com, jolsa@redhat.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:perf/core] perf tools: Protect accesses the dso rbtrees/ lists with a rw lock Message-ID: <20150609142515.GD2195@redhat.com> References: <20150609095610.GA18359@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150609095610.GA18359@gmail.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1134 Lines: 31 Em Tue, Jun 09, 2015 at 11:56:10AM +0200, Ingo Molnar escreveu: > * tip-bot for Arnaldo Carvalho de Melo wrote: > > +void dsos__add(struct dsos *dsos, struct dso *dso) > > +{ > > + pthread_rwlock_wrlock(&dsos->lock); > > + __dsos__add(dsos, dso); > > + pthread_rwlock_unlock(&dsos->lock); > > } > > Please introduce wrappers and use the kernel API names: > read_lock()/read_unlock()/etc. (and name the mutex primitives > mutex_lock()/unlock()) > > That way kernel developers will find their way around the perf locking details > easily, and we can also use liblockdep to check locking correctness. Yeah, we discussed about that, will do it eventually, you said this was already present in some tools/ code, but I couldn't find it: [acme@zoo linux]$ find tools/ -type f | xargs grep '\