From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756485AbcHVTyy (ORCPT ); Mon, 22 Aug 2016 15:54:54 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15639 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754590AbcHVTyx (ORCPT ); Mon, 22 Aug 2016 15:54:53 -0400 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com Date: Mon, 22 Aug 2016 12:54:45 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Peter Zijlstra , Eric Dumazet , LKML , Ingo Molnar , jiangshanlai@gmail.com, dipankar@in.ibm.com, Andrew Morton , Mathieu Desnoyers , Josh Triplett , Thomas Gleixner , David Howells , dvhart@linux.intel.com, =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , oleg@redhat.com, pranith kumar , geert@linux-m68k.org Subject: Re: [PATCH tip/core/rcu 2/2] documentation: Record reason for rcu_head two-byte alignment Reply-To: paulmck@linux.vnet.ibm.com References: <20160822151413.GA6337@linux.vnet.ibm.com> <1471878883-6660-2-git-send-email-paulmck@linux.vnet.ibm.com> <20160822162553.GJ10153@twins.programming.kicks-ass.net> <20160822173453.GF3482@linux.vnet.ibm.com> <20160822185609.GK10153@twins.programming.kicks-ass.net> <20160822151854.175dfea8@grimm.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160822151854.175dfea8@grimm.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082219-0016-0000-0000-0000047B01C9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005630; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000183; SDB=6.00748206; UDB=6.00353089; IPR=6.00520871; BA=6.00004672; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012424; XFM=3.00000011; UTC=2016-08-22 19:54:36 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082219-0017-0000-0000-0000323CA676 Message-Id: <20160822195445.GO3482@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-22_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608220200 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2016 at 03:18:54PM -0400, Steven Rostedt wrote: > On Mon, 22 Aug 2016 20:56:09 +0200 > Peter Zijlstra wrote: > > > > Don't we have __alignof__(void *) to avoid #ifdef CONFIG_M68K and > > > other new macros ? Hmmm... Does __alignof__(void *) give two-byte alignment on m68k, allowing something like this? Heh!!! It is already there. ;-) struct callback_head { struct callback_head *next; void (*func)(struct callback_head *head); } __attribute__((aligned(sizeof(void *)))); #define rcu_head callback_head If so, that does sound quite attractive! Might need the WARN_ON() anyway, to flag wild pointers if nothing else. Adding Geert on CC for his thoughts. > > Yes, but that 'hides' the m68k funny, while doing an explicit #ifdef has > > documentation value... but I don't care too deeply. Well, if I need the WARN_ON() anyway, perhaps we get both. > I'd recommend keeping the #ifdef, and then if another architecture > comes along that is as weird as m68k, we can use the generic > __alignof__(void *). Maybe even add that in the comment, so when/if > that arch is created, people will know how to fix it more generically. Maybe __call_rcu() can do something like this? WARN_ON_ONCE((unsigned long)head & (__alignof__(struct rcu_head) - 1)); Except that RCU needs at least two-byte alignment, so something like this? WARN_ON_ONCE((unsigned long)head & ((__alignof__(struct rcu_head) - 1) | 0x1)); That way, some future architecture that doesn't believe in any alignment at all will be properly informed of RCU's needs in this area. Thanx, Paul