Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1604181imn; Sun, 31 Jul 2022 13:57:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGGyREslDlqq3d1Aw780uHYJ6IwOdA5URljGQws96pi2yFjieaX+0LiZVAAkBSQp+tXTIB X-Received: by 2002:a05:6a00:1410:b0:528:5a5a:d846 with SMTP id l16-20020a056a00141000b005285a5ad846mr13394387pfu.9.1659301077467; Sun, 31 Jul 2022 13:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659301077; cv=none; d=google.com; s=arc-20160816; b=CPOdPbYE6MynG1hPIgl8az/VgP3KGRfhIOZTUlXxccl3nyfbJzDnAvzW0xL1vjrIEX mQ5sfNZGF52hY72frNmchc62hec3c+OyXjto4ORd0yWQFaG9kjp8cY/3mwexxk4vHlo9 Vh//TUsbGRmIjnxFIBtlDFzxZmizZQnIhjJJdg5IatXIPCWDS2PmwkybdCHFJZUXSnYp d6J7GImVr2/ZltJV+8KPfR6eG+j+FwsiNI54qT/cnUJRKOBxTTrUQVRIUuf/TEoKMKwz n92fwZDaKlbhGgh1Y8zxYdC5K2iYy9FQeFeP6NbWI/uzRwZE6JndKUlOxjDxK9uMEux0 Xguw== 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=8udE8uoB93uvyZlPSO/At6OnaISC9AjkEA/Lil/8ZIc=; b=rgbcCUbdYJjAoPci354eH8BNRGTeyIcwkImK5FKXTO2Vp6WTZGzeQn5ZnGxJVb5xbw cHfqf6zP/j+CzriClbtrP3Cz8O/oxwRsLKdyBfKujmZsbNoQWxMxEJPv2o7XUkfqDGFG TZIfTU/ExNWa+SWqH61kIl/2fXKLxQZq6HVSoG+Nrk75CWBtEauw062xEbjHxinbqWaq it/KXtSpWgvV9gTnlQjSRKfBgMiLIzOKWEQsNpMX5WxYpOUNsxFXAbOkQ7pLTcWrRfTi imoMZl+olKEmqbIc0KgOuAbRQTaONWUC08x6yWZnpgn8EC1gbcO9q6agNMpYxq3lo9ik xGOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="RXdA/hhO"; 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 x34-20020a17090a6c2500b001f228297431si15028590pjj.32.2022.07.31.13.57.43; Sun, 31 Jul 2022 13:57:57 -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=@linux-foundation.org header.s=google header.b="RXdA/hhO"; 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 S238409AbiGaUyN (ORCPT + 99 others); Sun, 31 Jul 2022 16:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231264AbiGaUyM (ORCPT ); Sun, 31 Jul 2022 16:54:12 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0F7120BA for ; Sun, 31 Jul 2022 13:54:08 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id kb8so2479760ejc.4 for ; Sun, 31 Jul 2022 13:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=8udE8uoB93uvyZlPSO/At6OnaISC9AjkEA/Lil/8ZIc=; b=RXdA/hhOuYtjtLsjICxxWIPOCtIg9FAGmddkvsILWsPwpb2CImUOlXGktmIH0KWcUU Oi+dPDgXdKM3kJUXZa130UlR6HcKO/DW117bkUjTs7cpTnrtBvPipCqXDXhEufsyyWPE KMS5LcZVx0m9S0gYoEn1AX8EQhQAb2kyFXfX8= 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=8udE8uoB93uvyZlPSO/At6OnaISC9AjkEA/Lil/8ZIc=; b=GYPE9pJvAs2DDLlJNKaOXRIWNwlJBBZga/Ym8R26a5jtaWILP/4m9BvP2owb1cFtnX qH3ST9pn7JD9gQsQ0+Ja2b7jH+jhihnRdGOp7LZQk6vK8Q3It78cKeI/Pg94Ec2JqWGk tjepvksIu/RlJhBdpSsxrjyHnnGsDlQ/42y9jma5wrh5kR8m1wdr9aNBwu42dIJDXvNF 2bPHKZX2Tls02aaPkplG85pEeLaaW3rREedz2n8XOcJVZJaadVf6wiQmfx14nNtEBRXk P7L8HYxMnD54MvP32rivgIJrxMTURD3DebV8B1XWk3Ls/6GfE2SM0vRbwOFikrNyP5KN Nxzw== X-Gm-Message-State: ACgBeo3AEPYw/dUOWQx/bdAAnjuXSeUk8Omh7cGiw1u+PXmfCawJ79xV lvWxKS6auKy2sDEYFCDjyMroh0n5Ypznz4TGHO4= X-Received: by 2002:a17:907:1608:b0:730:5ad0:ae1a with SMTP id hb8-20020a170907160800b007305ad0ae1amr4888971ejc.222.1659300847275; Sun, 31 Jul 2022 13:54:07 -0700 (PDT) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com. [209.85.208.54]) by smtp.gmail.com with ESMTPSA id 26-20020a170906301a00b006fec56c57f3sm4486212ejz.178.2022.07.31.13.54.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Jul 2022 13:54:07 -0700 (PDT) Received: by mail-ed1-f54.google.com with SMTP id i13so11479882edj.11 for ; Sun, 31 Jul 2022 13:54:06 -0700 (PDT) X-Received: by 2002:adf:fc02:0:b0:21f:c94:8bda with SMTP id i2-20020adffc02000000b0021f0c948bdamr8351235wrr.193.1659300392079; Sun, 31 Jul 2022 13:46:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Sun, 31 Jul 2022 13:46:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] make buffer_locked provide an acquire semantics To: Mikulas Patocka Cc: Will Deacon , "Paul E. McKenney" , Ard Biesheuvel , Alexander Viro , Alan Stern , Andrea Parri , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Linux Kernel Mailing List , linux-arch , linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Sun, Jul 31, 2022 at 1:39 PM Mikulas Patocka wrote: > > Do you think that wait_event also needs a read memory barrier? Not really, no. __wait_event() uses prepare_to_wait(), and it uses set_current_state() very much so that the process state setting is serialized with the test afterwards. And the only race wait_event should worry about is exactly the "go to sleep" vs "make the event true and then wake up" race, so that it doesn't wait forever. There is no guarantee of memory ordering wrt anything else, and I don't think there is any need for such a guarantee. If somebody wants that guarantee, they should probably make the condition for wait_event() to be a "load_acquire()" or similar. Those cases do exist. Linus