All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Reshetova, Elena" <elena.reshetova@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"jolsa@kernel.org" <jolsa@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"matija.glavinic-pecotic.ext@nokia.com" 
	<matija.glavinic-pecotic.ext@nokia.com>,
	Hans Liljestrand <ishkamiel@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	David Windsor <dwindsor@gmail.com>
Subject: RE: [PATCH 1/9] tools: convert cgroup_sel.refcnt from atomic_t to refcount_t
Date: Wed, 22 Feb 2017 16:10:59 +0000	[thread overview]
Message-ID: <2236FBA76BA1254E88B949DDB74E612B41C4EE30@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20170222153754.GA20447@kernel.org>

> Em Wed, Feb 22, 2017 at 02:29:18PM +0000, Reshetova, Elena escreveu:
> > > Em Tue, Feb 21, 2017 at 05:34:55PM +0200, Elena Reshetova escreveu:
> > > > refcount_t type and corresponding API should be
> > > > used instead of atomic_t when the variable is used as
> > > > a reference counter. This allows to avoid accidental
> > > > refcounter overflows that might lead to use-after-free
> > > > situations.
> > > >  #define __CGROUP_H__
> > > >
> > > > -#include <linux/atomic.h>
> > > > +#include <linux/refcount.h>
> > >
> > > So this is the first one, I was expecting the copy from
> > > include/linux/refcount.h to be made to tools/include/linux/refcount.h,
> > > as was done for tools/include/linux/atomic.h and all the other stuff in
> > > tools/include/
> > >
> > > See:
> > >
> > > commit c4b6014e8bb0c8d47fe5c71ebc604f31091e5d3f
> > > Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > Date:   Mon Jul 11 10:28:48 2016 -0300
> > >
> > >     tools: Add copy of perf_event.h to tools/include/linux/
> > >
> > > --------------
> > >
> > > For one of the reasons we've been doing this.
> 
> > Hm.. I have taken a look on it and I am confused.  refcount.h is not
> > exactly standalone header and seems to bring in quite some many
> > dependencies to other headers (linux/bug.h, linux/mutex.h etc.), which
> > are not present in tools headers dirs.
> 
> > I tried to compile perf tool as a start, copied the refcount.h to
> > tools/include/linux/ and somewhere after it wanted me to bring the
> > 10th header I stopped, because this cannot be right, or?
> 
> So, it doesn't have to be a straight copy, and it just shows the problem
> with using the kernel headers directly, i.e. tools/perf/ uses atomic.h,
> and uses that for refcounting, but not all of include/linux/refcount.h
> should be copied to tools/include/linux/refcount.h.

Oh, this is a good hint. Actually when I drop the *_lock and *_mutex_lock functions
(which are not needed by tools anyway), indeed most of the issues with header inclusions are gone. 
However, there are still some additional atomic functions needed that are not present in current atomic headers of tools.

> 
> I'll try doing the work, that way I'll read about this new stuff, will
> come back here with what I find, so you can continue on the kernel bits
> for now, ok?

Sure, if you want to take it over, nobosy won't complain! We need many of such changes merged and not everyone is so nice to help :)
I think after the needed headers/functions from refcount/atomic are in place in tools, the current patches should compile with no or almost no changes, so hopefully it still makes your work easier!

