Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1832909rwl; Thu, 6 Apr 2023 01:42:13 -0700 (PDT) X-Google-Smtp-Source: AKy350acDXTPuJ4beBCh5OyRng/ldlCAz0U6yE6kPLp1o9X+jBw4u2V1140tMySr7eFfjUWG8tPM X-Received: by 2002:a17:906:7ccf:b0:8af:3b78:315d with SMTP id h15-20020a1709067ccf00b008af3b78315dmr5698211ejp.23.1680770533147; Thu, 06 Apr 2023 01:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680770533; cv=none; d=google.com; s=arc-20160816; b=J3KqxINM7vs5cxPys9IaffhsBCRSGviUCs/UjtwnWUU44U02oOSYJYB7uqPiNKX6nS VB6B2MlAD1/uyBm6UlxL2IEVaQ5u7n6sAormuBcheq9S41lpnXGm0HtcYTGd0i0v7DZd VyiY8A2WgACIbKac14Y9/t9WLa+sdNFZ6fpGG7Vjpdxyn0Q1Gib1KrXSoDBfoOwNbKGv pZbxxQANpnVjO22IxowWIZSaFCoBMymkmEAK+Grp4whnT/em7fuymKtDOQIsUl/uXbcb MhUYM1IlL/FNn1HTtAkoc+57TPK7Yjf7QsjOspAkv0uOSPymlfe0q2JxMK4oMlo2sb03 LQ8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NlaEdqHEUWRBg+c+TC3rtvHvp43Ws6SzpzXrskt0NuQ=; b=ufZRevprG3QnSTRedM9NSHbQeVu9nTAN88OFnovP6IjsrBiWsG5Tx0RlsQF/qLV8fR QyMWSZEwyBKwsh+aWDK4Ade3O6RjX8alrOSmw6CwVx6q7fAU01FyR6351q7K3LUz0YmT hqzkBw60meh1Hj8BeQxtuDhChxgyhojA1M5ryG3MoQWdWe3eErohQgSH6tUP9ayLD/c4 9Sr34jE40nqWWyYGnq3GGKr2EXjVxjBgKEZVgkrlQga7MjwBee+cbMywReXgZJEmMv9c yWEtfWaTAwvNbyrOGP1g2YCTQ0r8JH/MCsoi2GbVp99Sjgs5WMc3hbaXbWOgiJ7+o/vP x5kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FcEFN1D0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020aa7d14e000000b004acb7b6a25csi784020edo.42.2023.04.06.01.41.46; Thu, 06 Apr 2023 01:42:13 -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=@gmail.com header.s=20210112 header.b=FcEFN1D0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231484AbjDFIjI (ORCPT + 99 others); Thu, 6 Apr 2023 04:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235893AbjDFIjF (ORCPT ); Thu, 6 Apr 2023 04:39:05 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8E1C7686; Thu, 6 Apr 2023 01:38:55 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id h8so11791668qko.8; Thu, 06 Apr 2023 01:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680770335; x=1683362335; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NlaEdqHEUWRBg+c+TC3rtvHvp43Ws6SzpzXrskt0NuQ=; b=FcEFN1D0ri75uBu6r0ZHhcejyvqKNx6oJ/kCWbsPjgbRTXUK+5sFyIyJ41szjzh2vz xVhDHcBOXBBaBl2763I8yyGNI4Y1fwMQfazSTTslgohL9KsMOTUPXNHmYVexNch0+1d0 Uq60kWvODRXwWd5fupV+fGBAPS0e5NQtrRQ18m1KgxMA+htmCUOAemJHSj13GyKNBBwP LnTUsXPtIhkrA3+iVp9wttq9oZ6eterHG0fTb3sDXzAZV2onLK9uY4a0ZVJ4Q0/1Ldd7 h/usCfUZRrxzV7W5BNMQNSXEN2Am7bp6nL8tc/66t7LSwmSuBBvt43oRFVcj6mjWFab7 P2Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680770335; x=1683362335; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NlaEdqHEUWRBg+c+TC3rtvHvp43Ws6SzpzXrskt0NuQ=; b=QqKE/jumRQnNiz5fTD4GPttkurePn1RtSNihaQEBlOsHzWBToVpKdol7a3fhQycB5p ysW/vlWrc9NLDv5juul2EiT6DUoMflCFTt9nPIOkC7l6Ky1LOY/KHkKrC+oIMY2h9gd8 qoJbcKzjSLB0Uix3hu83W3cX7aOr0VEr04fds2dmAlGHT/FZXTYDWPZBJf+tw2HTIZho kYUKQNd8k45EWwoIQzzLB2A9PN3bq/b/ZJC7bwla7d9R+E1mEBpyh9DXYsgF7BGYWHgv v8jbx0gM2ZuXlQ5Xw1d+sfYL6ymwbgg2/h7eaqR0lDGKoIom6uvNYFjWdpk8xjBkPghr rt1A== X-Gm-Message-State: AAQBX9ccnf/DzmPNKDfFxaU35dpMpJvRn2VA0PyX+Yu6sHj5N99IsPJS gVApIrcE169PK0W+O2zivv42BOM5UT6UIgHTFuo= X-Received: by 2002:a05:620a:1a28:b0:742:71e6:b8d4 with SMTP id bk40-20020a05620a1a2800b0074271e6b8d4mr2043793qkb.6.1680770334780; Thu, 06 Apr 2023 01:38:54 -0700 (PDT) MIME-Version: 1.0 References: <20230405141710.3551-1-ubizjak@gmail.com> <7360ffd2-a5aa-1373-8309-93e71ff36cbb@intel.com> <5c10520ac747430cb421badcb293c706@AcuMS.aculab.com> In-Reply-To: <5c10520ac747430cb421badcb293c706@AcuMS.aculab.com> From: Uros Bizjak Date: Thu, 6 Apr 2023 10:38:43 +0200 Message-ID: Subject: Re: [PATCH v2 0/5] locking: Introduce local{,64}_try_cmpxchg To: David Laight Cc: Dave Hansen , "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 , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Arnd Bergmann , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Will Deacon , Boqun Feng , Jiaxun Yang , Jun Yi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Thu, Apr 6, 2023 at 10:26=E2=80=AFAM David Laight wrote: > > From: Dave Hansen > > Sent: 05 April 2023 17:37 > > > > On 4/5/23 07:17, Uros Bizjak wrote: > > > Add generic and target specific support for local{,64}_try_cmpxchg > > > and wire up support for all targets that use local_t infrastructure. > > > > I feel like I'm missing some context. > > > > What are the actual end user visible effects of this series? Is there = a > > measurable decrease in perf overhead? Why go to all this trouble for > > perf? Who else will use local_try_cmpxchg()? > > I'm assuming the local_xxx operations only have to be save wrt interrupts= ? > On x86 it is possible that an alternate instruction sequence > that doesn't use a locked instruction may actually be faster! Please note that "local" functions do not use lock prefix. Only atomic properties of cmpxchg instruction are exploited since it only needs to be safe wrt interrupts. Uros. > Although, maybe, any kind of locked cmpxchg just needs to ensure > the cache line isn't 'stolen', so apart from possible slight > delays on another cpu that gets a cache miss for the line in > all makes little difference. > The cache line miss costs a lot anyway, line bouncing more > and is best avoided. > So is there actually much of a benefit at all? > > Clearly the try_cmpxchg help - but that is a different issue. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1= 1PT, UK > Registration No: 1397386 (Wales)