Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2335226imb; Mon, 4 Mar 2019 02:24:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwfqVobnkux8O0IBksgXayqLi+kIApmlBh7T7McG389hdPl48WoMEI0FeM6trHZU1XBAk9H X-Received: by 2002:a65:4243:: with SMTP id d3mr17783370pgq.56.1551695095561; Mon, 04 Mar 2019 02:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551695095; cv=none; d=google.com; s=arc-20160816; b=p/eNHZD9e1maofU3n8cJKTqFjK8z/Au8r2IrWablRVMa03LUaPWlpM1aQkumnNPMDp 9ls5Wm9a1QIauX2867+6sNNqoFzPVoFbCWcGY4pJimZXTllDkAib3yFe52CXm1/82YWx FYd9N8WTFcgyfue8Il3Mcbrx5faUJ2S546ZCqz8Ii04g9IvYPqyefmsT4famk+kMZN1k 9O+ggROQnkAfAJRstBiMAsy7I2SPvW+kjtys1tiyYbosLgEKYsTTToiQ906uQT1ICE0t zaszmSxHj2DPrBR/AUiH/VgDyglmZ+DdCBZgaP7hGZ7YMNV0UwRdgMnCRHmKkuHMLuqF UrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=nmgD0jEKrComWY98BfZsIQ714XgRL5SB1BUk7brTg/0=; b=MgvOUiWyIf4K/egXn7xURBbR4CLMWZjR288v8ypbnt6Zlq1WVuxlDOcsSCVC/1d9PK uFzw1MVdXlmK2trwP9eyFUV/T/ouTkeHtsMjVocWJVuqqIrRvcY0VWtOG6GR8hDfNE6c JdV+t6J0QIY5n7uYiBthDEnyx7k9yVXI686yL6K2u6pGcfM30UUF7ZmfcHvagooYSVxT vf5djPrMv/Y3g3ZKagQ5mh+gMDu5njWh5sX6zMFrY+hVZFw2HNG6fzaH+9O7fcWMr6Sy 69hHD45poa01XQxXaaA6LrOmuH3FLrtWBP14/y6MEO9N44OslWcMpOeX2txRKFBCdoFC NNVg== ARC-Authentication-Results: i=1; mx.google.com; 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 p17si5041409pgg.259.2019.03.04.02.24.39; Mon, 04 Mar 2019 02:24:55 -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; 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 S1726088AbfCDKYU (ORCPT + 99 others); Mon, 4 Mar 2019 05:24:20 -0500 Received: from ozlabs.org ([203.11.71.1]:41509 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726032AbfCDKYT (ORCPT ); Mon, 4 Mar 2019 05:24:19 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 44CbjT4CJzz9s4V; Mon, 4 Mar 2019 21:24:13 +1100 (AEDT) From: Michael Ellerman To: Nicholas Piggin , linux-arch@vger.kernel.org, Will Deacon Cc: Andrea Parri , Arnd Bergmann , Benjamin Herrenschmidt , Rich Felker , David Howells , Daniel Lustig , linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Ingo Molnar , Palmer Dabbelt , Paul Burton , "Paul E. McKenney" , Peter Zijlstra , Alan Stern , Tony Luck , Linus Torvalds , Yoshinori Sato Subject: Re: [PATCH 01/20] asm-generic/mmiowb: Add generic implementation of mmiowb() tracking In-Reply-To: <1551575210.6lwpiqtg5k.astroid@bobo.none> References: <20190301140348.25175-1-will.deacon@arm.com> <20190301140348.25175-2-will.deacon@arm.com> <1551575210.6lwpiqtg5k.astroid@bobo.none> Date: Mon, 04 Mar 2019 21:24:12 +1100 Message-ID: <87ef7n7x9v.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nicholas Piggin writes: > Will Deacon's on March 2, 2019 12:03 am: >> In preparation for removing all explicit mmiowb() calls from driver >> code, implement a tracking system in asm-generic based loosely on the >> PowerPC implementation. This allows architectures with a non-empty >> mmiowb() definition to have the barrier automatically inserted in >> spin_unlock() following a critical section containing an I/O write. > > Is there a reason to call this "mmiowb"? We already have wmb that > orders cacheable stores vs mmio stores don't we? > > Yes ia64 "sn2" is broken in that case, but that can be fixed (if > anyone really cares about the platform any more). Maybe that's > orthogonal to what you're doing here, I just don't like seeing > "mmiowb" spread. > > This series works for spin locks, but you would want a driver to > be able to use wmb() to order locks vs mmio when using a bit lock > or a mutex or whatever else. Without wading into the rest of the discussion, this does raise an interesting point, ie. what about eg. rwlock's? They're basically equivalent to spinlocks, and so could reasonably be expected to have the same behaviour. But we don't check the io_sync flag in arch_read/write_unlock() etc. and both of those use lwsync. Seems like we just forgot they existed? Commit f007cacffc88 ("[POWERPC] Fix MMIO ops to provide expected barrier behaviour") that added the io_sync stuff doesn't mention them at all. Am I missing anything? AFAICS read/write locks were never built on top of spin locks, so seems like we're just hoping drivers using rwlock do the right barriers? cheers