Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1474502imm; Thu, 12 Jul 2018 02:30:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeH9TCTm94Pi3Jg/9uKhz3BPjoyA+P2l3F5gT4zf1gSi+k5ui91VkgyCnxbFHKB/ogW+51g X-Received: by 2002:a65:66d7:: with SMTP id c23-v6mr1375863pgw.427.1531387832005; Thu, 12 Jul 2018 02:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531387831; cv=none; d=google.com; s=arc-20160816; b=ZN3MXf5kMS78XfI7d/d7PNI5zD/pQr7WgZPNz3PMxpaozaxxSitfa/b0QjUiylNB2B gzHHlpBIkLvZVTx1QMzP0MZ6tRaMM1WBjnJU4VIffYRVNkEHbdw5uDNMhRNR3hkSXxIt 3AbWzvs8r3o3b94x8ciWS7KgNkbVBY6fb272+koV+OHTHWRiAgG6Qie2st6FmxxriFLd V14in+FjeJneDDDhRdSm+vA4QiuCG08KqFwVKcw/10eLGFR0UpYdjSHPSZdvqauYciGP YGa8laFEtrd+Tx7BOmouOdJscCerhJ821xtWsK9dmwAEcwZR23DtbWRWkepU3G1Zj+HY BTBg== 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=NdR6VUThs2RqCqKV0PY7nHtFykaa+P3LuZg6Ym7Gy1I=; b=megiKEZPCCdKVuFvF0rCl117hEtvSTIxRZIW1eB5HZ36t5WRMsClfr0LRPsQqMj3X2 0uv5oZbWSY5+7j3DqoOzyPHUIT6khh1O+JEMecmukAdrSVmE8hdirfyCScy79e3a2TBu gXudsPmraCudG90WuLFqZ2/FAALT0Oz0cs87/6TQN77OnVHSLOBic0czChObu6wThXYe RKR4PJHbsbb9WTeQCECejuK5t96N0U9+y9nkXMvTejw417CFOhBPHVVHknLWOL4dbP3O VhkjvVLUNXALzu3FnmSUIY9KVQua0cvHbD5zbx2GnjcKFrYC8LYjFuc3WydhH1iq08Fa Oijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Zn5xlX0H; 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 z15-v6si20919880pgs.570.2018.07.12.02.30.15; Thu, 12 Jul 2018 02:30:31 -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=bombadil.20170209 header.b=Zn5xlX0H; 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 S1726397AbeGLJi0 (ORCPT + 99 others); Thu, 12 Jul 2018 05:38:26 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:57076 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbeGLJiZ (ORCPT ); Thu, 12 Jul 2018 05:38:25 -0400 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=NdR6VUThs2RqCqKV0PY7nHtFykaa+P3LuZg6Ym7Gy1I=; b=Zn5xlX0HgYtaTnt1UGILdtBj8 +EotlMx0kvmP0AwbR50sbu2sWzO/FMNYA0G/XyNeNm9Qd2YJwfp72EnIlrEfhwG+7jpxS3+inQcqN aevoeP1FiX4nV5AFN1U8WmWAW2nuab0Cg9ncnPw36RNbOCQk6dbzHYfgPiy4XOrpgb4HTQI/rfrIZ w3W515j7nvB0beo0YWZdRuZTKolUXCMkNjKy0ljCc6P4seA1XPDcPYnmCSRximc+iS4RYe7hpM9Wi l7e3UyeGFPwMC+hwN6K89ngJaSjs20y1gMsNGpz68asMX/fYye4IuhCyLuuTPA4CqIz0PWTaZajXQ z7Q4m+g8Q==; 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.90_1 #2 (Red Hat Linux)) id 1fdXui-0002ZK-LX; Thu, 12 Jul 2018 09:29:28 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6CCA620291063; Thu, 12 Jul 2018 11:29:26 +0200 (CEST) Date: Thu, 12 Jul 2018 11:29:26 +0200 From: Peter Zijlstra To: Daniel Lustig Cc: Will Deacon , Andrea Parri , Alan Stern , "Paul E. McKenney" , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Kernel development list Subject: Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire Message-ID: <20180712092926.GR2494@hirez.programming.kicks-ass.net> References: <20180710093821.GA5414@andrea> <20180711094310.GA13963@arm.com> <20180711123421.GA9673@andrea> <20180711155751.GC18477@arm.com> <20180711170053.GM2476@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Jul 11, 2018 at 10:50:56AM -0700, Daniel Lustig wrote: > On 7/11/2018 10:00 AM, Peter Zijlstra wrote: > > On Wed, Jul 11, 2018 at 04:57:51PM +0100, Will Deacon wrote: > > > >> It might be simple to model, but I worry this weakens our locking > >> implementations to a point where they will not be understood by the average > >> kernel developer. As I've said before, I would prefer "full" RCsc locking, > > > > Another vote for RCsc locks. The (in)famous hold-out is of course > > PowerPC, but it now looks like RISC-V is following where they I really > > rather wish they didn't. > > That's not entirely fair. We came in wanting to do the "natural" or My appologies then, and I must admit I've not really kept track of what RISC-V ended up doing :/ > "expected" thing: use RCsc atomics where we have them available in the > ISA, and use "fence r,rw" and "fence rw,w" where we don't. > > I would argue that the idea of having data races on variables that are > also protected by locks is equally if not more counterintuitive and > unexpected than the "natural" mapping we had originally proposed to use. > > All the discussion here[1] for example is about having ordering and > doing an smp_cond_load_acquire() on a variable which is sometimes > protected by a CPU's rq->lock and sometimes not? Isn't that one of the > key use cases for this whole discussion? Well, the scheduler locks are on place where I know we rely on stuff like this. RCU is another place where we know we rely on locks being RCsc. The big problem of course is all the places we do not know about. This kernel thing is terribly big and there's an awful lot of clever people involved. Now, PPC seems to have build RCpc locks before we fully understood these things and has since (understandably) 'refused' to go RCsc because performance regressions. But the fact is that stronger ordering is easier on these pesky humans. Also: https://lkml.org/lkml/2016/2/2/80