Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7622524imm; Thu, 28 Jun 2018 06:51:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeRepyeGvTAOKOT0sdlmGTL0lVPmGs4fzTw6It4zaiOv329hesSdQ+3vR4BohrnOXZvK/Zs X-Received: by 2002:a62:8a0a:: with SMTP id y10-v6mr10282733pfd.237.1530193878203; Thu, 28 Jun 2018 06:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530193878; cv=none; d=google.com; s=arc-20160816; b=wU6Ixj1kjopE7HtnR6JEVzy1+IxBBay6To5x7eyCfRXtP43sNJ1oo/b/L/PpfNvkJ4 vlKJDZQEyB+vS5Bwap81FIFJ0lSccbSKz08cT9XiE9yqxEt5ouPoZQhMP7uFxoOene/z vBbo1OYpHL8AnHZeuCSxiNsPqeLQirr1GzzykN1gsOgrtPQu+m29aeQSyO/ou72T6hu1 0rRSgBx/UXm7uMIZyRIpB+TPmYerhvNlVxZAWdI5UYNHYM1LpJ3zg3ZGFcDfjzlc17Dv ESYLR4x+y02wa0/Ul0KXk3y0AIB7PvlQreZUwjD6YNCIzgNbz1G4J9I3PK49p4FuP9MV Cvbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=37jOht0AKqSR8FMkg3Oj/iup1e6k3pp3FQNBUc6h5p4=; b=Xy47H020n/lPKZh8JRABZvxU0C7XKuJBQgq6TxTfi9OtBQRvIqJ5dcfoISWSqTQmrN oEg15H52JDnkXYco6bLGyRzzjD01gcWvBxwYkSe4au2arFmUS6U7F6LfpemSNiRaHQE9 oyjkvN5C6OETgVTRoM/s3Roo5+KFkkGu77DMc/Ku1eFo83nTOvy87jvLENH2m77D+MNR b3xPL5QdS5CrpC6RVqKIXO0IdgmS2CEdAW3cPRg0+0t77KFFmtKqK9gDLKhHqTm23zgh /wNj2M+yVCOp/q8mZh/iVeegiNtbqq+6B0adRDNZMSTCh+osYHAQO7yu6R6kmw35SWOC WJjQ== ARC-Authentication-Results: i=1; mx.google.com; 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 v1-v6si5760589pgf.515.2018.06.28.06.51.03; Thu, 28 Jun 2018 06:51:18 -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; 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 S966289AbeF1NuA (ORCPT + 99 others); Thu, 28 Jun 2018 09:50:00 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:32800 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S965772AbeF1Nt7 (ORCPT ); Thu, 28 Jun 2018 09:49:59 -0400 Received: (qmail 2108 invoked by uid 2102); 28 Jun 2018 09:49:58 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 28 Jun 2018 09:49:58 -0400 Date: Thu, 28 Jun 2018 09:49:58 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrea Parri cc: linux-kernel@vger.kernel.org, , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E . McKenney" , Akira Yokosawa , Daniel Lustig , Jonathan Corbet , Randy Dunlap Subject: Re: [PATCH 2/3] locking: Clarify requirements for smp_mb__after_spinlock() In-Reply-To: <1530182480-13205-3-git-send-email-andrea.parri@amarulasolutions.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Jun 2018, Andrea Parri wrote: > --- a/include/linux/spinlock.h > +++ b/include/linux/spinlock.h > @@ -114,29 +114,8 @@ do { \ > #endif /*arch_spin_is_contended*/ > > /* > - * This barrier must provide two things: > - * > - * - it must guarantee a STORE before the spin_lock() is ordered against a > - * LOAD after it, see the comments at its two usage sites. > - * > - * - it must ensure the critical section is RCsc. > - * > - * The latter is important for cases where we observe values written by other > - * CPUs in spin-loops, without barriers, while being subject to scheduling. > - * > - * CPU0 CPU1 CPU2 > - * > - * for (;;) { > - * if (READ_ONCE(X)) > - * break; > - * } > - * X=1 > - * > - * > - * r = X; > - * > - * without transitivity it could be that CPU1 observes X!=0 breaks the loop, > - * we get migrated and CPU2 sees X==0. > + * smp_mb__after_spinlock() provides a full memory barrier between po-earlier > + * lock acquisitions and po-later memory accesses. How about saying "provides the equivalent of a full memory barrier"? The point being that smp_mb__after_spinlock doesn't have to provide an actual barrier; it just has to ensure the behavior is the same as if a full barrier were present. Alan