Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4828201imb; Thu, 7 Mar 2019 01:16:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwQ/b373NKsE9Ybf2WUYD33g4Efo5SNjoVsY/sdx7uJ19R4W9XV2A6ZxHB8hJEPTe2kdRnp X-Received: by 2002:aa7:92da:: with SMTP id k26mr11902066pfa.216.1551950184447; Thu, 07 Mar 2019 01:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551950184; cv=none; d=google.com; s=arc-20160816; b=x+gEYs1b7nD+gwZJLggPX+t3ATNP1xJHSltaVZaK6uXo9Tb8eoiagEeiM0HjMW+HRT 6V3Pub9FUIvPphGRFAYbkq67AVkz50Qguw7VHL8MNrPaAEScywwzSYnWNG0Gt6SE+ix6 K+P1iFzud1P8LqunKgim4iTZHp5XjrDxUriTAOMh5/lopoQbtfwzN60gM6lwqF2aYzaA lvTGq9VBFJu3/kfLxS7oeeKmiXaknAgr3rw2sROXaImuZZTiL5oDEJZSCfVRkOx8URa+ RTmCkhQ1sLNTzqjyb/Vwt4kdZOksCk7ofr9BFDwe8suHTzwrWJd8E4o3mau70tafuTtk 2jTA== 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; bh=k4aaE8VpuibnJfq/I5hDYDrBFPhgCTiTGp/rbN6c6/8=; b=DCFDtitoPc3IHEmsCOpzrU+qxwuOSubfsIGQ7gV1lVoC0Ebt1vzjx5CMc8TqiuCvDv BTtk094SbD7/8kc7H7DEafya0E4dgafZCl2Fv5WQp7F40tlZe0L5Aog0NgWJf/G7TWje cbmRkSkzl6tpDA3Yo9xZSianMKlfI8yRRAc1juFcsF96Ok0sc5SryflflSuOe8y8E8nW uiWF2nyvI8dsMutqiVeYO5t963mPETFzeWbrQKPD7EIwlOrDDnOCjfQnWeeM3+FNLmJr 8jNHi7oH6U40IDywz6GxqkTHSZsbxSGPON7t+zVmRMYngh4JhWy+jBfe1svTfBgz0Q5L ZANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=m7IeWrsr; 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 y21si3775213plr.25.2019.03.07.01.16.08; Thu, 07 Mar 2019 01:16:24 -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=merlin.20170209 header.b=m7IeWrsr; 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 S1726283AbfCGJOS (ORCPT + 99 others); Thu, 7 Mar 2019 04:14:18 -0500 Received: from merlin.infradead.org ([205.233.59.134]:49854 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfCGJOR (ORCPT ); Thu, 7 Mar 2019 04:14:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=k4aaE8VpuibnJfq/I5hDYDrBFPhgCTiTGp/rbN6c6/8=; b=m7IeWrsrCQ8hWXZpRb9v2uyh4 BEfw7G09xwMoJWRQ87vCSq5zS3FQOZ+mV0T1Q6Z3YPICstvnSw1m5gB14ULANsJKEg7gnX2GChItk 3Oss3YuGO4I923amhFW+r6P8HDlPF1fmd3bi82pU46Mwus3EfFpm95X/Qd78FhrJaIaRnQtdcRgeb N5Jo5IbWjvlT3ydD04b8PkRYPy6pNx6rL/rdzks/1MeEJvL99QrtX334v36LeWLNaVxSHSHUwkAF+ Yc1POZt1PB0ytf9r+uR6RLjeVLwHiU58RdYSzM54OUb0PM2T4KOYSm5dQYrGhLIvOqkrVozeTbZCy zsezRF/sA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1p5c-0004SU-Qd; Thu, 07 Mar 2019 09:13:21 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 36E0F2029B186; Thu, 7 Mar 2019 10:13:18 +0100 (CET) Date: Thu, 7 Mar 2019 10:13:18 +0100 From: Peter Zijlstra To: Michael Ellerman Cc: Linus Torvalds , Nicholas Piggin , linux-arch , Will Deacon , Andrea Parri , Arnd Bergmann , Benjamin Herrenschmidt , Rich Felker , David Howells , Daniel Lustig , Linux List Kernel Mailing , "Maciej W. Rozycki" , Ingo Molnar , Palmer Dabbelt , Paul Burton , "Paul E. McKenney" , Alan Stern , Tony Luck , Yoshinori Sato Subject: Re: [PATCH 01/20] asm-generic/mmiowb: Add generic implementation of mmiowb() tracking Message-ID: <20190307091318.GA32477@hirez.programming.kicks-ass.net> References: <20190301140348.25175-1-will.deacon@arm.com> <20190301140348.25175-2-will.deacon@arm.com> <1551575210.6lwpiqtg5k.astroid@bobo.none> <87ef7n7x9v.fsf@concordia.ellerman.id.au> <87k1hbv7ba.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k1hbv7ba.fsf@concordia.ellerman.id.au> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 07, 2019 at 11:47:53AM +1100, Michael Ellerman wrote: > The mutex unlock fast path is just: > > if (atomic_long_cmpxchg_release(&lock->owner, curr, 0UL) == curr) > return true; > > And because it's the "release" variant we just use lwsync, which doesn't > order MMIO. If it was just atomic_long_cmpxchg() that would work because > we use sync for those. > > __up_write() uses atomic_long_sub_return_release(), so same story. As does spin_unlock() of course, which is a great segway into... my RCsc desires :-) If all your unlocks were to have SYNC, your locks would, aside from ordering MMIO, also be RCsc, Win-Win :-) There is, of course, that pesky little performance detail that keeps getting in the way.