Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2855139imb; Mon, 4 Mar 2019 16:22:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxlBHR5Lm0F8Wlmvp7A9oxbbCOmGzgL8CnrNTUNpBg6UjMZwWj8eRSFOTS9YkKgNbJwjrul X-Received: by 2002:a63:d205:: with SMTP id a5mr21152357pgg.142.1551745330835; Mon, 04 Mar 2019 16:22:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551745330; cv=none; d=google.com; s=arc-20160816; b=DpUl3ENOeyPx15uLDODM2w2t7vkPTTIT6h0f8B8KLKWgaHarZUF/Ts4vYvNAHVNieC slZvF1NKl4LpF6VSp2FhNMg9I6fiHfY5XrOK3JqN648qO+bduj38sw5LNUQqcaWdiWel xzESMSukHUNWOdB5p+/Tj5wk/E7W4Wgd0x+y2whA1Puv5bWdIcmFN/XIcYbOk9gP48CV UidLOgLwZWp4EQGvcqeQlzki7VfyfpQDZ+aL+wkRDEeSEd/oBXecPLly+8X10WUEZdLH 8kEY4POfgA9VCY87MA1+dLBhz8spwqpJq7IAeSI2BnMrO8L/dXc0oIDZqmCg8SsHq3g9 Pq9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date:dkim-signature; bh=zkRCa+NTqWpOIdq/jqfpsyHt0d28CmntbyTv6L+6Q4A=; b=IjlnjQVYI2dURa15gqKhkSOeQbii1zYrESO4QszxZlBwb66xSHn9yJNujlxjhHNc+P qt3h/II/Wt8nvw5SR5CXwX2MXVtoE4dbP+Zl+eeQBUSx9vp/Sl5/sJ97P86ltlm7JsHC QIACnRPXDbT+bXRy94lChjc2gJMi86WEDJ3HaSrwtGY49scrcfUl1oyPludsfuGuMr9h zO64V4E6k1DoFW3VowLQtiCniWDLmlWnFPhoMUtwMsg65uEXzyDUknmMmr7Fglr3CnOB nPXj8+UmNzxLYl8fpcdKQGg7gtBv0TDpPsag/ntVJ/OPDwmumzwPNwdb2o8zqQ/tnOVU +edQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Im1lFVDG; 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=QUARANTINE 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 g1si4809072pld.217.2019.03.04.16.21.55; Mon, 04 Mar 2019 16:22:10 -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=Im1lFVDG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726597AbfCEAVe (ORCPT + 99 others); Mon, 4 Mar 2019 19:21:34 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44794 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726066AbfCEAVd (ORCPT ); Mon, 4 Mar 2019 19:21:33 -0500 Received: by mail-pg1-f193.google.com with SMTP id j3so4254406pgm.11; Mon, 04 Mar 2019 16:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :user-agent:message-id:content-transfer-encoding; bh=zkRCa+NTqWpOIdq/jqfpsyHt0d28CmntbyTv6L+6Q4A=; b=Im1lFVDGq6RNR7kRlOjQC6Fdrwgnc29ksRFRgsxG8IQAzRyyLq7Oz3Ubqtd9tqSsAq KEWDiqkLaYpqCO4CBUiYg9n7BtWF7le0JWqzkLdJQ0Jyvu77vbKNTQl9aFcAhfufKghO uANv9HxVAsCXnb8oz9Q5Dy1YbJDLsUWh7YeR2vbi53D3MaImJxANNc8dGOUV1oQPBukY 6qLWQAJoTFE95cDb5hiaDuo6iHL/kslrvSoW3v9YfdZ0wyGqwZvgGEwl2f8JgScmavIV z3y6NaKMAG+KDLQ+TfobxTJf2aaY45ogkSMyEeUloRsJmJvZ6oH1Luox59yVd3jbC8qD eH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:user-agent:message-id:content-transfer-encoding; bh=zkRCa+NTqWpOIdq/jqfpsyHt0d28CmntbyTv6L+6Q4A=; b=iWLQlSjUy3sfP0thnDCVkHmVMmIjfM90IWCqhfkTH+NkDHFsuMz1IMqXoPc9dM0nhg jFF05cosMrHDA3cFjRclYeIJf9rCMLrCWTvrz4L9Q+1LIZfuRHxWPn8asd13HPmnxneZ wILwdI4cJ0fH70QOOMM+lxP0Nqg0L3/WLQ3/wlmJzNdof6oI1gQMj0SmE4qb8TlGnbli GVv1JyzoQmSaIltOzwV+8pGEMQYXI9S+IcI3t57E11WcmDPvELOue1t6dLg31j9J5V3y bpvsJZOuZvqMacE+eBHmPdkQJMvKCZNZe2XDD1ppJ1YB4bX5VS3PhTNfeeFjX9JtM4r/ 7pGQ== X-Gm-Message-State: AHQUAuaFWt4Ub3pJT4tu4FZ2DaBZ4RBKTf9RWgAW9pDreQxgufgubjl2 Df7n/EXXy+PNwq6n5A4q3sU= X-Received: by 2002:aa7:8c4d:: with SMTP id e13mr22784279pfd.53.1551745292271; Mon, 04 Mar 2019 16:21:32 -0800 (PST) Received: from localhost ([1.128.139.57]) by smtp.gmail.com with ESMTPSA id b8sm9121530pgq.33.2019.03.04.16.21.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Mar 2019 16:21:31 -0800 (PST) Date: Tue, 05 Mar 2019 10:21:24 +1000 From: Nicholas Piggin Subject: Re: [PATCH 01/20] asm-generic/mmiowb: Add generic implementation of mmiowb() tracking To: Linus Torvalds Cc: Andrea Parri , Arnd Bergmann , Benjamin Herrenschmidt , Rich Felker , David Howells , Daniel Lustig , linux-arch , Linux List Kernel Mailing , "Maciej W. Rozycki" , Ingo Molnar , Michael Ellerman , Palmer Dabbelt , Paul Burton , "Paul E. McKenney" , Peter Zijlstra , Alan Stern , Tony Luck , Will Deacon , Yoshinori Sato References: <20190301140348.25175-1-will.deacon@arm.com> <20190301140348.25175-2-will.deacon@arm.com> <1551575210.6lwpiqtg5k.astroid@bobo.none> <1551583190.duzqnmfnvg.astroid@bobo.none> <1551606848.8cceyn7nhv.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 User-Agent: astroid/0.14.0 (https://github.com/astroidmail/astroid) Message-Id: <1551743521.hogpbicfcz.astroid@bobo.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds's on March 4, 2019 4:48 am: > On Sun, Mar 3, 2019 at 2:05 AM Nicholas Piggin wrote: >> >> Why even bother with it at all, "internal" or not? Just get rid of >> mmiowb, the concept is obsolete. >=20 > It *is* gone, for chrissake! Only the name remains as an internal > detail of "this is what we need to do". >=20 >> Pretend ia64 doesn't exist for a minute. Now the regular mb/wmb barriers >> orders IO across CPUs with respect to their cacheable accesses. >=20 > Stop with the total red herring already. >=20 > THIS HAS NOTHING TO DO WITH mb()/wmb(). >=20 > As long as you keep bringing those up, you're only showing that you're > talking about the wrong thing. Why? I'm talking about them because they are not taken care of by this=20 part of mmiowb removal. Talking about spin locks is the wrong thing because we're already past that and everybody agrees it's the right approach. >> Regardless of whether that cacheable access is a spin lock, a bit lock, >> an atomic, a mutex... This is how it was before mmiowb came along. >=20 > No. >=20 > Beflore mmiowb() came along, there was one rule: do what x86 does. >=20 > And x86 orders mmio inside spinlocks. >=20 > Seriously. > > Notice how there's not a single "barrier" mentioned here anywhere in > the above. No "mb()", no "wmb()", no nothing. Only "spinlocks order > IO". >=20 > That's the fundamental rule (that we broke for ia64), and all that > matters for this patch series. >=20 > Stop talking about wmb(). It's irrelevant. A spinlock does not > *contain* a wmb(). Well you don't have to talk about it but why do you want me to stop? I don't understand. It's an open topic still after this series. I can post a new thread about it if that would upset you less, I just thought it would kind of fit here because we're talking about mmiowb, I'm not trying to derail this series. > Nobody even _cares_ about wmb(). They are entirely irrelevant wrt IO, > because IO is ordered on any particular CPU anyway (which is what > wmb() enforces). >=20 > Only when you do special things like __raw_writel() etc does wmb() > matter, but at that point this whole series is entirely irrelevant, > and once again, that's still about just ordering on a single CPU. >=20 > So as long as you talk about wmb(), all you show is that you're > talking about something entirely different FROM THIS WHOLE SERIES. >=20 > And like it or not, ia64 still exists. We support it. It doesn't > _matter_ and we don't much care any more, but it still exists. Which > is why we have that concept of mmiowb(). >=20 > On other platforms, mmiowb() might be a wmb(). Or it might not. It > might be some other barrier, or it might be a no-op entirely without a > barrier at all. It doesn't matter. But mmiowb() exists, and is now > happily entirely hidden inside the rule of "spinlocks order MMIO > across CPU's". The driver writer still has to know exactly as much about mmiowb (the concept, if not the name) before this series as afterward. That is, sequences of mmio stores to a device from different CPUs can only be atomic if you (put mmiowb before spin unlock | protect them with spin locks). I just don't understand the reason to expose the driver writer to that additional detail. Intuitively, mb() should order stores to all kind of memory the same as smp_mb() orders stores to cacheable (without the detail of stores being reordered at the interconnect or controller -- driver writer doesn't care about store queues in the CPU or whatever details, they want the device to see IOs in some order). Thanks, Nick =