Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1176880

Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h usable in user-space

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h usable in user-space
Date 2015-07-05 10:50 +0200
Message-ID <pINMB-Ad-11@gated-at.bofh.it> (permalink)
References (2 earlier) <pHD2V-5G5-11@gated-at.bofh.it> <pHMIX-3df-33@gated-at.bofh.it> <pHMIX-3df-31@gated-at.bofh.it> <pHXbj-1sI-7@gated-at.bofh.it> <pI3qp-5w3-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2 block/for-linus] writeback: don't drain  bdi_writeback_congested on bdi destruction Tejun Heo <tj@kernel.org> - 2015-07-02 03:00 +0200
  Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h  usable in user-space Tejun Heo <tj@kernel.org> - 2015-07-02 15:30 +0200
    Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h usable in user-space Rusty Russell <rusty@rustcorp.com.au> - 2015-07-03 02:40 +0200
      Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h  usable in user-space Jon Christopherson <jon@jons.org> - 2015-07-03 12:10 +0200
      Re: [PATCH] tools/perf, rbtree: Add RCU wrappers to make rbtree.h  usable in user-space Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-05 10:50 +0200
  Re: [PATCH 2/2 block/for-linus] writeback: don't drain bdi_writeback_congested  on bdi destruction Jens Axboe <axboe@kernel.dk> - 2015-07-02 16:10 +0200

csiph-web