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


Groups > linux.kernel > #1404994

Re: [PATCH] seqlock: fix raw_read_seqcount_latch()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] seqlock: fix raw_read_seqcount_latch()
Date 2016-05-22 12:50 +0200
Message-ID <rBz7j-8a7-11@gated-at.bofh.it> (permalink)
References <rBlxo-84d-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, May 21, 2016 at 11:14:49PM +0300, Alexey Dobriyan wrote:
> lockless_dereference() is supposed to take pointer not integer.

Urgh :/

Is there any way we can make lockless_dereference() issue a warning if
we don't feed it a pointer?

Would something like so work? All pointer types should silently cast to
void * while integer (and others) should refuse to.

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index b5ff9881bef8..8886de704d33 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -544,6 +544,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  */
 #define lockless_dereference(p) \
 ({ \
+ 	__maybe_unused void * _________p2 = p; \
 	typeof(p) _________p1 = READ_ONCE(p); \
 	smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
 	(_________p1); \

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


Thread

[PATCH] seqlock: fix raw_read_seqcount_latch() Alexey Dobriyan <adobriyan@gmail.com> - 2016-05-21 22:20 +0200
  Re: [PATCH] seqlock: fix raw_read_seqcount_latch() Peter Zijlstra <peterz@infradead.org> - 2016-05-22 12:50 +0200
    Re: [PATCH] seqlock: fix raw_read_seqcount_latch() Alexey Dobriyan <adobriyan@gmail.com> - 2016-05-22 21:00 +0200
      Re: [PATCH] seqlock: fix raw_read_seqcount_latch() Peter Zijlstra <peterz@infradead.org> - 2016-05-23 11:40 +0200
        Re: [PATCH] seqlock: fix raw_read_seqcount_latch() Tejun Heo <tj@kernel.org> - 2016-05-25 22:00 +0200
          [PATCH] percpu: Revert ("percpu: Replace smp_read_barrier_depends()  with lockless_dereference()") Tejun Heo <tj@kernel.org> - 2016-05-25 22:20 +0200
  Re: [PATCH] seqlock: fix raw_read_seqcount_latch() Peter Zijlstra <peterz@infradead.org> - 2016-05-27 13:20 +0200

csiph-web