Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp81208imm; Thu, 28 Jun 2018 15:19:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLxf5pzaGo0Rk08QmzeOpsF3p8vEKbT9eOBoWxpnxcb1+NpO3YCdaRgj95xjfESVV0HUbt5 X-Received: by 2002:a17:902:650a:: with SMTP id b10-v6mr12351695plk.45.1530224352517; Thu, 28 Jun 2018 15:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530224352; cv=none; d=google.com; s=arc-20160816; b=B1ff/1hu0cK2QPhuvATDYniHriqLclnBo5bBsPbsAGIFYSAI+iV0uXHmwhpov2yZqF nwoKs2pr9BRHRMuWqVIq2m13idfT6HfOVeIQ+PFOq2+mYG6OglTLnTZ3EBp8/8rPszcB rsMgTxe1Jkm3qe0KylzraIl7f2sbB2Hu97ehbgtajcWvU9N8mdES8q7wAM+kycgJfetC u8Xxp68DZtlnHYXtRW8OxQketRGvS/dlQjPkj/YB7EuI8oRz/Q4pg7ChIYqNDoQEjJqv tTyGWJIKl3bhvFJXsRnLhrgITNITWFVEaO/6zK4WKwNOTnP0J7XH37LDMv6/RmdmOtZc 94Sw== 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=YF4vYGoomWMUC7ZOCmAanjHxzwN3WKGDdG0DBFS0cn8=; b=FUYNGOCIRan/5wHNkecYLtVDA+heWpc5reiYIP9MbzG3djcjZiNhij3/qx7e6rs2w4 A/3fh3FB87Sk0zKH1emCY3GeiFtKlK57uxlWguQ7OHhS50kjui5Waq6CZNWEIA3mCufI aWZrQShBMJP1ID3KQjE4g/ciBE4oGQyjRiyC8fAkPCdZGv/gBFTGKu5DA+NFIfKxZi75 T5EMLzx1o9EGb2ZFPBFVeahML9CESJ0+WSp+NJP5gzEm1ZGcPbcjYcoss6f4WhR1vgFZ dVl0UcIbgRRzdwOID9ilfFPzQcrGcBXjBSSsHm8fsvCdPlhdXyq0GgdxYskVRkykPBpB jBwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ITYvi8Vs; 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 a3-v6si6300646pgw.292.2018.06.28.15.18.58; Thu, 28 Jun 2018 15:19:12 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ITYvi8Vs; 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 S967003AbeF1PGY (ORCPT + 99 others); Thu, 28 Jun 2018 11:06:24 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40964 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966685AbeF1PGX (ORCPT ); Thu, 28 Jun 2018 11:06:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YF4vYGoomWMUC7ZOCmAanjHxzwN3WKGDdG0DBFS0cn8=; b=ITYvi8VsiwUKq1c3LJMfsqzGz JAUcbgbhjelhgn4/iuzRZYgSmAY4jHHKZn7Ij70jC/HlikXf0eYkHHk72QGTFiYiYPRxzlugGrxtd PiMk2pU5CsycPFI4odCEvV5+hs/dsE/pKDHZ49qc3avfoUrc0+BNV5xPzf3T0CDfPp0HpZ1vl/he8 ooyY5q1Ccw5/cbOFf0faHyFR1n1OTP4UojuL/vRnI+KvtD7WAnRza4fhA5N1JyEoebcHYV1N+kar/ zGZ6JhPmPr9APSkkL111NI1GR/VRBahPF9VZOxaLMkzMiLtMhK/CiwTw2aLR5IahITbq4YsZqZIiF DZtm448HQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fYYUb-0007dx-As; Thu, 28 Jun 2018 15:05:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A8B1020289CA1; Thu, 28 Jun 2018 17:05:50 +0200 (CEST) Date: Thu, 28 Jun 2018 17:05:50 +0200 From: Peter Zijlstra To: Andrea Parri Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Ingo Molnar , Will Deacon , Alan Stern , 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() Message-ID: <20180628150550.GI2494@hirez.programming.kicks-ass.net> References: <1530182480-13205-1-git-send-email-andrea.parri@amarulasolutions.com> <1530182480-13205-3-git-send-email-andrea.parri@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1530182480-13205-3-git-send-email-andrea.parri@amarulasolutions.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 12:41:19PM +0200, Andrea Parri wrote: > - * 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. Please don't remove that; that explains _why_ we need a full memory barrier here. If anything, move it into __schedule() to explain the smp_mb__after_spinlock() usage there.