All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>, Tejun Heo <tj@kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Jon Christopherson <jon@jons.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h usable in user-space
Date: Sat, 4 Jul 2015 13:15:56 -0300	[thread overview]
Message-ID: <20150704161556.GD3976@kernel.org> (raw)
In-Reply-To: <20150703071446.GE19282@twins.programming.kicks-ass.net>

Em Fri, Jul 03, 2015 at 09:14:46AM +0200, Peter Zijlstra escreveu:
> On Fri, Jul 03, 2015 at 06:21:12AM +0930, Rusty Russell wrote:
> > Looks like Peter Zijlstra is the one to take this fix...
> 
> acme is the steward of tools/perf/
> 
> > >> diff --git a/tools/perf/util/include/linux/rcupdate.h
> > >> b/tools/perf/util/include/linux/rcupdate.h
> > >> new file mode 100644
> > >> index 0000000..51c0f45
> > >> --- /dev/null
> > >> +++ b/tools/perf/util/include/linux/rcupdate.h
> > >> @@ -0,0 +1,9 @@
> > >> +#ifndef PERF_LINUX_RCUPDATE_H_
> > >> +#define PERF_LINUX_RCUPDATE_H_
> > >> +
> > >> +/* Simple trivial wrappers for now, we don't use RCU in perf user-space
> > >> (yet): */
> > >> +#define WRITE_ONCE(var, val) ((var) = (val))
> 
> It looks like perf includes linux/compiler.h so it should already have this.
> 
> > >> +#define rcu_assign_pointer(ptr, val) WRITE_ONCE(ptr, val)
> 
> That's plain wrong, WRITE_ONCE(*(ptr), (val))

Are you sure?

In the kernel, we have this sequence:

#define rcu_assign_pointer(p, v) smp_store_release(&p, RCU_INITIALIZER(v))

#define smp_store_release(p, v)			\
do {						\
        compiletime_assert_atomic_type(*p);	\
        smp_mb();				\
        ACCESS_ONCE(*p) = (v);			\
} while (0)


So, if you go shortcircuiting things you remove that & and that *, no?

I.e. end up with what Rusty suggested.

So, I am trying to keep as much as the semantics of the kernel not to
fall into thse traps...

Will post a RFC soon, if the rain continues preventing me from
running...

- Arnaldo

  parent reply	other threads:[~2015-07-05  8:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02  0:52 [PATCH 1/2 block/for-linus] writeback: don't embed root bdi_writeback_congested in bdi_writeback Tejun Heo
2015-07-02  0:53 ` [PATCH 2/2 block/for-linus] writeback: don't drain bdi_writeback_congested on bdi destruction Tejun Heo
2015-07-02  3:02   ` Jon Christopherson
     [not found]     ` <5594AD98.4050402@jons.org>
2015-07-02 13:21       ` [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h usable in user-space Tejun Heo
2015-07-02 20:51         ` Rusty Russell
2015-07-03  7:14           ` Peter Zijlstra
2015-07-03 10:00             ` Jon Christopherson
2015-07-04 16:15             ` Arnaldo Carvalho de Melo [this message]
2015-07-06 10:57               ` Peter Zijlstra
2015-07-02 14:04     ` [PATCH 2/2 block/for-linus] writeback: don't drain bdi_writeback_congested on bdi destruction Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2015-06-17  6:09 Building tools/perf fails on next Riku Voipio
2015-06-17  9:17 ` [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h usable in user-space Ingo Molnar
2015-06-17  9:33   ` Riku Voipio
2015-07-06  8:13   ` Stephen Rothwell
2015-07-06  9:41     ` Ingo Molnar
2015-07-06 22:39       ` Stephen Rothwell

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=20150704161556.GD3976@kernel.org \
    --to=acme@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=jon@jons.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.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.