From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbcDPToQ (ORCPT ); Sat, 16 Apr 2016 15:44:16 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:61465 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbcDPToP convert rfc822-to-8bit (ORCPT ); Sat, 16 Apr 2016 15:44:15 -0400 From: Arnd Bergmann To: linuxppc-dev@lists.ozlabs.org Cc: Pan Xinhui , Peter Zijlstra , Boqun Feng , linux-kernel@vger.kernel.org, Paul Mackerras , Thomas Gleixner Subject: Re: [PATCH] powerpc: introduce {cmp}xchg for u8 and u16 Date: Sat, 16 Apr 2016 21:43:24 +0200 Message-ID: <10192543.Wmc5qtLitu@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <570E2A45.9080702@linux.vnet.ibm.com> References: <570752AA.9050603@linux.vnet.ibm.com> <20160412143023.GH1087@worktop> <570E2A45.9080702@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="utf-8" X-Provags-ID: V03:K0:uMYmChYQLCNEr8fgG9/wKBYHI2JWQVA+Ag4a56gferzkltZE/Uw je/gV8v4LgKOhbI1/Doa2Pe6WjyjvP8WrQB21/LNnC3lGMUOOCqFysQvE5FX8136A2a/Zz2 w4+MA0Q89iifemvDr0nka9lOz4cxfTwid49s3HKrOD9yQlDVybMRja4huYNH9OA+zhkRgfn DMC+aQtvbJktoqnjYX4Hg== X-UI-Out-Filterresults: notjunk:1;V01:K0:HK37xOChblg=:++/CgMyf2rQms0Ybhmu9bO 3iB2rRZBIX/5+D04VUZ7I+3pu3N+tqFbJfqWnpBujOYM9g/I/Y96B51KHjPywGrS0AeBTSP4j v8Q3h8hwTwF/3XIjlr/rHU0qUbSNp76eULPvAyqNonyuHPv2CSLYkMWb9/vVGlo/hnd/m4vLj 71iVv4FosHEQFyui4QoauNEGZdVqPqY7xhfbfnlg9vPVtm9IVwDKzso6vw66773mqrfLVg+n6 PGAluJH5JxAazjdCn5dmCvOOGIL1NcTT6aIWL6QkqDt9Eo0iS+TEnsyuvOY3vEmxJ4svIEVFc tBFRgrY64IkS1y0p8ZcYLAswfmiPlvaJN3d97tnqH+1TrOrwMqujHUrIcOWXGfmouyLTUHhq7 RcpqjuBo1FcsQIs74vTTmW+AIlHw++v5bK+hGnS/AKEWVy/u/eaTj59cKcfDA4nS5BJUTQ+qi AIJxbC6t7kOzD2bCu2iW6iwjz8/QvdKxeXFfymyAzPJY7yCGwFhw0zC1pwzwLvWHJIo4a4lb5 uRyAIl1kSA9Y19AHZvMeKJYnLFj+r+RKBFG9K/YMSoYvZoSJrMxgVdnIuqZo8QEDzWNK0Mq9Y 5IIFS5EXh1AgVYTFV1FoomXaK5+2PP2vKbcHbMltz32saYn2DK+NFppiQqtap1zhfeUtH8B1A Lv0ko8lj7qY15+Q3hL6AHh/VrZXno2PfaJBgH4tKK+2sf5UlN94ZxlFAh/cK2OoCe2ZcLVW8w j1T0tkNXzXLyOkri Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 13 April 2016 19:15:17 Pan Xinhui wrote: > Hello Peter, > > On 2016年04月12日 22:30, Peter Zijlstra wrote: > > On Sun, Apr 10, 2016 at 10:17:28PM +0800, Pan Xinhui wrote: > >> > >> On 2016年04月08日 15:47, Peter Zijlstra wrote: > >>> On Fri, Apr 08, 2016 at 02:41:46PM +0800, Pan Xinhui wrote: > >>>> From: pan xinhui > >>>> > >>>> Implement xchg{u8,u16}{local,relaxed}, and > >>>> cmpxchg{u8,u16}{,local,acquire,relaxed}. > >>>> > >>>> Atomic operation on 8-bit and 16-bit data type is supported from power7 > >>> > >>> And yes I see nothing P7 specific here, this implementation is for > >>> everything PPC64 afaict, no? > >>> > >> Hello Peter, > >> No, it's not for every ppc. So yes, I need add #ifdef here. Thanks for pointing it out. > >> We might need a new config option and let it depend on POWER7/POWER8_CPU or even POWER9... > > > > Right, I'm not sure if PPC has alternatives, but you could of course > > runtime patch the code from emulated with 32bit ll/sc to native 8/16bit > > ll/sc if present on the current CPU if you have infrastructure for these > > things. > > > seems interesting. I have no idea about how to runtime patch the code. I will try to learn that. > If so, we need change {cmp}xchg into uninline functions? I think you don't need to, see do_feature_fixups()/patch_feature_section() Note that an #ifdef by itself has to worry about any combination of architectures, so in a kernel that has both POWER6 and POWER7 enabled, you cannot call the POWER7-only function. Arnd