Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1405032
| Path | csiph.com!feeder.erje.net!1.us.feeder.erje.net!goblin1!goblin2!goblin.stu.neva.ru!news.unit0.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Alexey Dobriyan <adobriyan@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] seqlock: fix raw_read_seqcount_latch() |
| Date | Sun, 22 May 2016 21:00:01 +0200 |
| Message-ID | <rBGLv-4ef-5@gated-at.bofh.it> (permalink) |
| References | <rBlxo-84d-7@gated-at.bofh.it> <rBz7j-8a7-11@gated-at.bofh.it> |
| X-Original-To | Peter Zijlstra <peterz@infradead.org> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BAtMwZ72ILZ4Adrhj5vfGM2EWGBuNXbZ3Tzg7qz/l14=; b=i57iTVpzHOpzvkvuhaTfEigmImhgqhQFd0T/cZ47SOxyCIwxHUV6NWDVZtqhtfYMWV upqHOQIAIhO8Ojcgyr5Hdsv6cQChvSYxHFIM8XC5MO+OAFaVxGEv/5UBG2Nsz7T7cpqY //GaB/zgsV5UY+BXgvKERilp0mW8i7mAFkkKs3Y+4E7xGz1hCCEkZwNB7KAHB2fKfgCB L/k1fQINbbSVZO8D87QJbL9Lwa9EJSCfERBvb7aFTAUJLETf1a4mYuAA0UHjzD4IOIgo 4mHXgpUWcWp/E7UazSIReL5xYxY48onwgqqw4+YCAmbT5RizlUqX/CT7FZGnlex/Pyec pkDQ== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BAtMwZ72ILZ4Adrhj5vfGM2EWGBuNXbZ3Tzg7qz/l14=; b=EIHBIkx3fY7MKw1LaQPG2nwOS5BjOT2OEQ0ejSBLj8vdfDxYquLR62B7f7/J2W1Hzo 7HE3s2FnRvjfLLyUo6iUIY3ptIfipM+i6SR/r1qZM0EynUnC2L1yxCEBSHxWVnOCt3s1 jxZVot3LRljKZTDKDB97tZbPEIMMcK2dljU59vosEvX9wHLJtBVUCQd9RFNn0oBr5cuQ 4RCS+6LH4Y5eo47rlMC23PHeya+6zCy76U7Ux3inylE5lu6qTe35lWy974LTRoCWMdeD 6cjxBrDRXDVTGmJruueQ9tWyqs3sdZjYVxPlMuvHMZaKtk2LRngXVThvcM5IABfil2AO Z3Pg== |
| X-Gm-Message-State | AOPr4FVYJhSIDmakl0JVNQS93kQP87UlE8wOXl8P/9DUSJQtdmipYWabm5UiZRNFY5aAVQ== |
| X-Received | by 10.25.17.211 with SMTP id 80mr4504267lfr.154.1463943043850; Sun, 22 May 2016 11:50:43 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 28 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Paul McKenney <paulmck@linux.vnet.ibm.com> |
| X-Original-Date | Sun, 22 May 2016 21:50:40 +0300 |
| X-Original-Message-ID | <20160522185040.GA23664@p183.telecom.by> |
| X-Original-References | <20160521201448.GA7429@p183.telecom.by> <20160522104827.GP3193@twins.programming.kicks-ass.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1405032 |
Show key headers only | View raw
On Sun, May 22, 2016 at 12:48:27PM +0200, Peter Zijlstra wrote:
> 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.
This works (and spammy enough in case of seqlock, which is good)
but not for "unsigned long":
include/linux/percpu-refcount.h:146:36: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
percpu_ptr = lockless_dereference(ref->percpu_count_ptr);
> --- 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
[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