Received: by 10.223.164.202 with SMTP id h10csp1245752wrb; Wed, 15 Nov 2017 16:06:13 -0800 (PST) X-Google-Smtp-Source: AGs4zMayXa11MMTypCyVZ2ZKSv/c+XaoRNhgXNvA4ZaAN8C2Nvg62NqcId9NtkZkvj/R8LbVxp70 X-Received: by 10.99.67.71 with SMTP id q68mr17511268pga.163.1510790773671; Wed, 15 Nov 2017 16:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510790773; cv=none; d=google.com; s=arc-20160816; b=DeqCzbTFLVVamVFyc3A2Q0RnDkmMCkMCz5J9veCnPZNgRz73p6C0FIrMjZmi4wAO8t ZvsxcHhZKT4fPTlXGfy0tSpwEqg7ndNzPAHsLk/AzaGucTD6iuUVPylC2DgJBefDEyzo CLY95xoDh6N6y7xTwqdBFhH2FJS8kEt/EnClb5ATMEfM8FnJEIxqt8GP/SMWiIjRizbk dvQZosPNaGcecGvdY9A6DrSV1x/585wDKY9vqIqzVkz/H4yZ9tk580fbzhobFefxPpBT CJzBXcfBtNrD4p8q8ucTDuPVKWC4jrPMXwxIpKFdyy8idl9SHt9f0IctihnrqIWnkSU9 HEjA== 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=KfbwEyowsoncp5PJew3vkXRTzyxlEA6ePpVWxJ0qD1Y=; b=mebitYAQITyKUNjx1vusmCEDytLT1E5mL5NQ6ysZMN1pCvHmVcnKcKLzDNdn6UIKK5 lnPGAaNoJo4wfE1uSXV2pICaMFQjDdESKJnXLjd2oHq1bo2pJ+mQj9D5K6teurxedfEW GIvRtR/7bcF8dapQNJxKfwc2RR/ayqZ86pLLovPtiAduUWw/N/Z44Xu6Cpvrwzx05wPe mOwyUspajvbFZ6ThZ2isid2fDjs7/AdfMn/yQMZIcoJW3hG0RS0qDcgGJPdxODSl7CeH oOPa4oWFmRVIEcqmMuld3rYUoYxUC30NKqE8CzfqvSRsOudaXWHtMvWO/Dpz4sN+8+4+ cl2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bA13/2Xt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si17907050pgq.757.2017.11.15.16.06.00; Wed, 15 Nov 2017 16:06:13 -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=pass header.i=@gmail.com header.s=20161025 header.b=bA13/2Xt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932387AbdKOVBc (ORCPT + 89 others); Wed, 15 Nov 2017 16:01:32 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37924 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934236AbdKOVBU (ORCPT ); Wed, 15 Nov 2017 16:01:20 -0500 Received: by mail-wm0-f68.google.com with SMTP id z3so5564595wme.3 for ; Wed, 15 Nov 2017 13:01:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KfbwEyowsoncp5PJew3vkXRTzyxlEA6ePpVWxJ0qD1Y=; b=bA13/2XtSubWX9W6zxHliWKPooKbbUpBAeCiGVpsPZm4kWSsVI3VpkqnM9KAIPxIab 5yySRmmcPljIJLyVUq30Fjo7Ll92maQZWBhm1GEgHeVRBJTBnT7iLbHtKeRQ/sfiuuf9 sSsV5G962yLKihf8usM3RrEKCaDkqn6BPwcPDl313bqGewc2TbFKMB+7laxFu8887sCs dfhBMwkgLDWJMtTyt3gFHnIhkU2JiUQOEbB67PuGX81YAJA0YSBNCw0jfIl64NGiYEI9 Ujp+f1vwEb/OSOaC8S/xo7P6gRmcdGmTUAEWI5CrHIHreAh1UVZCg9C4oFUgwmIFk9Ni dhjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KfbwEyowsoncp5PJew3vkXRTzyxlEA6ePpVWxJ0qD1Y=; b=bbX4AKugSLP7mGAeFkVFDiSXwiCNW8gYS4g656nya/d0qNnGr0QiWnEpOJqN2/zitn InAji5bmP2xEx82z3KV547Uh7L3ekE4NiI3IIDVhE3lXpYUCy78vmhSKix2wAbScvbq5 hzNdoxFgjdZJRuGLhdcbDJe60HYQfIIh7iv7iAj3H/B4Hzaj8KWasI+G7IBaxaIThua2 p3YApK9JR6PIhnm+ZYhFmwlHUV93+iuHLPir1A8VZ8ZniSExXukkM13IyH1R9MmQtFsU aFu1Ei+dn9VSttB1WRzeMOACYPbbYRSuTqz6H+NXeKb0QeEFBTU+Fw/TTiUG5RmG88Zi yJGQ== X-Gm-Message-State: AJaThX7CqPiyXeHupTyLc645OXXwzB3eL1Z3rJ7K7stQCEVMfDIPOqCs 6xjMBaYfSzmuGKZlnlkxwgs= X-Received: by 10.28.152.212 with SMTP id a203mr8155346wme.131.1510779679192; Wed, 15 Nov 2017 13:01:19 -0800 (PST) Received: from andrea (host10-10-dynamic.49-82-r.retail.telecomitalia.it. [82.49.10.10]) by smtp.gmail.com with ESMTPSA id 12sm12478830wmn.1.2017.11.15.13.01.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 13:01:18 -0800 (PST) Date: Wed, 15 Nov 2017 22:01:11 +0100 From: Andrea Parri To: Peter Zijlstra Cc: Alan Stern , 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 , 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: <20171115205823.GA2608@andrea> References: <20171115180540.GQ19071@arm.com> <20171115200307.ns4ja7xjwhunen65@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171115200307.ns4ja7xjwhunen65@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) 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 09:03:07PM +0100, Peter Zijlstra wrote: > 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(). Those cycles are currently forbidden by LKMM _when_ you consider the smp_mb__after_spinlock() from schedule(). See rfi-rel-acq-is-not-mb from my previous email and Alan's remarks about cumul-fence. Andrea From 1584176066013370178@xxx Wed Nov 15 23:20:26 +0000 2017 X-GM-THRID: 1582046402032606032 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread