Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp970733rwl; Wed, 12 Apr 2023 06:42:54 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/uvq1CyDY3HdIDrrOgN+HsCrWYrglv8wY21kkyQuVLSoV/6hHyb82EUT8U11umJRe7udD X-Received: by 2002:a17:907:6d90:b0:93b:866:bafe with SMTP id sb16-20020a1709076d9000b0093b0866bafemr14882928ejc.56.1681306973745; Wed, 12 Apr 2023 06:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681306973; cv=none; d=google.com; s=arc-20160816; b=JW0RugKcALrdqpgI+RX9EKH7Ig0eJLzxxdhIy1INOfigZKv4sVfBqCafA5GaZqIU44 QU7K376rdeTTV/rhv16I8UNgRnn4Ie+v7Mzsk+D3hJjlL+uLFjHq4pvtluCl7azeAJhi qYQn0kBwRfUAWTzuNuWSSz9oy6lmSSLmShfdA6iWiAk9nNw4qiZxUJg+qqCjNuOITNXt efShPBS668oOTrKDTogRADnYlmdkk93JnnHrUu+Ezg1XQSqyKUCYaQN5t9EYLM4yrEA8 O6UdB/JvDLAKW505exJq0mh8hHzH2ApTrxqhKLqTKWpCplVoTL7A1ngJ77kXhfmPgybq sH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DH15/SxDiYPBLclQ56VREuISrrW5j0LDqpqQq7OVNTI=; b=jreL4e7gnG/9Y8Gtz918tIc8w4RDXChl4lHlY2x5uruBDjf1QZ7bWY8x8hc2xFTANt i8cHHJcgFK8kTA1RGBXJ7u7cyLtut56qYijIYTugPUQlYdq55HX+lvLLmhdWAHrtNzvo t0WrcXXQ561kyCPeqn9VEi5PxorairuQegdI1Jr4UOSfRZquVXgoQnMiBA/+7sVo+yb8 2I7mAZy38JD64/7OZLFKBbU/XVza+09agFI7uZo7JPBGrMqcpR0xeY4cXpHkcT1+a3u1 GH7pPTRSyagp0naxGVHfyrM7PKDVRx0ZE4fic/zsNOQjGBkMwhA/5+nQIe9j4CebNwq+ qlnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=fwo5YyaV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rk23-20020a170907215700b0094a56fcab58si8507123ejb.771.2023.04.12.06.42.29; Wed, 12 Apr 2023 06:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=fwo5YyaV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbjDLNlb (ORCPT + 99 others); Wed, 12 Apr 2023 09:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbjDLNl0 (ORCPT ); Wed, 12 Apr 2023 09:41:26 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D16F949C2; Wed, 12 Apr 2023 06:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=DH15/SxDiYPBLclQ56VREuISrrW5j0LDqpqQq7OVNTI=; b=fwo5YyaVDrgsSL1EW2eG6ZifCn nQARtc5HebgVz/+GdbkxT/HPewsrSDhvVH8ViRA5L7yR3WDbC9DmPggQPMdj2YU5JTreQzgfcwIKm QRIAf1XdE4vAZHL0z+gNAmTMcU5KaoOQ2EOMGd9NlHIdVOmX12t8zqrCTXjMvpovvMKsp/zSSW2QL wq1adFoxn9YV53iWVnsLJEs7kK5kS/Iud8T75kNNVd8EGfzTkIbD/mdTwGc/j8gZRy4ze+jaUhHxc USHi7FYvDd+KVHT4eWYOpwNhRzG3lGIjcuJBHNZ/qmCUUEBKnMbL9FzU4jNUAL2z3AnG8l+wY3m+A 6p0qEndQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pmaiM-00DwAw-10; Wed, 12 Apr 2023 13:40:46 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A7C5B3002A6; Wed, 12 Apr 2023 15:40:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 91D902095F65D; Wed, 12 Apr 2023 15:40:42 +0200 (CEST) Date: Wed, 12 Apr 2023 15:40:42 +0200 From: Peter Zijlstra To: Uros Bizjak Cc: linux-alpha@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Huacai Chen , WANG Xuerui , Jiaxun Yang , Jun Yi , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH v2 3/5] locking/arch: Wire up local_try_cmpxchg Message-ID: <20230412134042.GA629004@hirez.programming.kicks-ass.net> References: <20230405141710.3551-1-ubizjak@gmail.com> <20230405141710.3551-4-ubizjak@gmail.com> <20230412113231.GA628377@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 12, 2023 at 03:37:50PM +0200, Uros Bizjak wrote: > On Wed, Apr 12, 2023 at 1:33 PM Peter Zijlstra wrote: > > > > On Wed, Apr 05, 2023 at 04:17:08PM +0200, Uros Bizjak wrote: > > > diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h > > > index bc4bd19b7fc2..45492fb5bf22 100644 > > > --- a/arch/powerpc/include/asm/local.h > > > +++ b/arch/powerpc/include/asm/local.h > > > @@ -90,6 +90,17 @@ static __inline__ long local_cmpxchg(local_t *l, long o, long n) > > > return t; > > > } > > > > > > +static __inline__ bool local_try_cmpxchg(local_t *l, long *po, long n) > > > +{ > > > + long o = *po, r; > > > + > > > + r = local_cmpxchg(l, o, n); > > > + if (unlikely(r != o)) > > > + *po = r; > > > + > > > + return likely(r == o); > > > +} > > > + > > > > Why is the ppc one different from the rest? Why can't it use the > > try_cmpxchg_local() fallback and needs to have it open-coded? > > Please note that ppc directly defines local_cmpxchg that bypasses > cmpxchg_local/arch_cmpxchg_local machinery. The patch takes the same > approach for local_try_cmpxchg, because fallbacks are using > arch_cmpxchg_local definitions. > > PPC should be converted to use arch_cmpxchg_local (to also enable > instrumentation), but this is not the scope of the proposed patchset. Ah indeed. Thanks!