Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp746095imm; Mon, 9 Jul 2018 09:52:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/Qv8Dpmm2zW2Mv7sPeDSLhEDW7BoBNSRi8U4j6J7v3ubClbfjCaLGTyC/mIZT1AtyFGoV X-Received: by 2002:a17:902:ab8e:: with SMTP id f14-v6mr21678452plr.5.1531155142304; Mon, 09 Jul 2018 09:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531155142; cv=none; d=google.com; s=arc-20160816; b=nr1PyDkI5Qpqw2qnDJPrCBlRksV/xWzTN/Bd1L8EfmmmXO8A6wUX6y4XfeetcNVck5 ili+IHJQ78ZK9mdQyDfN1supTV/dZii0/VeXtD4OkNEcDzNKhbWoY1QEyfe8j+eFVM/O moDmHGYMNmrxGMeOnTImPNv8aM7rj2MEp3bW84/l+GNFMpD28T4z4SqLVV0oDem3Vs0z oh8Q8yXCdRwpSkgJWajHKULkWaGTmd+waSbLDaDcd1lWWbzwvmhCvsNLLgSSzz8zOYYD lCqhuWRCoIP2Ksc5mrTJw4HSnZQGNCW8LR8Xt0J/3t47OAgz9o546IBDpE5k35DWOQAf qeCw== 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:arc-authentication-results; bh=sBaHKpDjtV9LLtyEEHVRbxvSsTdz6dRxwBY0P6Un7uI=; b=i7JBXMSMfp8j0CMeoK40oM/CU9NFehtoqKzpYViIh1poBIU2sIIR3ujO7LOBJhwcFX DdHZB3mHl3Hf5xlAMM1/KQ0oljQHmQLX9/CP/3Pah4XkKBPkTbByaRVrJiEh91HtGjAl nadx0MnpOM4yIZxqyZcwM5qPyvqGmX1UNLJFzlGYjPyYg7RkouW5LUtJzvkzfddi4nzz Tf0rBRCsltHCgCSWIAKXtg+PkWn2XMxr3nfmKCTLjWTbIFGrDoWObKMvpaxrypmq2ajG I0mybCbraKbmm4yOXU2ZBPgZ7+Cptpp97OdaWlAa9wS490SeH2FacNmbI3lTn3PEa4vS sYDQ== 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 q4-v6si14867726plb.251.2018.07.09.09.52.08; Mon, 09 Jul 2018 09:52:22 -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 S933574AbeGIQvV (ORCPT + 99 others); Mon, 9 Jul 2018 12:51:21 -0400 Received: from foss.arm.com ([217.140.101.70]:35132 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933433AbeGIQvT (ORCPT ); Mon, 9 Jul 2018 12:51:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A3837A9; Mon, 9 Jul 2018 09:51:19 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5BDDF3F589; Mon, 9 Jul 2018 09:51:19 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id D59FF1AE3B14; Mon, 9 Jul 2018 17:52:00 +0100 (BST) Date: Mon, 9 Jul 2018 17:52:00 +0100 From: Will Deacon To: "Paul E. McKenney" Cc: Alan Stern , Andrea Parri , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Kernel development list , dlustig@nvidia.com Subject: Re: [PATCH 2/2] tools/memory-model: Add write ordering by release-acquire and by locks Message-ID: <20180709165200.GA4689@arm.com> References: <20180705150945.GA3699@andrea> <20180706211055.GN3593@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180706211055.GN3593@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 06, 2018 at 02:10:55PM -0700, Paul E. McKenney wrote: > On Fri, Jul 06, 2018 at 04:37:21PM -0400, Alan Stern wrote: > > On Thu, 5 Jul 2018, Andrea Parri wrote: > > > > > > At any rate, it looks like instead of strengthening the relation, I > > > > should write a patch that removes it entirely. I also will add new, > > > > stronger relations for use with locking, essentially making spin_lock > > > > and spin_unlock be RCsc. > > > > > > Thank you. > > > > > > Ah let me put this forward: please keep an eye on the (generic) > > > > > > queued_spin_lock() > > > queued_spin_unlock() > > > > > > (just to point out an example). Their implementation (in part., > > > the fast-path) suggests that if we will stick to RCsc lock then > > > we should also stick to RCsc acq. load from RMW and rel. store. > > > > A very good point. The implementation of those routines uses > > atomic_cmpxchg_acquire() to acquire the lock. Unless this is > > implemented with an operation or fence that provides write-write > > ordering (in conjunction with a suitable release), qspinlocks won't > > have the ordering properties that we want. > > > > I'm going to assume that the release operations used for unlocking > > don't need to have any extra properties; only the lock-acquire > > operations need to be special (i.e., stronger than a normal > > smp_load_acquire). This suggests that atomic RMW functions with acquire > > semantics should also use this stronger form of acquire. > > > > Does anybody have a different suggestion? > > The approach you suggest makes sense to me. Will, Peter, Daniel, any > reasons why this approach would be a problem for you guys? qspinlock is very much opt-in per arch, so we can simply require that an architecture must have RCsc RmW atomics if they want to use qspinlock. Should an architecture arise where that isn't the case, then we could consider an arch hook in the qspinlock code, but I don't think we have to solve that yet. Will