Best Regards,
Elena.
> 
> - Arnaldo

  reply	other threads:[~2017-02-22 16:11 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 15:34 [PATCH 0/9] tools subsystem refcounter conversions Elena Reshetova
2017-02-21 15:34 ` [PATCH 1/9] tools: convert cgroup_sel.refcnt from atomic_t to refcount_t Elena Reshetova
2017-02-21 15:43   ` Arnaldo Carvalho de Melo
2017-02-22 14:29     ` Reshetova, Elena
2017-02-22 14:29       ` Reshetova, Elena
2017-02-22 15:37       ` Arnaldo Carvalho de Melo
2017-02-22 15:37         ` Arnaldo Carvalho de Melo
2017-02-22 16:10         ` Reshetova, Elena [this message]
2017-02-22 16:10           ` Reshetova, Elena
2017-02-22 20:28           ` Arnaldo Carvalho de Melo
2017-02-22 20:28             ` Arnaldo Carvalho de Melo
2017-02-23 13:10             ` Reshetova, Elena
2017-02-23 13:10               ` Reshetova, Elena
2017-03-07  7:36   ` [tip:perf/core] perf cgroup: Convert " tip-bot for Elena Reshetova
2017-02-21 15:34 ` [PATCH 2/9] tools: convert cpu_map.refcnt " Elena Reshetova
2017-02-22 20:29   ` Arnaldo Carvalho de Melo
2017-02-21 15:34 ` [PATCH 3/9] tools: convert comm_str.refcnt " Elena Reshetova
2017-02-22 20:33   ` Arnaldo Carvalho de Melo
2017-02-22 22:20     ` Arnaldo Carvalho de Melo
2017-02-22 22:31       ` Arnaldo Carvalho de Melo
2017-02-23  9:16         ` Reshetova, Elena
2017-02-23  9:16           ` Reshetova, Elena
2017-02-23 13:02           ` Arnaldo Carvalho de Melo
2017-02-21 15:34 ` [PATCH 4/9] tools: convert dso.refcnt " Elena Reshetova
2017-02-22 20:37   ` Arnaldo Carvalho de Melo
2017-02-22 20:40     ` Arnaldo Carvalho de Melo
2017-03-07  7:45   ` [tip:perf/core] perf dso: Convert " tip-bot for Elena Reshetova
2017-02-21 15:34 ` [PATCH 5/9] tools: convert map.refcnt " Elena Reshetova
2017-03-07  7:48   ` [tip:perf/core] perf map: Convert " tip-bot for Elena Reshetova
2017-02-21 15:35 ` [PATCH 6/9] tools: convert map_groups.refcnt " Elena Reshetova
2017-02-22 20:55   ` Arnaldo Carvalho de Melo
2017-02-21 15:35 ` [PATCH 7/9] tools: convert perf_map.refcnt " Elena Reshetova
2017-02-21 15:35 ` [PATCH 8/9] tools: convert thread.refcnt " Elena Reshetova
2017-02-22 23:06   ` Arnaldo Carvalho de Melo
2017-03-07  7:56   ` [tip:perf/core] perf thread: " tip-bot for Elena Reshetova
2017-02-21 15:35 ` [PATCH 9/9] tools: convert thread_map.refcnt " Elena Reshetova
2017-02-21 15:39 ` [PATCH 0/9] tools subsystem refcounter conversions Arnaldo Carvalho de Melo
2017-02-22 23:23   ` Arnaldo Carvalho de Melo
2017-02-22 23:29     ` Arnaldo Carvalho de Melo
2017-02-23 11:39       ` Reshetova, Elena
2017-02-23 11:39         ` Reshetova, Elena
2017-02-23 12:50         ` Arnaldo Carvalho de Melo
2017-02-23 12:50           ` Arnaldo Carvalho de Melo
2017-02-23 16:23         ` Arnaldo Carvalho de Melo
2017-02-23 16:23           ` Arnaldo Carvalho de Melo
2017-02-24  7:27           ` Reshetova, Elena
2017-02-24  7:27             ` Reshetova, Elena
2017-02-24 13:32             ` Arnaldo Carvalho de Melo
2017-02-24 13:32               ` Arnaldo Carvalho de Melo
2017-03-07  8:02           ` [tip:perf/core] perf evlist: Clarify a bit the use of perf_mmap->refcnt tip-bot for Arnaldo Carvalho de Melo
2017-02-21 15:46 ` [PATCH 0/9] tools subsystem refcounter conversions Peter Zijlstra
2017-02-21 16:00   ` Reshetova, Elena
2017-02-21 16:00     ` Reshetova, Elena

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=2236FBA76BA1254E88B949DDB74E612B41C4EE30@IRSMSX102.ger.corp.intel.com \
    --to=elena.reshetova@intel.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=dwindsor@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ishkamiel@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matija.glavinic-pecotic.ext@nokia.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.