Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp43368imm; Fri, 6 Jul 2018 13:38:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcCE8cPqoUobZkhB0NsqjuERyLc357pAubqRsbEbIbCPKZ7OeR0ZoxWT8sewDOHpeX8bdPo X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr11493057pla.325.1530909500164; Fri, 06 Jul 2018 13:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530909500; cv=none; d=google.com; s=arc-20160816; b=DN7SWPOxxFZrSjc4HVniPHfQ8yAMSbWsAyfbMlI6/3gXNbP8wrqNqay777Y4OOzyuG ExFI7VUrMs8dviNY+Cun0vTAiOh3oQnq9q8S7t8D4R0ifCkgAI1DTr5zo7fRzzZkOd1k nCCxHQLY4CtdNL6mo8I47bMf50kjLbTVzAPEkr0M+vZeVz3GOt9mDqoqL5rrNxScr8LF p8yZ+p1lj8hQWAj1w/DcNVr3nNzV5mKULVJoAH0H8lu8Gd40dcOk6CkcWTlwHbHHYqT7 32NkpR+0FvemYqcVK561RXL51IiK85jjQvlq0wLzA0rATVl8oV1cKTrSZMEcqEpbuMeI GwOw== 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=HFm7KOwd3M5qZCInsvxcvO5yK+1rIpxScWTRDfcrDsI=; b=lBCJsk9RTXtJ6tRGDtFHXT9vCHgPCPMt3kGAb2NPPPfXcQ8Fb0gcjwpimTMSAJr11j D/tst0uRvv9YIkkITY5LYLeiWmdbvIC4T/VZ6leBwDtnyCvLpFICUrYY42YqXlwkoV22 CImDfiBQitetrUcaTVyj2+67P61akBJxjiJN1uAeg56fPLDcrajLTmM73s5jkBRjzYCF I0eAUF6pWmYR/ujeRDq2n4+011FVb8Et6irLhEg4Itpk3y1x1vJOfSnnxsd9IEx46qIY +DnNi/2Vf/aVrVps6LVavdzZQFesyCynzJcL2Ufk7uMv+QmNc+GpZQBZD65F0mIPtPC2 w6VA== 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 v16-v6si8837069pfm.341.2018.07.06.13.38.06; Fri, 06 Jul 2018 13:38:20 -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 S934140AbeGFUhX (ORCPT + 99 others); Fri, 6 Jul 2018 16:37:23 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:38216 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S932884AbeGFUhW (ORCPT ); Fri, 6 Jul 2018 16:37:22 -0400 Received: (qmail 4838 invoked by uid 2102); 6 Jul 2018 16:37:21 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 6 Jul 2018 16:37:21 -0400 Date: Fri, 6 Jul 2018 16:37:21 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrea Parri cc: Will Deacon , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Kernel development list , Subject: Re: [PATCH 2/2] tools/memory-model: Add write ordering by release-acquire and by locks In-Reply-To: <20180705150945.GA3699@andrea> 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, 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? Alan