Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753260Ab3JLTtO (ORCPT ); Sat, 12 Oct 2013 15:49:14 -0400 Received: from mail.efficios.com ([78.47.125.74]:48450 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752732Ab3JLTtM (ORCPT ); Sat, 12 Oct 2013 15:49:12 -0400 X-Greylist: delayed 406 seconds by postgrey-1.27 at vger.kernel.org; Sat, 12 Oct 2013 15:49:12 EDT Date: Sat, 12 Oct 2013 19:42:18 +0000 (UTC) From: Mathieu Desnoyers To: Hannes Frederic Sowa Cc: "Paul E. McKenney" , Eric Dumazet , Josh Triplett , linux-kernel@vger.kernel.org, mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org Message-ID: <1882655271.38519.1381606938076.JavaMail.zimbra@efficios.com> In-Reply-To: <20131012173734.GC20321@order.stressinduktion.org> References: <20131009225617.GH11709@jtriplet-mobl1> <20131010002833.GJ5790@linux.vnet.ibm.com> <20131010020422.GB24368@order.stressinduktion.org> <20131010190532.GQ5790@linux.vnet.ibm.com> <20131012022508.GA20321@order.stressinduktion.org> <20131012075336.GA5790@linux.vnet.ibm.com> <20131012164345.GB20321@order.stressinduktion.org> <20131012173734.GC20321@order.stressinduktion.org> Subject: Re: [PATCH v2 tip/core/rcu 07/13] ipv6/ip6_tunnel: Apply rcu_access_pointer() to avoid sparse false positive MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [206.248.138.119] X-Mailer: Zimbra 8.0.5_GA_5839 (ZimbraWebClient - FF24 (Linux)/8.0.5_GA_5839) Thread-Topic: ipv6/ip6_tunnel: Apply rcu_access_pointer() to avoid sparse false positive Thread-Index: OgxyUbPInVSRzsqZOng+rFdUjJmsRw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2810 Lines: 59 ----- Original Message ----- > From: "Hannes Frederic Sowa" > To: "Paul E. McKenney" , "Eric Dumazet" , "Josh Triplett" > , linux-kernel@vger.kernel.org, mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com, > akpm@linux-foundation.org, "mathieu desnoyers" , niv@us.ibm.com, tglx@linutronix.de, > peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, darren@dvhart.com, > fweisbec@gmail.com, sbw@mit.edu, "David S. Miller" , "Alexey Kuznetsov" , > "James Morris" , "Hideaki YOSHIFUJI" , "Patrick McHardy" > , netdev@vger.kernel.org > Sent: Saturday, October 12, 2013 1:37:34 PM > Subject: Re: [PATCH v2 tip/core/rcu 07/13] ipv6/ip6_tunnel: Apply rcu_access_pointer() to avoid sparse false positive > > On Sat, Oct 12, 2013 at 06:43:45PM +0200, Hannes Frederic Sowa wrote: > > Regarding the volatile access, I hope that the C11 memory model > > and enhancements to the compiler will some day provide a better > > way to express the semantics of what is tried to express here > > (__atomic_store_n/__atomic_load_n with the accompanied memory model, > > which could be even weaker to what a volatile access would enfore > > now and could guarantee atomic stores/loads). > > I just played around a bit more. Perhaps we could try to warn of silly > usages of ACCESS_ONCE(): > > --- a/include/linux/compiler.h > +++ b/include/linux/compiler.h > @@ -349,7 +349,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, > int val, int expect); > * use is to mediate communication between process-level code and irq/NMI > * handlers, all running on the same CPU. > */ > -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) > +#define ACCESS_ONCE(x) (*({ \ > + compiletime_assert(sizeof(typeof(x)) <= sizeof(typeof(&x)), \ > + "ACCESS_ONCE likely not atomic"); \ AFAIU, ACCESS_ONCE() is not meant to ensure atomicity of load/store, but rather merely ensures that the compiler will not merge nor refetch accesses. I don't think the assert check you propose is appropriate with respect to the ACCESS_ONCE() semantic. Thanks, Mathieu > + (volatile typeof(x) *)&(x); \ > +})) > > /* Ignore/forbid kprobes attach on very low level functions marked by this > attribute: */ > #ifdef CONFIG_KPROBES > > -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com -- 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/