From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752743AbcBWKkv (ORCPT ); Tue, 23 Feb 2016 05:40:51 -0500 Received: from ozlabs.org ([103.22.144.67]:46062 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbcBWKkA (ORCPT ); Tue, 23 Feb 2016 05:40:00 -0500 Message-ID: <1456223992.3192.0.camel@ellerman.id.au> Subject: Re: [PATCH] arch/powerpc: use BUILD_BUG() when detect unfit {cmp}xchg, size From: Michael Ellerman To: Boqun Feng , Pan Xinhui Cc: linuxppc-dev@lists.ozlabs.org, open list , Benjamin Herrenschmidt , Paul Mackerras , "'Peter Zijlstra (Intel)\"" , "Paul E. McKenney" , Thomas Gleixner Date: Tue, 23 Feb 2016 21:39:52 +1100 In-Reply-To: <20160223091525.GA2918@fixme-laptop.cn.ibm.com> References: <56CC1C1C.6030405@linux.vnet.ibm.com> <20160223091525.GA2918@fixme-laptop.cn.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5-1ubuntu3.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-02-23 at 17:15 +0800, Boqun Feng wrote: > On Tue, Feb 23, 2016 at 04:45:16PM +0800, Pan Xinhui wrote: > > From: pan xinhui > > > > diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h > > index d1a8d93..20c0a30 100644 > > --- a/arch/powerpc/include/asm/cmpxchg.h > > +++ b/arch/powerpc/include/asm/cmpxchg.h > > @@ -92,12 +93,6 @@ __xchg_u64_local(volatile void *p, unsigned long val) > > } > > #endif > > > > -/* > > - * This function doesn't exist, so you'll get a linker error > > - * if something tries to do an invalid xchg(). > > - */ > > -extern void __xchg_called_with_bad_pointer(void); > > - > > static __always_inline unsigned long > > __xchg(volatile void *ptr, unsigned long x, unsigned int size) > > { > > @@ -109,7 +104,7 @@ __xchg(volatile void *ptr, unsigned long x, unsigned int size) > > return __xchg_u64(ptr, x); > > #endif > > } > > - __xchg_called_with_bad_pointer(); > > + BUILD_BUG(); > > Maybe we can use BUILD_BUG_ON_MSG(1, "Unsupported size for xchg"), which > could provide more information. Yes I would prefer there was a message. Please send a v2. cheers