Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1384574imm; Tue, 3 Jul 2018 10:09:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeG6fWbPjQLfFjaVblf7/N4sojP2ay3CPm7GAjwI93ecxjuuBS8YR1rj/S6fK11Ti/bTxob X-Received: by 2002:a65:6203:: with SMTP id d3-v6mr17500885pgv.420.1530637781611; Tue, 03 Jul 2018 10:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530637781; cv=none; d=google.com; s=arc-20160816; b=RxktfaND5HpoqLNnyOBn5SNkbewE6DMh+Kn36Z6kOtYppIHmN4V5TPPMLxAV/E9juE bdN8FEOPXQkHbhWt8OSXQ8UF5Tr3p1l7cnoGY3nLfs9aSaZ5nZKJPE+E5UDwf4X7dpcd 4wYwy4X5cZ2AxZmjfFVGRP+YRdosH2gvyKdMPllcOw5MGZ2kYznGDrsmUrlu1ELZc80o p/MxHdhPJADXg2F6nGYd387veKQyx9rAJXhnWboGGwICutcqilHzxFNZKU8Gmc8N9/G+ CcmipKTurn5hk5kq9nmq8yXdoux14DHOsOw6cshqxdK8qH1CzBUlFxW3gJq+SnF7yTL6 AqnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Btgj+Fp1aw0ecYcMPqSZF3pvPjc45wcKuIDXd1bMbeM=; b=yM5poMctdGXNYOuO3X4o3oJanXt07dHrEDy4D06PZMaGWsLnA3DxCDummI3dv7udPB yoIBz8YMQGbERbUn1RVyMMPwclU7nCDqvYZSAWN474hN83ET+1XD/h2rAG/aPqXxqIPM lV02cGRRaV/GWy6XDvPPebPWoPmYL2iJa38SGjkP4X79JZ1io7IT/0IcqAaP5/TUnx+G D9GziXQycARjTBSmpARoVEv7vC1/Cib4fixjIqN1HbiFPMQCDfExRqjQRG+p/sQ9eqOn aYA0wI83F3eQ6Jyzk1+YZZqZr56ngGxVf3KF+13ZH1cKIHF33FpTuEgTcDbcwjMPq9GX uypQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gt6JTKOG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si1467432plk.299.2018.07.03.10.09.27; Tue, 03 Jul 2018 10:09:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gt6JTKOG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934239AbeGCRIH (ORCPT + 99 others); Tue, 3 Jul 2018 13:08:07 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39583 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933677AbeGCRIF (ORCPT ); Tue, 3 Jul 2018 13:08:05 -0400 Received: by mail-wm0-f67.google.com with SMTP id p11-v6so3057048wmc.4 for ; Tue, 03 Jul 2018 10:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Btgj+Fp1aw0ecYcMPqSZF3pvPjc45wcKuIDXd1bMbeM=; b=gt6JTKOGf25CL8ltr40Y5lfXADBTy2C5fQ8SzwcdsmKfTBqAifJjsu9ddbqomrCfMu M9dBqMvyZhZ5G1+6yqkoK1d0nF9p++fLcqAoB5iz+l+CwCty0grOJNdeM1Qlc0uiUqMt lzYQWdJ/JIhXGkF9uqtNm9Q+054vhQyvDMRCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Btgj+Fp1aw0ecYcMPqSZF3pvPjc45wcKuIDXd1bMbeM=; b=GtvxW9mSH6xJpUL6qBEx9Lnq3c3NggMdaNvEGQl4hNf4Sdo3sktf7N+oVZBJua25/D yAtZVvbxc7A3vVAiV4mUQLxt3Fc1WvXVx5FCNLvlqWX5fRXoTD4n+4touHmWvRNR7BZU qYh2CsadZw5IQTHroQYbX2t3XTpeAzB32B3DXNgZLclii8IKAouAmFjKfFja7RH8cEIY /PYApcIEuXJ2fwmiQR6eWR7w+pqk9E0K2TRygoGyrVnhqXDZoLK54gveu96UN0xUIjWd GVeGgzqQJW/U/kKGX6xAkWdzkI0i3uAzoik0TR7R4uN7GawSSx6b6RIpNCZhCeGAHJXw eSWQ== X-Gm-Message-State: APt69E3E2mr5zDEIKb7M5GfrgtH+I5z8epy8KrrXxex7s54yGG5O7qtP +jhw4KRZfyYQl6lKKhba8OXpGg== X-Received: by 2002:a1c:3743:: with SMTP id e64-v6mr8239720wma.63.1530637684471; Tue, 03 Jul 2018 10:08:04 -0700 (PDT) Received: from andrea ([94.230.152.15]) by smtp.gmail.com with ESMTPSA id o42-v6sm4283818wrc.50.2018.07.03.10.08.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 10:08:03 -0700 (PDT) Date: Tue, 3 Jul 2018 19:07:57 +0200 From: Andrea Parri To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Will Deacon , Alan Stern , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Jonathan Corbet , Randy Dunlap , Matthew Wilcox Subject: Re: [PATCH v3 2/3] locking: Clarify requirements for smp_mb__after_spinlock() Message-ID: <20180703170757.GA3251@andrea> References: <1530544315-14614-1-git-send-email-andrea.parri@amarulasolutions.com> <1530629639-27767-1-git-send-email-andrea.parri@amarulasolutions.com> <20180703153910.GZ3593@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180703153910.GZ3593@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 03, 2018 at 08:39:10AM -0700, Paul E. McKenney wrote: [...] > > + * smp_mb__after_spinlock() provides the equivalent of a full memory barrier > > + * between program-order earlier lock acquisitions and program-order later > > Not just the earlier lock acquisition, but also all program-order earlier > memory accesses, correct? I understand: "but also all program-order earlier memory accesses program-order before that lock acquisition(s) ...". Yes, but: - I considered this as implied by the above (L ->mb M2 and M1 ->po L implies M1 ->mb M2, where M1, M2 are memory accesses and L is a lock acquisition); - my prose abilities are limited ;-), and I was/am unable to come up with an (to me) acceptable or readable enough way to make it explicit; some ideas? > > + * WRITE_ONCE(X, 1); WRITE_ONCE(Y, 1); > > + * spin_lock(S); smp_mb(); > > + * smp_mb__after_spinlock(); r1 = READ_ONCE(X); > > + * r0 = READ_ONCE(Y); > > + * spin_unlock(S); > > Should we say that this is an instance of the SB pattern? (Am OK either > way, just asking the question.) I don't think we *should* ;-), but I'm also OK either way. Andrea