From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3F3CC4338F for ; Thu, 29 Jul 2021 08:25:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9451160FD7 for ; Thu, 29 Jul 2021 08:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235124AbhG2IZo (ORCPT ); Thu, 29 Jul 2021 04:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234795AbhG2IZo (ORCPT ); Thu, 29 Jul 2021 04:25:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 862DEC061757 for ; Thu, 29 Jul 2021 01:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pVhr7FGv/KVWDE9CUy8/SrPaJWr9SXesJ8dnccwOHB4=; b=p+GoH660uVuZYkJPhp9/5iIU+W rNepabxkjLhSXDBcUmCW7OSpMfqkfQ7n5oXPEX4zi3P9HUq3pypD7JjKD01kYb+xDrv5ruK2IQEAe LFZW2jb2vNb6MpoOf0iaXfKV0Sc7K+1S3VuFV14Caif62XY5oxSuqMrtT9lLpJQyS0D974EaJHdJE hFHOm4MUrQB7E/Xo4pCfw6ZEF6j1T6VWXDuDiH7yAufD9OECMaJ1On9y9nYzeM3fXJJlH9iNIA2ko NGfFogvdn/Dtqv7w2ZxoZCqxGnQcLjXQrMNQgk4pi+VE7KP5k0wODrvHBPeUvI+tToBEs7dUSayL/ 6RaDcDzA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m91KB-00Gsvd-1P; Thu, 29 Jul 2021 08:23:42 +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 (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 342D530005A; Thu, 29 Jul 2021 10:23:23 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0F32D2028E9B4; Thu, 29 Jul 2021 10:23:23 +0200 (CEST) Date: Thu, 29 Jul 2021 10:23:23 +0200 From: Peter Zijlstra To: hev Cc: Rui Wang , Ingo Molnar , Will Deacon , Arnd Bergmann , Waiman Long , Boqun Feng , Guo Ren , linux-arch@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen , Mark Rutland Subject: Re: [RFC PATCH v1 1/5] locking/atomic: Implement atomic_fetch_and_or Message-ID: References: <20210728114822.1243-1-wangrui@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Thu, Jul 29, 2021 at 09:58:02AM +0800, hev wrote: > Hi, Peter, > > On Wed, Jul 28, 2021 at 9:21 PM Peter Zijlstra wrote: > > > > On Wed, Jul 28, 2021 at 03:16:54PM +0200, Peter Zijlstra wrote: > > > On Wed, Jul 28, 2021 at 02:58:35PM +0200, Peter Zijlstra wrote: > > > > The below isn't quite right, because it'll use try_cmpxchg() for > > > > atomic_andnot_or(), which by being a void atomic should be _relaxed. I'm > > > > not entirely sure how to make that happen in a hurry. > > > > > > > > --- > > > > > > This seems to do the trick. > > > > > > > Mark suggested this, which is probably nicer still. > Wow, Amazing! so the architecture dependent can be implemented one by one. Nah, this is just the fallback, you still need individual arch code to optimize this and get proper LL/SC primitives.