Received: by 10.223.164.202 with SMTP id h10csp1064987wrb; Wed, 15 Nov 2017 12:33:54 -0800 (PST) X-Google-Smtp-Source: AGs4zMbrs+ZGEbVLfbLcm3EKCEFD0c+k6zuhfYEjYb2eN+vK+wHQf35pKVmWMttZU7Xv9mjk30rF X-Received: by 10.84.210.66 with SMTP id z60mr17345246plh.168.1510778034292; Wed, 15 Nov 2017 12:33:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510778034; cv=none; d=google.com; s=arc-20160816; b=FWLy1unuEBLqmJiYcEaduPeqiFyb0ub9ySx6JbU70tBCXauMAabbOJ3BA1Qj80iyQi hNyYY0v75YVmXn1uMatTOZjXv5xH0Kk/czgsc57bIMPClCZKJa9chZxFSksMBMVbQoA+ rj2Kmbp6tTNNuYyOGOBAtEm1qB9m0yycmPO4Kv4UYWaU2vAVQQnLQS/QMlBPesq+clAg 37377vPp32Lek+4YNb87d74tYNokj5Xgw48WVvBC3FYEis+bbf99BmbL/KjVV7cZ+i4S eApk1jqrkxtoKsw6T7EHCane7UgsnBOsDS+augs4t3x4VO3tqmkEJ/VPCa/SkG6Wr8Vb PjWQ== 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=kpQPwOv5NYzBYFqgkQKj+0C06LSpQMSjqsXtUkMV9nc=; b=mVEijsO0BxhO21/3V4QxIfXkfG/q7n0OgSQ315Ccs+fYOgooYt/BwID4nYSiPquVuV AD/vtPyG+Y0/Uyb0fp9htXx6mvdZ7d7jjW/zDvoMTkpd+ozTyDDUfVcbvYIw2bGrevXC 7HBTDBYEFvX2kwrsaBTZjhgCHp4nhtXFtmJgMJWdjddTsz084l6TyIHZkQhF8H4TIwce 9nszEumMaudIBeauRx3Uwia6JBFMFW/nlaL8pw38Ih4OUb9HJFwo3x/9YyGPuztj9CXx uI2W4vKFyVF6QnHLiLZb++GZ6wWwkaH5ph23pUbFiahwGjxy14f3gvTVlK+evqhPXmVT 2sEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RotR0Iy1; 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 g1si18437601plb.462.2017.11.15.12.33.41; Wed, 15 Nov 2017 12:33:54 -0800 (PST) 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=bombadil.20170209 header.b=RotR0Iy1; 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 S1759349AbdKOUDY (ORCPT + 89 others); Wed, 15 Nov 2017 15:03:24 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:35897 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755702AbdKOUDR (ORCPT ); Wed, 15 Nov 2017 15:03:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=kpQPwOv5NYzBYFqgkQKj+0C06LSpQMSjqsXtUkMV9nc=; b=RotR0Iy1D+YERVqttRiuXLddc n9WlK8hpWS4oRneRs1BNRGrf6dqrl6QZ8C5tHnvhdlzOpKlbIMvmzZ6tHdryJOQqqbAyotB9pCPOf 4IdEMDKdbD5k4CVdQkZL1xCV1THGnpkjdjn0MrmvTenYFDjbO3kMdFM6Dibh2j7reMCyba7GB7DZl LgotMnsOO4UH1e2EjNQhYZBr7vdtyB7J4wnrTUkr4+/kRwomO1ROrd1IPxKGrHz/VQWOuxRp+jOps A6U/9aU4fEP0+XsM2mAdL2Yz6eZzlzE9nyQFP0FedNRyxw8xmxSww7X/jhxToeliEIcJu4LjPXdPR FT22o9Ypw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1eF3tu-0003bP-By; Wed, 15 Nov 2017 20:03:10 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0A70120298D03; Wed, 15 Nov 2017 21:03:08 +0100 (CET) Date: Wed, 15 Nov 2017 21:03:07 +0100 From: Peter Zijlstra To: Alan Stern Cc: Will Deacon , "Reshetova, Elena" , "linux-kernel@vger.kernel.org" , "gregkh@linuxfoundation.org" , "keescook@chromium.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "ishkamiel@gmail.com" , Paul McKenney , parri.andrea@gmail.com, boqun.feng@gmail.com, dhowells@redhat.com, david@fromorbit.com Subject: Re: [PATCH] refcount: provide same memory ordering guarantees as in atomic_t Message-ID: <20171115200307.ns4ja7xjwhunen65@hirez.programming.kicks-ass.net> References: <20171115180540.GQ19071@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 15, 2017 at 02:15:19PM -0500, Alan Stern wrote: > On Wed, 15 Nov 2017, Will Deacon wrote: > > > On Thu, Nov 02, 2017 at 04:21:56PM -0400, Alan Stern wrote: > > > I was trying to think of something completely different. If you have a > > > release/acquire to the same address, it creates a happens-before > > > ordering: > > > > > > Access x > > > Release a > > > Acquire a > > > Access y > > > > > > Here is the access to x happens-before the access to y. This is true > > > even on x86, even in the presence of forwarding -- the CPU still has to > > > execute the instructions in order. But if the release and acquire are > > > to different addresses: > > > > > > Access x > > > Release a > > > Acquire b > > > Access y > > > > > > then there is no happens-before ordering for x and y -- the CPU can > > > execute the last two instructions before the first two. x86 and > > > PowerPC won't do this, but I believe ARMv8 can. (Please correct me if > > > it can't.) > > > > Release/Acquire are RCsc on ARMv8, so they are ordered irrespective of > > address. > > Ah, okay, thanks. > > In any case, we have considered removing this ordering constraint > (store-release followed by load-acquire for the same location) from the > Linux-kernel memory model. Why? Its a perfectly sensible construct. > I'm not aware of any code in the kernel that depends on it. Do any of > you happen to know of any examples? All locks? Something like: spin_lock(&x) /* foo */ spin_unlock(&x) spin_lock(&x) /* bar */ spin_unlock(&x); Has a fairly high foo happens-before bar expectation level. And in specific things like: 135e8c9250dd5 ecf7d01c229d1 which use the release of rq->lock paired with the next acquire of the same rq->lock to match with an smp_rmb(). From 1584156992637428500@xxx Wed Nov 15 18:17:17 +0000 2017 X-GM-THRID: 1582046402032606032 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread