From: Ingo Molnar <mingo@kernel.org>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
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
Date: Wed, 10 Jun 2015 09:04:22 +0200 [thread overview]
Message-ID: <20150610070422.GA12917@gmail.com> (raw)
In-Reply-To: <20150609142515.GD2195@redhat.com>
* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> Em Tue, Jun 09, 2015 at 11:56:10AM +0200, Ingo Molnar escreveu:
> > * tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com> 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 '\<mutex_unlock'
> [acme@zoo linux]$
it's in -tip in tools/kvm/:
triton:~/tip> git grep mutex_lock tools/kvm/include/kvm/mutex.h
tools/kvm/include/kvm/mutex.h:static inline void mutex_lock(struct mutex *lock)
triton:~/tip> git grep down tools/kvm/include/kvm/rwsem.h
tools/kvm/include/kvm/rwsem.h:static inline void down_read(pthread_rwlock_t *rwsem)
tools/kvm/include/kvm/rwsem.h:static inline void down_write(pthread_rwlock_t *rwsem)
Thanks,
Ingo
prev parent reply other threads:[~2015-06-10 7:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 9:53 [tip:perf/core] perf tools: Protect accesses the dso rbtrees/ lists with a rw lock tip-bot for Arnaldo Carvalho de Melo
2015-06-09 9:56 ` Ingo Molnar
2015-06-09 14:25 ` Arnaldo Carvalho de Melo
2015-06-10 7:04 ` Ingo Molnar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150610070422.GA12917@gmail.com \
--to=mingo@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox