Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2654881rwa; Mon, 22 Aug 2022 11:09:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR63Rv45yWte8CSEoOAX4rcyJybflX0d9g46eiAdnAXq3waDMWyhFpp3eM8wPgdjvnQIQUOA X-Received: by 2002:a17:90a:d50b:b0:1fa:e712:704 with SMTP id t11-20020a17090ad50b00b001fae7120704mr18777346pju.241.1661191780974; Mon, 22 Aug 2022 11:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661191780; cv=none; d=google.com; s=arc-20160816; b=QbF6TLtN/mN1ATMd7CmCLHKoXcC6rELslQ2MehBZdmajnDTRTi1n5acxwCK9XOum3I hVXCtSiZjRY19jdvrptRlmZM8Txykg/jy5dJAOWBQ1I8Kcg4Jon0ykoGuNj5ekr0aJJK tGcEGBhuBiHKVHEgP/ADiEev5XNqdrAZ/mvjP5cizZTO+fzx0X05NY4oTNTDRvauAweV SLQkas5z3zHf/uZuekyEKjopxlDxMQ6gvMMoRrjuh0V6YKRNf0qWGO+X0fw/xcYIjlYG EwRtb/Ow97wL1U11BIRTix/PAb75oqS0vu+CnHI8Ynn2kZdqQbHfuS/eL+hAeO1jGdXx VqRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Yy+VCdeRgyIswu0CubtFfhUCsZgH35AGFG4Ign730ws=; b=vsUuwN1v7K/FYGBz7aZ6pP9w5Ow6axAWgIX3sn5cWW3uNwZJKJ55UBbL3ra9+q9WRk I4JUv/oWX/TYm74BRZKx/LhjJHhWT2QJWXjqp1ZtyvKiJpbGtSCfRshoiKCJtf+kXmZI oshCAn7CBDyXCFO3PJO7Dh6H1vTzy5cDxm/dYGh7fFhuAxYXo/ax5rO53u32UnQox3gd +pKm6CJiv2eyiUuV2zIt5sPZfOfM2OmvSdlgNENCrsh22Mnk4MUw0wKXqlzR7nhFSNYJ fP+I6Rv24lqoJOl+HXo2ZaOMhW1SmilPiTrSlJV8nsccqsjlDRLIyhK3zlrFBOjlfCH3 PQ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Mo+5ifl5; 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 m126-20020a633f84000000b0041d35692c4csi13755591pga.281.2022.08.22.11.09.30; Mon, 22 Aug 2022 11:09:40 -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=@joelfernandes.org header.s=google header.b=Mo+5ifl5; 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 S237175AbiHVSA4 (ORCPT + 99 others); Mon, 22 Aug 2022 14:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235716AbiHVSAy (ORCPT ); Mon, 22 Aug 2022 14:00:54 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E0B246214 for ; Mon, 22 Aug 2022 11:00:53 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id c4so8130340iof.3 for ; Mon, 22 Aug 2022 11:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Yy+VCdeRgyIswu0CubtFfhUCsZgH35AGFG4Ign730ws=; b=Mo+5ifl51BAeqfBpFxhVxm/AfNbeeoQ/9eB5mIIsoaF06OdGvL3SX6o5cyHpgQ3Qfo WG5wV//8QaYLWW+It1muL+YFBS8gqV99Ds2cAn92ukJ/uJ27xOI6q9/lfOx2PJ5jHPLK 26tsZLwQ0HTIcDLjt/RpJbCVcnhkt1FY0i4Jw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Yy+VCdeRgyIswu0CubtFfhUCsZgH35AGFG4Ign730ws=; b=T5IFqqR71rIas8qsF/PMp6cGExvkAyx2P3iYNToSAo8Z4+fqB7KtNNRFH7fCxVs3pS zHMaCibxdIIXhm4Xya/xrE5gHAMWTIybbr8bKFqphMkhZj1ZkWpwLt7jGnEwBajyqSMk stqFpaIC/ORLSIrYaA+hDTGEPuOXWkYNqymIiKFog387bejH3BqWX3v2n8y/u1lsDyzH K3DE05ReboUrRaGwhLULv/o1yzBR5JOWbMwiHdHQSXzUyvhvKmOioHgqD0ClHhfRsOSe wdNIHj5ywjrivPBN9EN1FsW53KiZ3UbsS/QeBNRj+OR8IlWvcPixZcmXeaZXf2NwYgzh Y39w== X-Gm-Message-State: ACgBeo27NR9iqPWnVXwY9qoxQn69FLNMRK3VRD8xwkRR2NrrCZF4hTMC UuOQeLnucdOQhPcb1icurjtxfYy0UluX2uFj6hZDjg== X-Received: by 2002:a5d:9914:0:b0:67c:2039:caff with SMTP id x20-20020a5d9914000000b0067c2039caffmr9087348iol.201.1661191252848; Mon, 22 Aug 2022 11:00:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Joel Fernandes Date: Mon, 22 Aug 2022 14:00:41 -0400 Message-ID: Subject: Re: [PATCH] wait_on_bit: add an acquire memory barrier To: Linus Torvalds Cc: Mikulas Patocka , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , LKML , linux-arch Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Aug 22, 2022 at 1:39 PM Linus Torvalds wrote: > > On Mon, Aug 22, 2022 at 10:08 AM Linus Torvalds > wrote: > > > > So why don't we just create a "test_bit_acquire()" and be done with > > it? We literally created clear_bit_unlock() for the opposite reason, > > and your comments about the new barrier hack even point to it. > > Here's a patch that is > > (a) almost entirely untested (I checked that one single case builds > and seems to generate the expected code) > > (b) needs some more loving > > but seems to superficially work. > > At a minimum this needs to be split into two (so the bitop and the > wait_on_bit parts split up), and that whole placement of > and generic_bit_test_acquire() need at least some > thinking about, but on the whole it seems reasonable. > > For example, it would make more sense to have this in > , but not all architectures include that, > and some do their own version. I didn't want to mess with > architecture-specific headers, so this illogically just uses > generic-non-atomic.h. > > Maybe just put it in directly? > > So I'm not at all claiming that this is a great patch. It definitely > needs more work, and a lot more testing. > > But I think this is at least the right _direction_ to take here. > > And yes, I think it also would have been better if > "clear_bit_unlock()" would have been called "clear_bit_release()", and > we'd have more consistent naming with our ordered atomics. But it's > probably not worth changing. Also, as a suggestion to Mikulas or whoever works on this - update the ORDERING section of Documentation/atomic_bitops.txt too? Thanks, - Joel